Home > Software engineering >  A COM the problem of the virtual table pointer, I confused, look not to understand, used friend taug
A COM the problem of the virtual table pointer, I confused, look not to understand, used friend taug

Time:09-22

LPVOID FAR * ppIface=NULL;


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}; .//My that XCDZIP35 OCX
X4c7d xb26f6244 const IID MyOcxFaceID={0, 0, 0 x11d1, 0 x91, 0 x0e, 0 x00 to 0 x60, 0 x08, 0 x07, 0 x16, 0 x3f};

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;
}

HResult=pUnknown - & gt; QueryInterface (IID_IUnknown, (void * *) & amp; PpIface);

If (hResult! S_OK)={
PUnknown - & gt; Release ();
Printf (" QueryInterface IDictionary failed! \n");
Return 1 l;
}

IID_IUnknown above refers to the object is not my OCX, be OLEXXX system, causes the ppIface get behind me is not my OCX interface pointer, I use MyOcxFaceID instead of no use, I use the OLE - the VIEW I checked the OCX,

//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 x00000026)]
VARIANT_BOOL SfxInstallMode;
[id (0 x00000027), hidden]
BSTR InternalState;
Methods:
[id (0 x00000028), propget]
BSTR SfxPrompts (short SfxPromptID);
[id (0 x00000028), propput]
Void SfxPrompts (
Short SfxPromptID,
BSTR RHS);
.
[id (0 x0000003b)]
Void SfxResetDefaultStrings ();
[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);
.
};


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;
};
};

excuse me, what the hell is going on this back, I want to get my OCX virtual table

CodePudding user response:

Look at the registration table corresponding clsids below the factory information is correct

CodePudding user response:

Use the # import, then use smart Pointers

CodePudding user response:

reference 1/f, jiangsheng response:
see registries corresponding clsids factory information below is correct

TypeLib: {d1 c7d B26F6243-4-11-910 - e - 00600807163 - f}
ProgID: XCEEDZIP. XceedZipCtrl. 1
These should be yes
Class ID is definitely yes
Path is also correct C: \ Windows \ SysWow64 \ XCDZIP35 OCX


refer to the second floor worldy response:
use # import, and then use the smart pointer

Tried, as also

CodePudding user response:

Why are two MyOcxFaceID, don't know what is the meaning of your QueryInterface,
HResult=CoCreateInstance (MyOcxCLSID, NULL, CLSCTX_INPROC_SERVER, IID_IUnknown , (void * *) & amp; PUnknown);
HResult=pUnknown - & gt; QueryInterface ( IID_IUnknown , (void * *) & amp; PpIface);

CodePudding user response:

Why are two not MyOcxFaceID

CodePudding user response:

reference 4 floor SXJIAKE response:
why are two MyOcxFaceID, don't know what is the meaning of your QueryInterface,
HResult=CoCreateInstance (MyOcxCLSID, NULL, CLSCTX_INPROC_SERVER, IID_IUnknown , (void * *) & amp; PUnknown);
HResult=pUnknown - & gt; QueryInterface ( IID_IUnknown , (void * *) & amp; PpIface);


this is to call back after the IID
HResult=CoCreateInstance (MyOcxCLSID, NULL, CLSCTX_INPROC_SERVER, IID_IUnknown, (void * *) & amp; PUnknown);

this is to use the returned IID to query the
HResult=pUnknown - & gt; nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related