[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.interop

How do I find the main window handle?

How do I find the main window handle?

11/26/2007 7:58:00 PM

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

Thanks,
Mike

Nicholas Paldino [.NET/C# MVP]

11/26/2007 8:22:00 PM

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]
- mvp@spam.guard.caspershouse.com

"Mike" <MLM450@hotmail.com> wrote in message
news:a9ae5000-49c8-47a7-9fb9-aecbf4f52261@w28g2000hsf.googlegroups.com...
> In a DLL written in C#, how can you get the handle of the main window
> of the app that called you?
>
> Thanks,
> Mike


11/26/2007 8:46:00 PM

That seems to work. Thanks!

On Nov 26, 3:21 pm, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guard.caspershouse.com> wrote:
> 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]
> - m...@spam.guard.caspershouse.com
>
> "Mike" <MLM...@hotmail.com> wrote in message
>
> news:a9ae5000-49c8-47a7-9fb9-aecbf4f52261@w28g2000hsf.googlegroups.com...
>
>
>
> > 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 -


Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
How do I find the main window handle?

Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te

Il servizio è completamente GRATUITO!