Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2006-10-26
8
Medium Priority
?
287 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
Industry Leaders: 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 2000 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
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 how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
Suggested Courses

886 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