Solved

Getting CLSID for server COM in VC++

Posted on 2003-10-27
4
707 Views
Last Modified: 2012-05-04
I am using a dll SocketX.dll in my applciation.
I am using as follows:
hresult=CLSIDFromProgID(OLESTR("SocketXObjLib.ISocketXObj"), &clsid);    //retrieve CLSID of component
   if (hresult==S_OK)
    return TRUE;
 ISocketXObj  *t;
 hresult=CoCreateInstance(clsid,NULL,CLSCTX_ALL,__uuidof(ISocketXObj),(LPVOID *) &t);
if(FAILED(hresult))
 return FALSE;
I am not gettin  the CLSID of this .I am getting null values
I have some uuid defined in the SocketX.tlh file.
The namespace given is SocketXObjLib and I have  some interfaces derived from IDispatch which is defined in the SocketX.tlh file.
is there any help with the statement  __uuidof(ISocketXObj) ???
how can I use my dll and its methods in my application.
Can anyone suggest me some help
0
Comment
Question by:geethaes
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 9

Accepted Solution

by:
_ys_ earned 25 total points
ID: 9625891
>> CLSIDFromProgID(OLESTR("SocketXObjLib.ISocketXObj"), &clsid);
Not quite what you're looking for. This will nearly always fail.
The ProgId is typcially structered as "{library_name}.{component_name}". For you  example this will probably be "SocketXObjLib.CSocketXObj".


Saying that you can get around all of this, but reusing the generated files directly.

If you add
#import "SocketX.dll" named_guids no_namespace
to your compilation module you should then be able to do

CoCreateInstance (CLSID_CSocketXObj, 0 CLSCTX_SERVER, IID_ISocketXObj, reinterpret_cast<void**>(&t));

directly, without using CLSIDFromProgID or __uuidof.
0
 
LVL 2

Expert Comment

by:carribus
ID: 9626018
to add to the above post from _ys_,

1. Make sure you have called ::CoInitialise(NULL) before you do anything else (remember to call ::CoUninitialise())
2. Are you sure the ProgID you are requesting is valid. Just do a quick search for it in your registry. If its not there, you might need to register the dll (alternatively, if the ProgID is wrong, you will need to find the correct ProgID).

Take care
0
 
LVL 9

Expert Comment

by:tinchos
ID: 10546175
No comment has been added lately, so it's time to clean up this question.
I will leave the following recommendation for this question in the Cleanup topic area:

Accept: _ys_ {http:#9625891}

Please leave any comments here within the next four days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Tinchos
EE Cleanup Volunteer
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone 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

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

717 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