473,474 Members | 1,546 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Obtaining hWnd from a form - how ?

I need to pass the handle of my window (WinForm in C#) to a C library.
The WinForm does not apear to expose this property - how may I access it ?

MTIA

Dec 14 '05 #1
2 4118

"Susan Baker" <sb****@no.spam.net> wrote in message
news:dn**********@nwrdmz02.dmz.ncs.ea.ibs-infra.bt.com...
I need to pass the handle of my window (WinForm in C#) to a C library. The
WinForm does not apear to expose this property - how may I access it ?

MTIA


What about the Handle property?

Willy.
Dec 14 '05 #2
try this:

[DllImport]
static public extern void myCFunction(IntPtr hWnd);
......
myCFunction(myForm.Handle);

-----
Mark
http://www.redbugtech.com/blogs/mark.php

Willy Denoyette [MVP] wrote:
"Susan Baker" <sb****@no.spam.net> wrote in message
news:dn**********@nwrdmz02.dmz.ncs.ea.ibs-infra.bt.com...
I need to pass the handle of my window (WinForm in C#) to a C library. The
WinForm does not apear to expose this property - how may I access it ?

MTIA

What about the Handle property?

Willy.

Dec 14 '05 #3

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

Similar topics

2
by: WayneD | last post by:
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...
1
by: Tamir Khason | last post by:
I need to fetch hWnd IntPtr of the form, which hold user control from inside the user control. How to do this. this.Handle returns wrong results. Another question form the same field: I want to...
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...
0
by: VP | last post by:
Hi there, well i am stuck on a problem with regards to obtaining security permissions on folders. At the moment I have created a simple treeview example which shows all sub-directories in a tree...
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...
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 ...
11
by: =?ISO-8859-15?Q?Kolja_M=E4rtens?= | last post by:
Hello! I've been professionally working on java projects for several years, but have done extremely little C/C++ coding and just a few little things in VB.Net. Right now I'm trying to write a...
8
mshmyob
by: mshmyob | last post by:
Is it possible to get the hwnd property (ie: long number) of a control on a form. For instance I would like to get the hwnd property of a text box that has focus. I can get the form hwnd property...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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,...
1
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...
0
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 ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
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.