How do I find the main window handle?

  • Thread starter Thread starter Mike
  • Start date Start date
M

Mike

In a DLL written in C#, how can you get the handle of the main window
of the app that called you?

Thanks,
Mike
 
Mike,

AFAIK, there is no API that will do this for you.

Rather, the easiest way I can think of is to call the static
GetCurrentProcess method on the Process class and then access the
MainWindowHandle property on the Process instance returned.
 
That seems to work. Thanks!

Mike,

AFAIK, there is no API that will do this for you.

Rather, the easiest way I can think of is to call the static
GetCurrentProcess method on the Process class and then access the
MainWindowHandle property on the Process instance returned.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)




In a DLL written in C#, how can you get the handle of the main window
of the app that called you?
Thanks,
Mike- Hide quoted text -

- Show quoted text -
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top