Article ID: 154664
Article Last Modified on 12/2/2003
// Note: We add support for IID_ITestVB to support typesafe binding
// from VBA. This IID must match the GUID that is attached to the
// dispinterface in the .ODL file.
// {1249A4D2-D469-11CF-A68F-00AA00A70FC2}
static const IID IID_ITestVB =
{ 0x1249a4d2, 0xd469, 0x11cf,
{ 0xa6, 0x8f, 0x0, 0xaa, 0x0, 0xa7, 0xf, 0xc2 } };
BEGIN_INTERFACE_MAP(CTestVBDoc, CDocument)
INTERFACE_PART(CTestVBDoc, IID_ITestVB, Dispatch)
END_INTERFACE_MAP()
The following .reg file will register the ITestVB interface and enable
marshaling of the interface via the standard IDispatch proxy and stub.
REGEDIT
HKEY_CLASSES_ROOT\Interface\{1249A4D2-D469-11CF-A68F-00AA00A70FC2}
= ITestVB
HKEY_CLASSES_ROOT\Interface\{1249A4D2-D469-11CF-A68F-00AA00A70FC2}
ProxyStubClsid = {00020420-0000-0000-C000-000000000046}
HKEY_CLASSES_ROOT\Interface\{1249A4D2-D469-11CF-A68F-00AA00A70FC2}
ProxyStubClsid32 = {00020420-0000-0000-C000-000000000046}
To programmatically register the interface, #include <winreg.h>, and insert
the following code (with the proper dispatch ID) in the InitInstance of the
automation server:
HKEY key;
// Open HKEY_CLASSES_ROOT
RegOpenKey(HKEY_CLASSES_ROOT, _T("Interface"), &key);
// Set up the key
RegSetValue( key,
_T("{1249A4D2-D469-11CF-A68F-00AA00A70FC2}"), REG_SZ,
_T("ITestVB"), 0);
RegSetValue( key,
_T("{1249A4D2-D469-11CF-A68F-00AA00A70FC2}\\ProxyStubClsid"),
REG_SZ, _T("{00020420-0000-0000-C000-000000000046}"), 0);
RegSetValue( key,
_T("{1249A4D2-D469-11CF-A68F-00AA00A70FC2}\\ProxyStubClsid32"),
REG_SZ, _T("{00020420-0000-0000-C000-000000000046}"), 0);
RegCloseKey(key);
Additional query words: Automation 430
Keywords: kbctrlcreate kbautomation kbprb KB154664