CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 12 of 12
  1. #1
    Join Date
    Apr 2011
    Posts
    18

    Exclamation Not yet resolve, clsid

    Can I use a clsid in HKEY_CLASSES_ROOT\clsid ?
    is it the clsid for COM ?
    How can I use it ?

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Not yet resolve, clsid

    Victor Nijegorodov

  3. #3
    Join Date
    Apr 2011
    Posts
    18

    Re: Not yet resolve, clsid

    Thank you Victor,
    But when I try to do use it along with a iid in statement like

    CocreateInstance(clsid,....,iid_interface,&p);
    it return "class has not been registered". I know this is basic but it is still difficult for me, could you offer more instructions, maybe a summary of actual uses of clsids which are provided by default (those included in MS'COM interfaces: IBrowser, IShelllink etc) and those that are not included. What can the user do to handle the latter in general.
    People mention I have to queery the interface QueryInterface (method by IUnknown, clsid provided) or CreateInstance (Ifactoryclass, clsid not provided). I am thining i am in the middle of a cycle with no way out.
    Last edited by HarryCummings; May 20th, 2011 at 06:51 AM.

  4. #4
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Not yet resolve, clsid

    Then register it!
    Victor Nijegorodov

  5. #5
    Join Date
    Apr 2011
    Posts
    18

    Re: Not yet resolve, clsid

    I am thinking those have been registered and I just would like to enumerate them. Well am I wrong ?

  6. #6
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: Not yet resolve, clsid

    This is a short explanation for the most important Registry keys for COM http://mariusbancila.ro/blog/2010/06...-and-registry/. Also this is a good COM tutorial for beginners http://www.codeproject.com/KB/COM/comintro.aspx.

    Now, can you explain what you're actually trying to do? Create a COM object? Enumerating some registry keys? It's not very clear.
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

  7. #7
    Join Date
    Apr 2011
    Posts
    18

    Arrow Re: Not yet resolve, clsid

    Thank you for your replies.

    My question is mainly about the CLSID

    For example, in the link you provide
    Code:
    hr = CoCreateInstance ( CLSID_ActiveDesktop,
                                NULL,
                                CLSCTX_INPROC_SERVER,
                                IID_IActiveDesktop,
                                (void**) &pIAD );
    or this
    Code:
     
    hr = CoCreateInstance ( CLSID_ShellLink,         // CLSID of coclass
                            NULL,                    // not used - aggregation
                            CLSCTX_INPROC_SERVER,    // type of server
                            IID_IShellLink,          // IID of interface
                            (void**) &pISL );        // Pointer to our interface pointer
    You see the CLSIDs of coclass, they are both predefined in the given COM interfaces' header files, in particular in this case it is IShellLink and IActiveDesktop

    Now there are interfaces in the library that do not have such CLSID_XXXXX. So I can't use CoCreateInstance. Someone advised me to use QuerryInterface or CreateInstance. The former method is inherited from IUnknown and yes I am unknown of how it is used as if I put it like

    IUnknown*p;
    p->QueryInterface(iid, *somepointerToTheInterface_I_want)
    Then this reports an error because IUnknown is abstract.

    In case of the latter, CreateInstance is a method from IFactoryClass but inorder to use this interface right in the first place I need a pointer to it to get activated, or an instance of that interface must be invoked, but again I need to create a CLSID of IFactoryClass that is NOT included in any header files

  8. #8
    Join Date
    Jul 2010
    Posts
    94

    Re: Not yet resolve, clsid

    But you have to tell people what you are doing so they can advise. Sometimes you need to create a pointer to some interface that has the Clisd for you to use CoCreateInstance and this class again has a method call to create your wanted interface's instance.

  9. #9
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,620

    Re: Not yet resolve, clsid

    Quote Originally Posted by HarryCummings View Post
    You see the CLSIDs of coclass, they are both predefined in the given COM interfaces' header files, in particular in this case it is IShellLink and IActiveDesktop
    Predefined never means it was defined miraculously and you never can know how it was done. It's just a GUID structure you could initialize yourself with proper CLSID data. The same to IID.

    Now there are interfaces in the library that do not have such CLSID_XXXXX. So I can't use CoCreateInstance.
    Yes, you can. And your question should be how to make that CLSID definition.

    Someone advised me to use QuerryInterface or CreateInstance.
    QueryInterface can not be used instead of CoCreateInstance. Period. Start learning COM basics by trusted authors. Dale Rogerson for example.
    Best regards,
    Igor

  10. #10
    Join Date
    Apr 2011
    Posts
    18

    Re: Not yet resolve, clsid

    Quote Originally Posted by Igor Vartanov View Post
    Predefined never means it was defined miraculously and you never can know how it was done. It's just a GUID structure you could initialize yourself with proper CLSID data. The same to IID.

    Yes, you can. And your question should be how to make that CLSID definition.
    Thank you,
    What do you mean by Yes I can ?
    My questions are not how to make CLSID or IID. My previous post was to explain to cilu about what I would like to know.

    You sound like an expert of COM. Would you please offer a summary within 15 lines of the COM basics I would need to learn, especially in ralation to my current problem ? I will invest some time searching for keywords as well as hints you introduce me then.
    I live in a third world country, Enlgish books are so expensive to me.

  11. #11
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: Not yet resolve, clsid

    I would recommend reading carefully that COM tutorial that I pointed. Among others it explains what CLSID (a GUID for a coclass) and IID (a GUID for an interface) are. It also explains what QueryInterface and CoCreateInstance do.
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

  12. #12
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,620

    Re: Not yet resolve, clsid

    Quote Originally Posted by HarryCummings View Post
    Thank you,
    What do you mean by Yes I can ?
    Literally, you said you can not (because of whatever you thought), and I said yes you can even without headers. Very simple statement.

    My questions are not how to make CLSID or IID.
    I said not "to make", I said "initialize CLSID sruct" like the headers do, to be used in CoCreateInstance. I understood the lack of headers is your problem, so you always can make the headers yourself.

    My previous post was to explain to cilu about what I would like to know.
    Sorry, but I cannot see any question in the post. Now you have to change something in your approach of asking and find a way to ask your questions in less vague manner if you want to yield something from this discussion.

    You sound like an expert of COM. Would you please offer a summary within 15 lines of the COM basics I would need to learn, especially in ralation to my current problem ? I will invest some time searching for keywords as well as hints you introduce me then.
    I live in a third world country, Enlgish books are so expensive to me.
    Well, I live in Russia which isn't first world country either, but in my time I've managed to find Rogerson's book Russian edition. And I would not dare to try to squeeze COM basics into 15 line summary even with the fact I really have some experience in COM. Actually, the book is the shortest COM basics explanation I ever met. And it certainly has more than 15 lines.
    Last edited by Igor Vartanov; May 20th, 2011 at 05:25 PM.
    Best regards,
    Igor

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured