Solved

2 programs communication

Posted on 2006-10-30
3
367 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
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.

617 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