How to access a method of VC++ 6.0 .exe in .Net

N

Naveeen

Hi,
I have a VC++6.0 .exe file. I want to call a method of that .exe from .Net Application.
Please give the help..
 
B

Bruno van Dooren

Hi,
I have a VC++6.0 .exe file. I want to call a method of that .exe from .Net
Application.
Please give the help..

You have to give more information.

Is it an ActiveX container? If so you have to register it and add a
reference to your .NET project.
If it is a command line app you can launch it and supply arguments. For
example 'system' 'shellexec' or 'createprocessex'
If it is neither of the above, it is not possible to execute code from that
executable.
 
T

Tom Serface

In addition to Bruno's response... you may find it easier to create a
library for the .NET application rather than trying to call functionality
from an older EXE. If you have the source you should be able to copy and
paste the relevant source into your new project and/or create a library in
..NET that can be accessed in a more general way.

Tom

in message news:[email protected]...
 
B

Ben Voigt [C++ MVP]

Bruno van Dooren said:
You have to give more information.

Is it an ActiveX container? If so you have to register it and add a
reference to your .NET project.
If it is a command line app you can launch it and supply arguments. For
example 'system' 'shellexec' or 'createprocessex'
If it is neither of the above, it is not possible to execute code from
that executable.

Not precisely true... you can load your dll into the process memory space,
then start code running in a thread. That thread could then freely call any
function in the .exe -- as long as it can find them, which is a diffuclt
problem in its own right (having a debug database for the exe would make
this part feasible). But this is evidently far beyond the capabilities of
the OP, judging by the incorrect terminology in his question.
 
B

Bruno van Dooren

Not precisely true... you can load your dll into the process memory space,
then start code running in a thread. That thread could then freely call
any function in the .exe -- as long as it can find them, which is a
diffuclt problem in its own right (having a debug database for the exe
would make this part feasible). But this is evidently far beyond the
capabilities of the OP, judging by the incorrect terminology in his
question.

The OP talks about a .NET aplication so he is not creating a DLL.
But I should have said 'for all practical purposes...'

--

Kind regards,
Bruno van Dooren MVP - VC++
http://msmvps.com/blogs/vanDooren
(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top