Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 264
  • Last Modified:

COM

hi,
I have 2 application say a and b. When i start the application a, that moment i want to invoke the application b via COM. Is any body can help me this?
please send me your suggestions with example.

Thanks in advance
abhi
0
Abhilashars
Asked:
Abhilashars
2 Solutions
 
rsanwatsarkarCommented:
Its very simple, create instance of b in constructor of main class(coclass) of a.
An example, in ATL project
CMyClient::CMyClient()
{
     CComPtr<IMyServer> pIMyServer;
     pIMyServer.CoCreateInstance(CLSID_MyServer);
}
To understand above code, you need to learn at least basics of COM (and bit of ATL for above code).

Go to the following link to find loads of ways, info/tutorial of achieving it.
http://www.codeproject.com/com/

Also take a look at
http://www.codeguru.com/activex/COMStepByStep.html
http://www.codeguru.com/activex/ComTutorial.shtml

This should be enough to give you a good headstart
 
Good luck,
rsan
0
 
ambienceCommented:
what you are trying to do is termed as automation. Your application b has to be an EXE COM automable server.

Are you going to write both applications or that you already have b (for e.g. b can be MSWORD) ?

www.cetus-links.org

has tons of links related to COM and automation etc.
0

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now