Solved

COM *ps.dll

Posted on 2003-12-03
4
259 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
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 learn how to clear a vector as well as how to detect empty vectors in C++.

829 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