473,406 Members | 2,378 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Possible to attach an HWND to a Form??

Hi All,
I'm writing a class that implements a COM interface. Unfortunately, one of
the methods passes in an HWND and I'm supposed to create a control with that
HWND as the parent. The idea is to plop my control onto the client's dialog.
Is this possible in C#??? There are 2 issues I'm concerned about:

1. What type of thingy should I create as the child control. I'm trying a
UserControl.
2. Is there some way to "attach" the HWND to a Form that I can then use to
set the Parent property of my newly created control?

I tried using Control.FromHandle, but that didn't work...

Thanks for any help!
Wayne
Nov 15 '05 #1
2 2089
1. What type of thingy should I create as the child control. I'm trying a
UserControl.
Anything derived from Control should work.

2. Is there some way to "attach" the HWND to a Form that I can then use to
set the Parent property of my newly created control?


No, I think you'll have to call the SetParent Win32 API.

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/
Please reply only to the newsgroup.
Nov 15 '05 #2
Interesting... I have a similar need to "parent" a dialog box into another
window.
--
Eric Newton
C#/ASP Application Developer
er**@cc.ensoft-software.com [remove the first "CC."]

"Mattias Sjögren" <ma********************@mvps.org> wrote in message
news:ec**************@TK2MSFTNGP11.phx.gbl...
1. What type of thingy should I create as the child control. I'm trying a
UserControl.


Anything derived from Control should work.

2. Is there some way to "attach" the HWND to a Form that I can then use toset the Parent property of my newly created control?


No, I think you'll have to call the SetParent Win32 API.

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/
Please reply only to the newsgroup.

Nov 15 '05 #3

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

Similar topics

10
by: scrimp | last post by:
Ive been using PAMIE 1.4 to try to automate web page processes. The one thing I cannot do with it is upload files and download files. With uploading files, the file input box does not allow PAMIE...
20
by: CHIN | last post by:
Hi all.. here s my problem ( maybe some of you saw me on other groups, but i cant find the solution !! ) I have to upload a file to an external site, so, i made a .vbs file , that logins to...
0
by: dag | last post by:
Hi! I would like to do an overlap window, over my main window (of my application), with a Progress Bar. Exactly when I push a button of my application I want show a window, with a Progress bar,...
1
by: Alison Kakoschke | last post by:
I need to convert an IntPtr (as returned from the Form, get_Handle() method) to an HWND but can't find any information as to how it is done. I've tried everything I can think of and always seem...
3
by: Andrew Moore | last post by:
Hi All, I have a managed C++ class that makes calls into the Win32 API. I specifically am trying to take a Handle from a .NET form and convert it to a HWND to pass to a Win32 functions. The...
8
by: Arno R | last post by:
Hi all, Is the above possible? I guess I need an API call for this ? How and where to find this? One of my new apps is used as a sort of 'dedicated' thing. Users see an empty desktop with...
1
by: MultiMarine | last post by:
Hello I have just started using .NET and C# from a c++ background using win32. Now i want to do something that i used to do, without using the win32 API. I use Spy++ to get a HWND from...
9
by: zhaow | last post by:
Hi, All Greetings! I want to develop as appllication that requires a line-drawing function in the blank area between two forms. I have looked up the MSDN, it says that a graphics object need a...
1
by: thesayan | last post by:
hello, i am attempting to translate some code from vb6 into vb 2005 that draws sprites from graphics designs. i am having trouble on the form trying to draw to back buffer surface. 'vb6 code ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
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
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,...

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.