Convert a CLSID to Variant in C++

  • Thread starter Thread starter Amresh Prasad
  • Start date Start date
A

Amresh Prasad

Hi,
I need to convert a CLSID to a Variant for a RIS implementation in
C++. Can anyone give any pointers as to how I can achieve this?

Basically, I am trying to create the C++ equivalent of the sample VB
code that comes for setting up RIS. The VB code snippet is shown
below. What the code does is (1) Convert a device mac address to a
unique CLSID. (2) Creates a Variant of the CLSID and (3) Sets the
netbootGUID property on the ADSI object to the Variant.

What I need to know is how to do (2) above. Any help is much
appreciated


retval = CLSIDFromString(StrPtr(strGUID), pGUID(0))
Set oComp = GetObject("LDAP://cn=comp1,cn=computers,dc=mydomain,dc=com")
oComp.Put "netbootGUID", CVar(pGUID)
oComp.SetInfo
 
I think that one way is to convert CLSID to string first and then use
it in variant. It's common practice to convert strings back to CLSID
so, most chances that this LDAP object will understand it.

Other way is to create dreadful OLE property set and fill it with
CLSID directly. However, receiving part should be ready to get OLE
property set and should know how to treat it. I found only one decent
article on MSDN about OLE property sets:

"OLE Property Sets Exposed"
<http://msdn.microsoft.com/library/en-us/dnolegen/html/msdn_propset.as
p>
 
Back
Top