Solved

COM *ps.dll

Posted on 2003-12-03
4
249 Views
Last Modified: 2010-04-01
Hi,
I have a com service built on VC++ 7.1, I have my service exe and ps.dll, as I know for a client machine to communicate with a service it needs only to register ps.dll, then it has to call CoCreateInstanceEx with coserverinfo server name set to "MyServerName".
Then I read in MSDN that it could be done with CoCreateInstance (without -Ex), I have to set context to CLSCTX_REMOTE_SERVER and there should be RemoteServerName value somewhere in registry.

So do I understand it right? And where should be RemoteServerName value in registry??
0
Comment
Question by:GiedriusS
  • 2
4 Comments
 
LVL 9

Accepted Solution

by:
_ys_ earned 100 total points
ID: 9906940
It is indeed possible with CoCreateInstance.

The structure of the registry would be this:
The HKCR\CLSID\{xxxx} key would have an 'AppId' string value and it's data would be another guid (1) - typically this is the same as the CLSID.

The HKCR\AppId key would have a sub-key (1), and it would have a 'RemoteServerName' string value, the data specifiying the remote server name.

And yes, it is better to explicitly state CLSCTX_REMOTE_SERVER.

[HKCR refers to the HKEY_CLASSES_ROOT hive]
0
 
LVL 9

Expert Comment

by:_ys_
ID: 9906962
Should have mentioned.

Using CoCreateInstanceEx with coserverinfo server name set to "MyServerName" allows you to bypass the RemoteServerName stored within the registry. RemoteServerName can be viewed as a 'default'.
0
 
LVL 5

Expert Comment

by:migoEX
ID: 10364866
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Accept _ys_'s comment as answer.

Please leave any comments here within the next four days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

migoEX
EE Cleanup Volunteer
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
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 concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
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…

785 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