Solved

2 programs communication

Posted on 2006-10-30
3
352 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:DeepuAbrahamK
Comment Utility
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
Comment Utility
>>>> 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
Comment Utility
that worked fine.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
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.

763 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now