473,698 Members | 2,139 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Hosting .NET Control that uses Invoke in ActiveX Container

Hello,

I've written a Windows Forms application in .NET 2.0 and am exposing
it to COM using the checkbox in Project Properties and by adding some
register functions and adding it to the GAC. I'm using the ActiveX
Test Container (tstcon32.exe) and I'm able to add the control to the
container. All this works, well almost... I'm using some Invoke calls
from worker threads that update the GUI. In native .NET this means
that stuff is done on the GUI thread, which is accessed by using a
pointer to the parent window. Of course, in a container we don't have
such a thing. My initial thought was to use the HWnd pointer of the
Container window and I can find this value my looking up
CurrentProcess and all. But how do I couple that value to the Invoke
call ? Maybe this is not the recommended way...

Any thoughts ?

Regards,

Janiek
Jun 2 '06 #1
1 3082
Hi guys,

Found the mistake. I attached event handlers to the worker threads in
my GUI constructor. In a .NET application this went well, however in
an ActiveX container this went wrong. I simply moved the event handler
attachments to the control's Load() event. This seems to work.

Greets,

JB

On Fri, 02 Jun 2006 11:32:22 +0200, Janiek Buysrogge
<J.*********@Te levic.com> wrote:
Hello,

I've written a Windows Forms application in .NET 2.0 and am exposing
it to COM using the checkbox in Project Properties and by adding some
register functions and adding it to the GAC. I'm using the ActiveX
Test Container (tstcon32.exe) and I'm able to add the control to the
container. All this works, well almost... I'm using some Invoke calls
from worker threads that update the GUI. In native .NET this means
that stuff is done on the GUI thread, which is accessed by using a
pointer to the parent window. Of course, in a container we don't have
such a thing. My initial thought was to use the HWnd pointer of the
Container window and I can find this value my looking up
CurrentProce ss and all. But how do I couple that value to the Invoke
call ? Maybe this is not the recommended way...

Any thoughts ?

Regards,

Janiek


Jun 12 '06 #2

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

Similar topics

0
3577
by: Gary | last post by:
sorry for not cross-posting originally (originally posted in the components subgroup) I seem to have run into two documented bugs whose workarounds are incompatible. What I have is an OCX written in VB 6 that has a few classes in it. Many of the methods of the OCX are used by ASP, and so far have worked fine. I recently added a COM object reference to the DLL which consists of an SMTP client dll that is wrapped up in dual interface...
2
9729
by: Sunny | last post by:
Hi all, My dev platform: VS .net 2003, win2000pro, office 2000, MOD 2000, C#. Bellow you may read my posting in other group. According that issue, I have dig around and I'm wondering ... My code for creating the ActiveX control in C# is: public class IceOptions : System.Windows.Forms.UserControl,
3
2321
by: fumihiko | last post by:
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...
0
1075
by: 詹亚军 | last post by:
can activex control export large data to container by event's para ? I develop a activex control,and want to export large data to container(IE),web page can use javascript to capture the event,and then utilize the event's para to do more things. First ,I am not sure how much data can be exported by control event's para ? Second,I don't want to export large data by so many paras,such as largedataevent(para1,para2,para3,...... )
1
1181
by: Vinay Chopra | last post by:
Hi, I have created an ActiveX control using MFC activeX control wizard and added a dialog to it. Now on that Dialog I dragged a Button control and gave a "hello world" message on it click. When I run the control in an activex container it works fine. Now I want to a Datagrid in place of this button. I have inserted datagrid and build it I dont get any error. but when I try to open it in ActiveX container to see the display. Im getting...
1
2050
by: None | last post by:
Hello In order to host and use an ActiveX control (non-GUI) in a WTL app, I followed the following steps: 1. During project creation, the ActiveX Hosting option is enabled. 2. In the dialog editor, the ActiveX control was inserted. 3. An event was added to the dialog by right clicking on the control and selecting 'Events...'. 4. VS automatically created a .tlh file.
0
1073
by: Dave Taylor | last post by:
I have an ActiveX control on a Windows form that provides OPC client functionality. The control has no visible elements. I would like to write a class which uses the control to pass data to an OPC server based on a timer...say every 5 seconds write data to the server. I know normally, I'd use the Invoke member to access control properties from a separate thread. However, if no other thread is accessing the control and there are no...
7
2192
by: Khaled Hussein | last post by:
Hi Every body, I am currently working in aproject where I am stuck in merging an ActiveX control (*.ocx) file into a managed Class Library (*.dll). I want to hide the ActiveX Control in this managed Dll, so that even when things are deployed I don't wanna see two files, but only 1 file which is the dll, and it would contain within it, the other ocx file. Is this possible? If yes, then how can I do something like this, I tried to use...
10
2421
by: Benton | last post by:
Hi there, I have a UserControl with a couple of textboxes and a couple of buttons ("Save" and "Cancel"). The Click event for this buttons is in the UserControl's codebehind of course, so here's my question. Once the UserControl is dropped onto the container page, how can I perform some action on the codebehind of the container page from the codebehind of the UserControl? For instance, suppose that the UserControl is dropped inside one...
0
9016
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8856
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7709
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6515
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5858
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4360
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3037
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2321
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1997
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.