Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

2 programs communication

Posted on 2006-10-30
3
Medium Priority
?
375 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
3 Comments
 
LVL 11

Expert Comment

by:Deepu Abraham
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 800 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

IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
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 user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
Suggested Courses

971 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