Solved

2 programs communication

Posted on 2006-10-30
3
360 Views
Last Modified: 2010-05-18
Hi,

I have an exe file. This is a program ,that starts when windows start up. It is running in background and is visible in system tray. I have another program, that I want to connect to the first one.

I added an atl simple object to the project, added an interface and a function and recompiled it. The name of atl object is SessionManager.

I added these two lines in second prorgram:

ISessionManager * pSessionManager;
HRESULT hr = CoCreateInstance(CLSID_SessionManager, NULL, CLSCTX_ALL, IID_ISessionManager, (void**)&pSessionManager);
pSessionManager->Test();
pSessionManager->Release();

When first program is running, second program throws error hr =  -2147467262: E_NOINTERFACE
When first program is not running, second program throws error I get hr =  -2147221164: class not registered.

So I guess that second program can detect the first one, but for some reason it can not use it.

Can you help me?
Thank you.
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
3 Comments
 
LVL 11

Expert Comment

by:DeepuAbrahamK
ID: 17834727
When first program is not running, second program throws error I get hr =  -2147221164: class not registered.
Did you try registering your application?
Go to start->Run and execute these:
RegServer /u "path\your application.exe" // Un regsiter
RegServer "path\your application.exe"       // Register

Best Regards,
DeepuAbrahamK
0
 
LVL 39

Accepted Solution

by:
itsmeandnobodyelse earned 200 total points
ID: 17835488
>>>> Did you try registering your application?

The calls to register an application is

     your_application_full_path /regserver

To unregister you need

     your_application_full_path /unregserver


To register a dll call

   regsvr32 your_dll_full_path

To unregister a dll

   regsvr32 /u your_dll_full_path


Note, by registering you write the interface definition to the registry.

>>>> I have another program, that I want to connect to the first one.

I don't know what kind of communication you need, but normally a piece of shared memory where there are separated regions for both execuatbles to write information is easier to handle than using ATL and COM.

Regards, Alex



   

0
 

Author Comment

by:GiedriusS
ID: 17840315
that worked fine.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
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…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

761 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