TOP Visual C++ API Microsoft Win32API VARIANT HTML
Component Object Model
1.Initialize the COM library.
2.Create a COM object used to create shortcuts, and get an IShellLink interface.
3.Call the SetPath() method of the IShellLink interface.
4..
5.Call the Save() method of the IPersistFile interface.
6.Release the interfaces.
7.Uninitialize the COM library.
|the status code||.
Component Object Model
CComPtr | ATL class |
_com_ptr_t | an COM support classes to support non ATL COM development |
_bstr_t
_com_error
_com_ptr_t
_variant_t
wrappers of basic COM functionality.
like COM smart pointer typedefs over raw COM inteface classes works just by using tlb file.
view sourceprint?
1 _COM_SMARTPTR_TYPEDEF(IMyInterface, __uuidof(IMyInterface));
This above line declares _com_ptr_t specialization IMyInterfacePtr.
The library to link to for using COM support classes is comsuppw.lib.
_com_error
_com_ptr_t
_variant_t
wrappers of basic COM functionality.
like COM smart pointer typedefs over raw COM inteface classes works just by using tlb file.
view sourceprint?
1 _COM_SMARTPTR_TYPEDEF(IMyInterface, __uuidof(IMyInterface));
This above line declares _com_ptr_t specialization IMyInterfacePtr.
The library to link to for using COM support classes is comsuppw.lib.
基本的なCOMのインタフェース:IUnknown
- COM is : a method for sharing binary code across different applications and languages.
- COM specifies that the binary modules (the DLLs and EXEs) must be compiled to match a specific structure.
- The standard also specifies exactly how COM objects must be organized in memory.
- The binaries must also not depend on any feature of any programming language (such as name decoration in C++).
- Unicode
interface | Multiple inheritance is not allowed with interfaces |
component object class | contained in a DLL or EXE implement interfaces |
a COM object | an instance of a component object class in memory |
a COM server | a binary (DLL or EXE) |
Registration | the process of creating registry entries |
Unregistration | removing the registry entries |
a GUID | globally unique identifier,a 128-bit number |
a class ID CLSID | a GUID that names a component object class |
an interface ID IID | a GUID that names an interface |
HRESULT | an integral type used by COM to return error and success codes |
Create | Delete | |
C++ | use operator new~ | use operator delete |
create an object on the stack | let a stack object go out of scope | |
COM | call an API in the COM library | all objects keep their own reference counts. The caller must tell the object when the caller is done using the object. COM objects free themselves from memory when the reference count reaches 0 |
HRESULT CoCreateInstance ( REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID riid, LPVOID* ppv ); | pISL->Release(); |
param | contents | memo |
rclsid | CLSID | ex) CLSID_ShellLink |
pUnkOuter | Aggregating COM objects | which is a way of taking an existing component object class and adding new methods to it NULL to indicate not using aggregation |
dwClsContext | kind of COM servers | ex) CLSCTX_INPROC_SERVER you should not use CLSCTX_ALL (which is the default in ATL) because it will fail on Windows 95 systems that do not have DCOM installed |
riid | IID | ex)IID_IShellLink |
ppv | Address of an interface pointer |
AddRef() | Tells the COM object to increment its reference count | Use when to have a copy of an interface pointer |
Release() | Tells the COM object to decrement its reference count | |
QueryInterface() | Requests an interface pointer from a COM object | use when a component object class implements more than one interface |
HRESULT IUnknown::QueryInterface ( REFIID iid, void** ppv );
iid | IID |
ppv | Address of an interface pointer |
Nr. | single REFIID | multiple REFIID | |
1 | Initialize the COM library | CoInitialize(NULL); | |
2 | Create a COM object A, and get an interface a | CoCreate(...,&a); | |
3 | Call the method of the COM object | a->func() | |
4 | N/A | Call QueryInterface() on the COM object B and get another interface b | a->QueryInterface(...,&b); |
5 | N/A | Call the method of the COM object | b->func() |
6 | Release the interface a | a->Release() | |
7 | N/A | Release the interface b | b->Release() |
8 | Uninitialize the COM library | CoUninitialize(); |
1.Initialize the COM library.
2.Create a COM object used to create shortcuts, and get an IShellLink interface.
3.Call the SetPath() method of the IShellLink interface.
4..
5.Call the Save() method of the IPersistFile interface.
6.Release the interfaces.
7.Uninitialize the COM library.
severity bit | indicate success or failure | |
the facility code | source component/program of HREULT | 16-bits |
HRESULT | Facility | Severity | Status |
REGDB_E_READREGDB | REGDB(registry database) | E(error} | READREGDB (a description of the error} |
S_OK | (none)(generic) | S (success) | OK(description of status) |
INFO: OLE Threads Must Dispatch Messages
HTML 通知の処理
[[IEコンポーネントの使い方 [VC++の使い方]>http://www.nitoyon.com/vc/tips/ie_component.htm]]
Sink Events
BHO (Browser Helper Objects)
IE Programming
Google Answers: Recieving events from Internet Explorer
Keeping an Eye on Your Browser by Monitoring Internet Explorer 4.0 Events
Display a Web Page in a Plain C Win32 Application
HTML 通知の処理
[[IEコンポーネントの使い方 [VC++の使い方]>http://www.nitoyon.com/vc/tips/ie_component.htm]]
Sink Events
BHO (Browser Helper Objects)
IE Programming
Google Answers: Recieving events from Internet Explorer
Keeping an Eye on Your Browser by Monitoring Internet Explorer 4.0 Events
Display a Web Page in a Plain C Win32 Application
ATL と MFC の文字列変換マクロ
USES_CONVERSIONマクロは、ATL(Active Template Library)で提供される文字コード変換用マクロを利用する前に必ず宣言しなければならなかったが、
ユニコード統一で、不要になった。
USES_CONVERSIONマクロは、ATL(Active Template Library)で提供される文字コード変換用マクロを利用する前に必ず宣言しなければならなかったが、
ユニコード統一で、不要になった。
C++/CLIでCreateInstance呼んでいるところと
COM の初期化 不要
共通言語ランタイムは、モジュールが初期化されると自動的に COM を初期化します (自動的に初期化される場合、COM は MTA として初期化されます)。その結果、明示的に COM を初期化すると、COM が既に初期化されていることを示すリターン コードが生成されます。COM が CLR によって既にいずれかのスレッド モデルに初期化されている場合、別のスレッド モデルを使用して明示的に COM を初期化しようとすると、アプリケーションが失敗するおそれがあります。
COM の初期化 不要
共通言語ランタイムは、モジュールが初期化されると自動的に COM を初期化します (自動的に初期化される場合、COM は MTA として初期化されます)。その結果、明示的に COM を初期化すると、COM が既に初期化されていることを示すリターン コードが生成されます。COM が CLR によって既にいずれかのスレッド モデルに初期化されている場合、別のスレッド モデルを使用して明示的に COM を初期化しようとすると、アプリケーションが失敗するおそれがあります。
最新コメント