Solved

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

Posted on 2010-09-20
3
256 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
Comment Utility
"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
Comment Utility
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
Comment Utility
it is as easy as:

IWin32Window hwnd = yourform.Handle;
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

763 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now