COM: Component Object Model - PowerPoint PPT Presentation

1 / 49
About This Presentation
Title:

COM: Component Object Model

Description:

HP/UX. COM. Digital Open VMS. COM. Siemens Nixdorf SINIX. COM. SCO UnixWare. COM ... void CellBorder(unsigned long Color, short Left, short Top, short Right, short ... – PowerPoint PPT presentation

Number of Views:83
Avg rating:3.0/5.0
Slides: 50
Provided by: joem63
Category:

less

Transcript and Presenter's Notes

Title: COM: Component Object Model


1
COM Component Object Model
  • Object Oriented Programming
  • Classes in Languages
  • Independent of Language

2
What is COM?Build software from parts, not from
scratch
  • A framework for creating and using components
  • Makes software easier to write and reuse
  • Provides widest choice in services, tools,
    languages, and applications
  • Controls, tools, and server components

3
COM Features
  • Services used in a standard way, regardless of
    location
  • Any Programming Language
  • Integrated with Development Tools
  • Flexible Security
  • Multiple Network Transports

4
Accessing COM Services
5
Any Language/Tool when invented
6
COM Multiple Network Transports
C O M
C O M
COM Object
Clients
Server Machine
Client Machine
7
COM Flexible Security
C O M
C O M
COM Object
Clients
Server Machine
Client Machine
8
COM Ubiquitous
HP/UX
Sun Solaris (Sparc) 2.5 RC
Q397
Q497
Digital Open VMS
Digital Unix 4.0 (Alpha) RC
COM Client
Q397
H198
DCOM
Siemens Nixdorf SINIX
IBM MVS 5.2.2 (OS390)
Q198
H198
Linux 2.0 (Intel)
IBM OS/400
COM
H198
Q497
SCO UnixWare
IBM AIX
COM
H198
H198
Download the from http//www.sagus.com
9
Registering an ActiveX Control
  • (Way 1) Through its setup program
  • (way 2) Dos Shell
  • Change Dir to the place of program (.ocx)
  • Dos_Propmt gtregsvr32 prog.ocx
  • Add to your Project

10
Registering OLE Controls
  • AfxOleRegisterControlClassAdds the control's
    class to the registration database.
  • AfxOleRegisterPropertyPageClassAdds a control
    property page to the registration database.
  • AfxOleRegisterTypeLibAdds the control's type
    library to the registration database.
  • AfxOleUnregisterClassRemoves a control class or a
    property page class from the registration
    database.
  • AfxOleUnregisterTypeLibRemoves the control's type
    library from the registration database.

11
(No Transcript)
12
(No Transcript)
13
(No Transcript)
14
(No Transcript)
15
(No Transcript)
16
(No Transcript)
17
(No Transcript)
18
(No Transcript)
19
(No Transcript)
20
(No Transcript)
21
(No Transcript)
22
(No Transcript)
23
(No Transcript)
24
(No Transcript)
25
Adding Controls to Projects
26
Customize Toolbox
27
Example Adding vsFlexArrayCtrl
28
vsFlexArrayCtrl Properties
29
Member variable for control
30
Adding COM to Projects VS2005
  • A Dialog Application/ Select the Main Dialog
  • Right Click on ToolBox/Choose Items

31
Choose Items
32
Insert Activex Control
33
Working With Flexgrid
  • How to use properties and methods

34
Get Column Alignment
long get_ColAlignment(long Col) long result
static BYTE parms VTS_I4
InvokeHelper(0x63, DISPATCH_PROPERTYGET, VT_I4,
(void)result, parms, Col) return result
In File afxdisp.h define VTS_I4
"\x03" // a 'long
/ Flags for IDispatchInvoke / // in
oleauto.h define DISPATCH_METHOD
0x1 define DISPATCH_PROPERTYGET 0x2 define
DISPATCH_PROPERTYPUT 0x4 define
DISPATCH_PROPERTYPUTREF 0x8
35
Set Column Alignment
void put_ColAlignment(long Col, long newValue)
static BYTE parms VTS_I4 VTS_I4
InvokeHelper(0x63, DISPATCH_PROPERTYPUT,
VT_EMPTY, NULL, parms, Col, newValue)
enum flexAlignLeftTop 0,
flexAlignLeftCenter 1,
flexAlignLeftBottom 2, flexAlignCenterTop
3, flexAlignCenterCenter 4,
flexAlignCenterBottom 5,
flexAlignRightTop 6, flexAlignRightCenter
7, flexAlignRightBottom 8,
flexAlignGeneral 9 AlignmentSettings
36
Get Column Width
long get_ColWidth(long Col) long result
static BYTE parms VTS_I4
InvokeHelper(0x64, DISPATCH_PROPERTYGET, VT_I4,
(void)result, parms, Col) return result
37
Set Column Width
void put_ColWidth(long Col, long
newValue) static BYTE parms VTS_I4 VTS_I4
InvokeHelper(0x64, DISPATCH_PROPERTYPUT,
VT_EMPTY, NULL, parms, Col, newValue)
38
Similar Functions
long get_RowHeight(long Row) void
put_RowHeight(long Row, long newValue) BOOL
get_MergeRow(long Row) void put_MergeRow(long
Row, BOOL newValue) BOOL get_MergeCol(long
Col) void put_MergeCol(long Col, BOOL
newValue) long get_RowPosition(long Row) void
put_RowPosition(long Row, long newValue) void
put_RowPosition(long Row, long newValue) long
get_ColPosition(long Col) void
put_ColPosition(long Col, long newValue) long
get_RowData(long Row) void put_RowData(long Row,
long newValue) long get_ColData(long Col) void
put_ColData(long Col, long newValue) void
AddItem(LPCTSTR Item, VARIANT Row)
39
void RemoveItem(long Row) CString
get_TextMatrix(long Row, long Col) void
put_TextMatrix(long Row, long Col, LPCTSTR
newValue) void Clear(VARIANT Where, VARIANT
What) void EditCell() double get_ValueMatrix(lon
g Row, long Col) BOOL get_IsSubtotal(long
Row) void put_IsSubtotal(long Row, BOOL
newValue) void Subtotal(long Function, VARIANT
GroupOn, VARIANT TotalOn, VARIANT Format, VARIANT
BackColor, VARIANT ForeColor, VARIANT FontBold,
VARIANT Caption, VARIANT MatchFrom) void
Refresh() void Outline(short Level) long
get_FixedAlignment(long Col) void
put_FixedAlignment(long Col, long newValue) BOOL
get_RowIsVisible(long Row) BOOL
get_ColIsVisible(long Col)
40
long get_RowPos(long Row) long get_ColPos(long
Col) BOOL get_IsSelected(long Row) void
put_IsSelected(long Row, BOOL newValue) CString
get_TextArray(long index) void
put_TextArray(long index, LPCTSTR newValue) long
get_IsCollapsed(long Row) void
put_IsCollapsed(long Row, long newValue) void
Select(long Row, long Col, VARIANT RowSel,
VARIANT ColSel) void AutoSize(long Col1, VARIANT
Col2, VARIANT Equal) void DataRefresh() void
CellBorder(unsigned long Color, short Left, short
Top, short Right, short Bottom, short Vertical,
short Horizontal) void OleDrag() long
SaveGrid(LPCTSTR FileName, long SaveWhat) long
LoadGrid(LPCTSTR FileName, long LoadWhat)
41
void Archive(LPCTSTR arcFileName, LPCTSTR
FileName, long Action) VARIANT
get_ArchiveInfo(LPCTSTR ArcFile, long InfoType,
VARIANT index) long get_ColSort(long Col) void
put_ColSort(long Col, long newValue) CString
get_ColFormat(long Col) void put_ColFormat(long
Col, LPCTSTR newValue) long get_ColDataType(long
Col) void put_ColDataType(long Col, long
newValue) void AboutBox()
42
Working with Properties
  • CString GetFontName()
  • CString result
  • GetProperty(0x9, VT_BSTR, (void)result)
  • return result

43
Properties
  • void SetFontName(CString propVal)
  • float GetFontSize()
  • void SetFontSize(float propVal)
  • BOOL GetFontBold()
  • void SetFontBold(BOOL propVal)
  • BOOL GetFontItalic()
  • void SetFontItalic(BOOL propVal)
  • BOOL GetFontStrikethru()
  • void SetFontStrikethru(BOOL propVal)
  • BOOL GetFontUnderline()

44
void SetFontUnderline(BOOL propVal) long
GetRows() void SetRows(long propVal) long
GetCols() void SetCols(long propVal) short
GetVersion() void SetVersion(short
propVal) CString GetFormatString() void
SetFormatString(CString propVal) long
GetFixedRows() void SetFixedRows(long
propVal) long GetFixedCols() void
SetFixedCols(long propVal) long GetTopRow() void
SetTopRow(long propVal) long GetLeftCol() void
SetLeftCol(long propVal)
45
long GetRow() void SetRow(long propVal) long
GetCol() void SetCol(long propVal) long
GetRowSel() void SetRowSel(long propVal) long
GetColSel() void SetColSel(long propVal) CString
GetText() void SetText(CString propVal) unsigned
long GetBackColor() void SetBackColor(unsigned
long propVal) unsigned long GetForeColor() void
SetForeColor(unsigned long propVal) unsigned long
GetBackColorFixed() void SetBackColorFixed(unsigne
d long propVal)
46
unsigned long GetForeColorFixed() void
SetForeColorFixed(unsigned long propVal) unsigned
long GetBackColorSel() void SetBackColorSel(unsign
ed long propVal) unsigned long GetForeColorSel() v
oid SetForeColorSel(unsigned long
propVal) unsigned long GetBackColorBkg() void
SetBackColorBkg(unsigned long propVal) BOOL
GetWordWrap() void SetWordWrap(BOOL propVal) long
GetTextStyle() void SetTextStyle(long
propVal) long GetTextStyleFixed() void
SetTextStyleFixed(long propVal) BOOL
GetScrollTrack() void SetScrollTrack(BOOL
propVal) long GetFocusRect() void
SetFocusRect(long propVal)
47
long GetHighLight() void SetHighLight(long
propVal) BOOL GetRedraw() void SetRedraw(BOOL
propVal) long GetScrollBars() void
SetScrollBars(long propVal) long
GetMouseRow() void SetMouseRow(long propVal) long
GetMouseCol() void SetMouseCol(long propVal) long
GetCellLeft() void SetCellLeft(long propVal) long
GetCellTop() void SetCellTop(long propVal) long
GetCellWidth() void SetCellWidth(long
propVal) long GetCellHeight() void
SetCellHeight(long propVal)
48
long GetRowHeightMin() void SetRowHeightMin(long
propVal) long GetFillStyle() void
SetFillStyle(long propVal) long
GetGridLines() void SetGridLines(long
propVal) long GetGridLinesFixed() void
SetGridLinesFixed(long propVal) unsigned long
GetGridColor() void SetGridColor(unsigned long
propVal) unsigned long GetGridColorFixed() void
SetGridColorFixed(unsigned long propVal) unsigned
long GetCellBackColor() void SetCellBackColor(unsi
gned long propVal) unsigned long
GetCellForeColor() void SetCellForeColor(unsigned
long propVal) long GetCellAlignment() void
SetCellAlignment(long propVal)
49
Writing Data on Cells
  • for(int i0ilttable.GetCols()i)
  • for(int j0jlttable.GetRows()j)
  • table.SetRow(j)
  • table.SetCol(i)
  • char str80
  • sprintf(str,"Cell d , d",j,i)
  • table.Set_Text(str)
Write a Comment
User Comments (0)
About PowerShow.com