Solved

COM *ps.dll

Posted on 2003-12-03
4
261 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
[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
  • 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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

Suggested Solutions

Title # Comments Views Activity
Getting IP address 8 104
Find Visual Studio Tools 2 126
How to convert MFC APP to Win32 APP. 19 112
learn programming 8 73
In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
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…
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 viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

696 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