-
May 19th, 2011, 04:45 PM
#1
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 ?
-
May 20th, 2011, 06:42 AM
#2
Re: Not yet resolve, clsid
Victor Nijegorodov
-
May 20th, 2011, 06:46 AM
#3
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.
-
May 20th, 2011, 06:54 AM
#4
Re: Not yet resolve, clsid
Victor Nijegorodov
-
May 20th, 2011, 06:58 AM
#5
Re: Not yet resolve, clsid
I am thinking those have been registered and I just would like to enumerate them. Well am I wrong ?
-
May 20th, 2011, 07:24 AM
#6
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.
-
May 20th, 2011, 12:14 PM
#7
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
-
May 20th, 2011, 12:29 PM
#8
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.
-
May 20th, 2011, 12:58 PM
#9
Re: Not yet resolve, clsid
Originally Posted by HarryCummings
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
-
May 20th, 2011, 03:46 PM
#10
Re: Not yet resolve, clsid
Originally Posted by Igor Vartanov
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.
-
May 20th, 2011, 03:50 PM
#11
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.
-
May 20th, 2011, 05:19 PM
#12
Re: Not yet resolve, clsid
Originally Posted by HarryCummings
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|