Solved

2 programs communication

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

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Move constructor only called if marked noexcept? 6 123
I could not build boost code, 10 116
Need some help with mailto 16 43
c++  placing data into a form and an editbox 5 48
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
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 be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

738 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