Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

How to find HWIND of Windows from Handle in C#?

Posted on 2010-09-20
3
258 Views
Last Modified: 2013-12-16
Dear Experts

I need to find a HWND for Windows Form (NET Framework 2.0)   from this.Handle. How to do it ? More, I need to get in variable in IWin32Window . I need this because of use third part components and I need to pass it.
To be more clear,  I do not want to use find procedure via title of Windows, I believe there other way.

Thanks.
0
Comment
Question by:dvplayltd
3 Comments
 
LVL 85

Assisted Solution

by:Mike Tomlinson
Mike Tomlinson earned 100 total points
ID: 33720808
"this.Handle" is the HWND but in IntPtr form...

You can simply convert it to an int if that is what you are looking for:

    int HWND = this.Handle.ToInt32();

I suspect there's more to it than this though!

Can you explain in MORE DETAIL please?...
0
 
LVL 35

Accepted Solution

by:
Miguel Oz earned 300 total points
ID: 33721381
If your third part components are .net, then you can pass the the form instance itself.
For example I use the following construct a lot:
  form.ShowDialog(parentForm)
where parentForm is a valid from instance. Form supports IWin32Window interface.
0
 
LVL 55

Assisted Solution

by:Jaime Olivares
Jaime Olivares earned 100 total points
ID: 33722039
it is as easy as:

IWin32Window hwnd = yourform.Handle;
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question