Home > Software engineering >  PIUnknown -> QueryInterface (const IID & IID, void * * PPV) in the first parameter how to underst
PIUnknown -> QueryInterface (const IID & IID, void * * PPV) in the first parameter how to underst

Time:11-21

COM, through pIUnknown - & gt; QueryInterface (const IID& Iid, void * * PPV) to the query, but the first parameter to don't understand, he is not a kind of ID, is the interface ID, but the const IID& What is iid value, is the default? How to obtain is not the default?

CodePudding user response:

Is com components each have an id, the concept of a similar name, you pass the name to look up, thus by PPV interface to return it to you

CodePudding user response:

reference 1st floor oyljerry response:
is com components each have an id, the concept of a similar name, to find you by this name, which may by PPV interface to return it to you

How to get this name

CodePudding user response:

//Generated. The IDL file (by the OLE/COM Object Viewer)
//
//typelib filename: XCDZIP35 OCX


Uuid (c7d B26F6243-4-11 d1-910 - e - 00600807163 - f),
Version (2.78),
Helpstring (" Xceed Zip ActiveX Control ")
]
The library XCEEDZIPLib
{
//TLib://TLib: Standard OLE Types: {BEF6E001 - A874-101 - a - 8 bba - 00 aa00300cab}
Importlib (" olepro32. DLL ");
//TLib: OLE Automation: {00020430-0000-0000 - C000-000000000046}
Stdole32. TLB importlib (" ");

//the Forward declare all types defined in this typelib
Dispinterface _DXceedZip;
Dispinterface _DXceedZipEvents;


Uuid (c7d B26F6244-4-11 d1-910 - e - 00600807163 - f),
Helpstring (" Dispatch interface for Xceed Zip Control "),
Hidden
]
Dispinterface _DXceedZip {
Properties:
[id (0 x00000001)]
VARIANT_BOOL Abort.
[id (0 x00000002)]
Short Compression will;

.
[id (0 xfffffdd8)]
Void AboutBox ();
};


Uuid (c7d B26F6245-4-11 d1-910 - e - 00600807163 - f),
Helpstring (" the Event interface for Xceed Zip Control ")
]
Dispinterface _DXceedZipEvents {
Properties:
Methods:
[id (0 x00000001)]
Void Adding (
BSTR * FileName,
Long Size,
Long PSize,
Long Processed,
Short FileAttr,
BSTR * FTime,
Long CRC,
Short thewire,
Short Completion,
Short Method,
Short Encrypted,
Short ComLen,
BSTR * Comment);
[id (0 x00000002)]
Void Deleting (BSTR * FileName);
[id (0 x00000003)]
Void Extracting (
BSTR * FileName,
Long Size,
Long PSize,
Long Processed,
Short FileAttr,
BSTR * FTime,
Long CRC,
Short thewire,
Short Completion,
Short Method,
Short Encrypted,
Short ComLen,
BSTR * Comment);
[id (0 x00000004)]
Void FileComment (
BSTR * FileName,
Short * ComLen,
BSTR * Comment);
[id (0 x00000005)]
Void Fixing (BSTR * FileName);
[id (0 x00000006)]
Void Listing (
BSTR * FileName,
Long Size,
Long PSize,
Long Processed,
Short FileAttr,
BSTR * FTime,
Long CRC,
Short thewire,
Short Completion,
Short Method,
Short Encrypted,
Short ComLen,
BSTR * Comment);

.
[id (0 x0000000f)]
Void Rename (
BSTR * OrigName,
BSTR * NewName);
};


Uuid (c7d B26F6246-4-11 d1-910 - e - 00600807163 - f),
Helpstring (" Xceed Zip Control "),
The control
]
Coclass XceedZip {
[default] dispinterface _DXceedZip;
[default, the source] dispinterface _DXceedZipEvents;
};
};

If UUID these

CodePudding user response:

Help me to look at a simple OCX loading problem, thank you
X4c7d xb26f6246 const GUID MyOcxCLSID={0, 0, 0 x11d1, 0 x91, 0 x0e, 0 x00 to 0 x60, 0 x08, 0 x07, 0 x16, 0 x3f};//I am OCX, clsids
If (CoInitialize (NULL). S_OK)={
Printf (" the Initialize COM library failed! \n");
Return 1 l;
}





HResult=CoCreateInstance (MyOcxCLSID, NULL, CLSCTX_INPROC_SERVER, IID_IUnknown, (void * *) & amp; PUnknown);
If (hResult!=S_OK)
{
Printf (" Create object failed! \n");
Return 1 l;
}

//returns the IID_IUnknown is {00020430-0000-0000 - C000-000000000046}//the IID like I did not want the
As is the OLE system

HResult=pUnknown - & gt; QueryInterface (IID_IUnknown, (void * *) & amp; PpIface);
If (hResult! S_OK)={
PUnknown - & gt; Release ();
Printf (" QueryInterface IDictionary failed! \n");
CoUninitialize ();
Return 1 l;
}

//return ppIface, by * * a query, also can't get my OCX there, I checked my OCX is loaded into the 10001000 above, and the pointer to the address on the 5 FXXXXXX, not my OCX code
If (pUnknown - & gt; Release ()!=0)
CoUninitialize ();

Return 1 l;

CodePudding user response:

Com essentialism system to learn,

CodePudding user response:

LS positive solution, make the book to see,
This id is called the interface id, in plain English, what do you want the COM components function, pass what the interface id is ok,

CodePudding user response:

An object can have multiple interfaces, CLS_ID is the object's ID, ID IID is the interface

CodePudding user response:

Is a UUID, usually you need to define it. H file wrapped up, the package also, anyway, will not change UUID, you copied to you. H file directly from inside, also can,

CodePudding user response:

What implements a component interface, the author will say in the document, there is no document only a IUnknown do whatever you like,
  • Related