Solved

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

Posted on 2006-10-26
8
280 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
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…

948 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

22 Experts available now in Live!

Get 1:1 Help Now