Solved

How do I convert from "const CLSID& pPropPageCLSID" to  "CLSID *pPropPageCLSID"?

Posted on 2006-10-26
8
282 Views
Last Modified: 2008-02-01
I'm using Win32 lib only in VS 2005.  Thanks.
0
Comment
Question by:lapucca
  • 3
  • 3
  • 2
8 Comments
 
LVL 12

Expert Comment

by:rajeev_devin
ID: 17817029
CLSID& rPropPageCLSID = // asign some CLSID object;

CLSID *pPropPageCLSID = &rPropPageCLSID;
0
 
LVL 86

Expert Comment

by:jkr
ID: 17817030
Hard to tell that is the problem with that little of information, but

void DoIt(const CLSID& pPropPageCLSID) {

CLSID *pPropPageCLSID = const_cast<CLSID*>(&pPropPageCLSID);
}

should work.
0
 
LVL 12

Expert Comment

by:rajeev_devin
ID: 17817037
Don't give reference a 'p' prefix, as you have given, rather give 'r' prefix.
const CLSID& rPropPageCLSID;
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:lapucca
ID: 17817050
Sorry for not putting more information.

I am working on removing registration from code below:
In this code I need to call       
"RemovePropertyPageFromDisplaySpecifier(
    szClass, // ldapDisplayName of class.
    clsid // CLSID of property page COM object. )"
but this method's 2nd param is expecting "CLSID *pPropPageCLSID"



LONG UnregisterServer(const CLSID& clsid)       //   IDs
{
    // Get CLSID
    LPOLESTR wszCLSID = NULL,  szClass = NULL;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

      if (0 == wcscmp(wszCLSID,L"{2514CF64-0748-4b02-B188-F6588DAFD237}"))
            szClass = L"group";
      else if(0 == wcscmp(wszCLSID,L"{346488B3-6864-4864-9334-EBF5EA12528B}"))
            szClass = L"user";
      else if(0 == wcscmp(wszCLSID,L"{9E39D6BF-FBDD-4731-BFFE-741A57DDBA32}"))
            szClass = L"computer";

      RemovePropertyPageFromDisplaySpecifier(
    szClass, // ldapDisplayName of class.
    clsid // CLSID of property page COM object. )
 
0
 
LVL 86

Accepted Solution

by:
jkr earned 500 total points
ID: 17817061
Shouldn't that be

    RemovePropertyPageFromDisplaySpecifier(
    szClass, // ldapDisplayName of class.
    const_cast<CLSID*>(&clsid)); // CLSID of property page COM object. )

then?
0
 

Author Comment

by:lapucca
ID: 17817062
Here is the declaration:

HRESULT RemovePropertyPageFromDisplaySpecifier(
    LPOLESTR szClassName, // ldapDisplayName of class.
    CLSID *pPropPageCLSID // CLSID of property page COM object.
    );


I modified the code to below but I'm getting the same error:
Error      1      error C2440: 'initializing' : cannot convert from 'const CLSID *' to 'CLSID *'      c:\Projects\UnityExtProperty\registry.Cpp      623

Thank you.


LONG UnregisterServer(const CLSID& clsid)       //   IDs
{
    // Get CLSID
    LPOLESTR wszCLSID = NULL,  szClass = NULL;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

      if (0 == wcscmp(wszCLSID,L"{2514CF64-0748-4b02-B188-F6588DAFD237}"))
            szClass = L"group";
      else if(0 == wcscmp(wszCLSID,L"{346488B3-6864-4864-9334-EBF5EA12528B}"))
            szClass = L"user";
      else if(0 == wcscmp(wszCLSID,L"{9E39D6BF-FBDD-4731-BFFE-741A57DDBA32}"))
            szClass = L"computer";

      CLSID *pPropPageCLSID = &clsid;

      RemovePropertyPageFromDisplaySpecifier(
    szClass, // ldapDisplayName of class.
    pPropPageCLSID // CLSID of property page COM object.
    );
0
 
LVL 86

Expert Comment

by:jkr
ID: 17817064
Yup, then try the above.
0
 

Author Comment

by:lapucca
ID: 17817076
Thanks jkr,
I modifed as follow and it seems to take care of the compiling error for me.
LONG UnregisterServer(const CLSID& clsid)       //   IDs
{
    // Get CLSID
    LPOLESTR wszCLSID = NULL,  szClass = NULL;
    HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;

      if (0 == wcscmp(wszCLSID,L"{2514CF64-0748-4b02-B188-F6588DAFD237}"))
            szClass = L"group";
      else if(0 == wcscmp(wszCLSID,L"{346488B3-6864-4864-9334-EBF5EA12528B}"))
            szClass = L"user";
      else if(0 == wcscmp(wszCLSID,L"{9E39D6BF-FBDD-4731-BFFE-741A57DDBA32}"))
            szClass = L"computer";

      //CLSID *pPropPageCLSID = &clsid;
      CLSID *pPropPageCLSID = const_cast<CLSID*>(&clsid);
      RemovePropertyPageFromDisplaySpecifier(
    szClass, // ldapDisplayName of class.
    pPropPageCLSID // CLSID of property page COM object.
    );

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

680 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question