Click here to Skip to main content
15,896,557 members

How to avoid access to COM object re-entrance locking effect.

SuperMiQi asked:

Open original thread
Hello everyone.

I have a com object written in c++ (based on IDispatch interface). I can create an instance happily in vb6 and even in c# (VS2010).

The problem is the following:
I have a console application which handles an instance of my object.
The goal is to launch a vb6 activex.dll with this object passed via a method of this activex.dll which display a form. It works fine but when I quit the function responsible of the activex instantiation, I got a locking effect when I click on a button on the form to access to my object instance assigned to a variable locally.

How could I solve this interlock situation. I was hoping to use xxx.invoke(...) but object or Type do not have this method.

I suppose this is related to managed and un-managed code but does not know actually how to solve that issue.

To create the master COM object I am using :
C#
private bool CreateCOMObject(string ComponentClassName)
{
    bool bRet = false;

    _VB6DocType = System.Type.GetTypeFromProgID(ComponentClassName);
    _VB6Control = System.Activator.CreateInstance(_VB6DocType);

    bRet = true;

    return bRet;
}


Maybe do you have already encontoured such an issue ?
Thank you very much in advance.
Best regards.
Michel
Tags: C#, Visual Basic 6, .NET, COM

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900