-
April 20th, 2002, 10:15 AM
#1
How to convert a GUID to a REFCLSID (=const CLSID &)?
Hi,
Does anyone know how to convert a GUID to a REFCLSID (=const CLSID &)?
///When I retrieve the GUID from an OCX like below
ITypeLib *pptlib;
TLIBATTR *ppTLibAttrr;
GUID guid;
LoadTypeLib("..."/*PATH TO OCX-FIlE*/,&pptlib);
pptlib->GetLibAttr(&ppTLibAttrr);
guid = ppTLibAttrr->guid;
//And I want to use this GUID to Create an ActiveX Control on an Window
//The function fails!
CWnd cWnd
cWnd.CreateControl(guid, "", WS_VISIBLE|WS_CHILD, crTabRect, &m_cTab, 100); //FAIL
//But when I write
static CLSID const clsid = { 0xcf9904f7, 0x8623, 0x465b, { 0xa0, 0x5e, 0x9d, 0x5a, 0xa, 0x2c, 0x1a, 0xe7 } }; //ITS FROM THE SAME ACTIVEX!!!
cWnd.CreateControl(clsid, "", WS_VISIBLE|WS_CHILD, crTabRect, &m_cTab, 100);//SUCCES
//The Function succeeds!
So does anyone know how to convert the "guid" to a another format so that the CWnd::CreateControl() function Succeds?
Any Help is welcome
Thx, you're the best
Tom
-
April 20th, 2002, 07:57 PM
#2
Re: How to convert a GUID to a REFCLSID (=const CLSID &)?
Since you know the complete path to the control, try using GetClassFile() to get the CLSID instead of using the ITypeLib interface.
-
April 22nd, 2002, 01:00 AM
#3
Re: How to convert a GUID to a REFCLSID (=const CLSID &)?
pptlib->GetLibAttr returns the GUID of Type Library for which the pptlib was received. This GUID is valid to identify the Type Library, but it can not be used to create any objects.
Instead of ITypeLib::GetLibAttr you should use ItypeInfo::GetTypeAttr member to obtain the needed GUID. To enum the info types you chould use the ITypeLib::GetTypeInfoType.
With best wishes,
Vita
With best wishes,
Vita
-----------------------
Russian Software Development Network -- http://www.rsdn.ru
-
November 14th, 2013, 10:18 AM
#4
Re: How to convert a GUID to a REFCLSID (=const CLSID &)?
use
HRESULT CLSIDFromString(
_In_ LPCOLESTR lpsz,
_Out_ LPCLSID pclsid
);
http://msdn.microsoft.com/en-us/libr...(v=vs.85).aspx
-
November 14th, 2013, 11:21 AM
#5
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|