473,508 Members | 2,303 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem on using 2nd activex control created dynamically...

Hi,

I created an activex control (C++), and it uses another COM dll (C++).
This COM dll links with a static library that dose some calculation.
(both are debug multithreaded dll)

I created a C# client having activex control embedded at the very
beginning (added in the design window); then, I created another same
activex control at the runtime. After the 2nd activex control is
created, I start to get errors on the function calls to the static
library in the COM dll.

Can anyone help me solve this problem? Or give me some suggestion?

I have tried to have two activex controls (added in the design window)
and there is no problem accessing the functions in the library in the
another COM dll; also, I have tried to use QueueUserWorkItem to fire an
event back to the main thread and create the 2nd activex control. Both
approachs do not work.

Thanks

Fumihiko

Nov 17 '05 #1
3 2308
Fumihiko,

You mentioned that you are using QueueUserWorkItem to fire an event back
to the main thread, which indicates to me that you are trying to create the
control on another thread. Calling QueueUserWorkItem will not ensure that
the delegate is called on the UI thread.

Rather, you need to make sure that your control is created on the UI
thread. You can do this by calling the Invoke method on the form that the
control will be embedded on. This will cause the delegate passed to it to
be called on the UI thread. This is how you should notify the main thread
to create the control.

If a control is not created on the UI thread, then you will run into
errors like this, especially COM objects.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- ca*******@caspershouse.com

<fu******@gmail.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
Hi,

I created an activex control (C++), and it uses another COM dll (C++).
This COM dll links with a static library that dose some calculation.
(both are debug multithreaded dll)

I created a C# client having activex control embedded at the very
beginning (added in the design window); then, I created another same
activex control at the runtime. After the 2nd activex control is
created, I start to get errors on the function calls to the static
library in the COM dll.

Can anyone help me solve this problem? Or give me some suggestion?

I have tried to have two activex controls (added in the design window)
and there is no problem accessing the functions in the library in the
another COM dll; also, I have tried to use QueueUserWorkItem to fire an
event back to the main thread and create the 2nd activex control. Both
approachs do not work.

Thanks

Fumihiko

Nov 17 '05 #2
Thanks for your help :)

I am still not clear what I should do to avoid this problem.

Do you mean that ... since the first activex control embedded in the C#
design dialog (created in the function InitializeComponent()) is
created in UI thread, I have to create the 2nd control in UI thread,
too !? And by using the Invoke mothod on the form, the UI thread will
create the 2nd control, and later, both controls can access the static
library functions in the same COM instance.

I will try it later tonight, and see if it works.

Thanks,

Fumihiko

Nov 17 '05 #3
Tried last night, but still did not work.
I also try to build both controls in the runtime using the "invoke",
and then discovered that both controls cannot access the dll functions
in the COM object.

I am wondering... what's the differences between a control that built
in design dialog and built in the runtime? How come the control that
built in the design dialog can successfully use the dll function in the
COM object, but the control built in runtime got an error?

Thanks,

Fumihiko

Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
1491
by: George Hester | last post by:
What's this? IE has a simple way using an ActiveX object so that I can load a text file into the <OPTION>s like a database. It is called Tabular Control. But I doubt this is going to work with...
1
3013
by: mjcast | last post by:
I have been working on an ActiveX control in C#. It is packaged in a Windows Control library and the code is in a user control. The control is used as an automation receiver that is used to update a...
3
2258
by: Eric | last post by:
I have built a composite user web control that I want to create dynamically. The form will contain a variable number of these controls and as well some of the contents of the user web control...
2
2909
by: R Duke | last post by:
I have tried everything I can think of to change the visible property of a design time created control from a dynamically created control's command event handler. Here is the scenario. I have...
1
3007
by: Kamal Jeet Singh | last post by:
Hi Friends !! I am have facing problem in controlling the dynamically created controls on web page. The problem Scenario is Scenario:- My requirement is to load the web user controls on the...
0
1056
by: Luis Esteban Valencia | last post by:
-- How do I add an activeX control to a dynamically created table? LUIS ESTEBAN VALENCIA MICROSOFT DCE 3. MIEMBRO ACTIVO DE ALIANZADEV http://spaces.msn.com/members/extremed/
13
3910
by: Lee Newson | last post by:
Hi, I have just written my first application using VB.NET. The app works fine when i am running it within .NET for debugging purposes, however when i try to run the app from the .exe file that...
5
5943
by: fniles | last post by:
We created an ActiveX control and marked it as safe for scripting using Implements IObjectSafety. We then created a CAB file and signed it using Verisign. We also created a license file (LPK file)...
1
2792
by: LintDiggy | last post by:
My vb6 application has a nasty memory leak that I can't trace for the life of me. I have an ActiveX object that I've created called an Operation. The control has the following components : ...
0
7123
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7324
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7382
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7495
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5627
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4707
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3193
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
766
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
418
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.