PC Review


Reply
Thread Tools Rate Thread

How to create a managed container control capable of hosting controls using only their handles?

 
 
ObsesivelyCurious
Guest
Posts: n/a
 
      30th Dec 2006
I have a question for all you smart people out there. I need to create
a managed windows forms control that can contain controls knowing only
their handles. In fact, all it really needs to do is host a single
control in such a way that from the user's perspective it looks as if
only one control existed. I need to accomplish this by using only the
handle of the hosted control. I figured something like this could be
achieved by overriding WndProc of the container control and forwarding
(most of the) messages to the hosted control. Of course, just blindly
forwarding all messages won't work, but just exactly which messages do
I need to forward? And is this even the right thing to think about?

I know it may seem like a convoluted way of doing things, but there is
a good reason. I could explain it at length, but here's just a brief
description. Basically, I need to have the container control in one
app domain and the hosted control in another app domain. Simply
getting a reference to the hosted control and trying to add it to the
container control breaks, because of the internal design of windows
forms, which doesn't work across app domains. However, I know for a
fact that my hosted control can successfully be contained in an
unmanaged control (here, an IE sidebar), which must happen via the old
fashioned Win32 messages. So I simply figured I could mimic this
behavior.

I would appreciate if anyone could share their insight.

Thanks,

Andrew

 
Reply With Quote
 
 
 
 
Mattias Sjögren
Guest
Posts: n/a
 
      30th Dec 2006
>Of course, just blindly
>forwarding all messages won't work, but just exactly which messages do
>I need to forward? And is this even the right thing to think about?


You can use the SetParent Win32 API to move a control to a certain
parent. How that affects maanged controls, especially ones created in
different appdomains, I don't know.


Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hosting .NET Control that uses Invoke in ActiveX Container Janiek Buysrogge Microsoft C# .NET 1 12th Jun 2006 01:53 PM
Error in IE hosting managed control Sb Microsoft Dot NET 0 16th May 2005 07:46 PM
Error in IE hosting managed control Sb Microsoft Dot NET Framework 0 16th May 2005 07:46 PM
About Hosting Windows Form control in VB 6 or old ActiveX container Jeth Microsoft Dot NET Framework Forms 1 3rd Jun 2004 04:41 PM
Make Container UserControl force controls to be added to a child container control Codemonkey Microsoft Dot NET Framework Forms 2 21st Nov 2003 08:22 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:31 AM.