[Gtk-sharp-list] Win32 Window Handle

Phillip Dyer p85dyer at gmail.com
Fri May 18 12:36:26 EDT 2007


All,

    Is there any easy way to get the window handle of a GTK window for 
use with win32 functions? My Current Implementation is:

            try
            {
                Process ThisProcess = Process.GetCurrentProcess();
                MainWinHandle = ThisProcess.MainWindowHandle;         
//Works under XP, Throws Exception in Vista
            }
            catch
            {
                MainWinHandle = MainWindow.Handle;                     
       //Fails
            }

    This implementation works fine under XP, but throws a security 
exception when run under Vista.

Thanks,

Phil Dyer


More information about the Gtk-sharp-list mailing list