Solved

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

Posted on 2006-10-26
8
279 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
 

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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

757 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now