ActiveX objects with com callable wrapper

G

Guest

The general problem is that I have to start an Application, programmed in C#,
out of a c++-programm.
To do this, I have made a com callable wrapper around the assembly and
startet my application. Until here, everything works fine, I am able to start
the new dialog out of the mfc application. But now my problem:
The dialog from the assembly doesn´t start, if I use ActiveX components in
the C#-assembly. Has anyone an idea why this seems not to be possible?

Thanks
Jens
 
W

Wessel Troost

The dialog from the assembly doesn´t start, if I use ActiveX components
in
the C#-assembly. Has anyone an idea why this seems not to be possible?
Some more information would be useful:
- Does an error-message appear?
- Can you break the debugger somewhere in the assembly?
- Does the assembly work OK if you use it from managed code?

Greetings,
Wessel
 
J

Johann Blake

Jens,

Have you simply tried running your C# app without it being started from
C++? If so, does the ActiveX work?

If you still have problems, try commenting out all the code in your C#
app that uses the ActiveX but keep a reference to the control. If your
C# app can load, then you know it has something to do with a property
or method of your control.

Best Regards
Johann Blake
 
G

Guest

Some more information would be useful:
That should not be the problem.
- Does an error-message appear?
No, there is no error Message. When i try to create the dialog, the
execution returns from the method without any comment.
- Can you break the debugger somewhere in the assembly?
When stepping through the assembly, the execution stops at a line like this:
ActiveXComponent myActiveX = new ActiveXCompontent();
- Does the assembly work OK if you use it from managed code?
Yes, the application has been used as normal application for a while. But
now we have to use it as DLL from an mfc program.
Greetings
Jens
 
G

Guest

Have you simply tried running your C# app without it being started from
C++? If so, does the ActiveX work?
Yes, I used the application some time as stand alone and had no problems.
But now I have to call the dialog from an mfc-program.
If you still have problems, try commenting out all the code in your C#
app that uses the ActiveX but keep a reference to the control. If your
C# app can load, then you know it has something to do with a property
or method of your control.
The described problem occurs not only for my activeX components, but for
all. I tried an Acrobat Reader Window in the form, and also the Microsoft
Calender ActiveX. Both resulted in the same error.

Jens
 
D

Dmytro Lapshyn [MVP]

Jens,

If you are using MFC, you might be required to call the
AfxGetStaticModuleState system function (see "TN058: MFC Module State
Implementation" in MFC Library Reference). Also, be sure to call
CoInitialize[Ex] before you attempt to instantiate any COM objects.
 

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