matthew kelly wrote:
Public Function HandleOfCurrentWindow()
Dim WindowHandle As Integer
Dim p As Process
p = Process.GetCurrentProcess
WindowHandle = Process.GetCurrentProcess.Handle.ToInt32
'get handle of current window
'return handle
Return WindowHandle
End Function
Well, first of all, your not getting the Window handle of the CurrentProcess. Your actually returning the handle to the Process itself, not it's Window. You have to use the MainWindowHandle propery of the process:
Dim WindowHandle as IntPtr
p = Process.GetCurrentProcess
WindowHandle = Process.GetCurrentProcess.MainWindowHandle()
Now, after you get that, you can't use it in .NET to get the parameters of the window you want. .NET doesn't expose such functionality. But! You can use that window handle to get the parameters using the Win32 API. But! Some of the values you get back will probably surprise you! Send me an email address to send you the sample I wrote. It's a little too big to post here! All you have to do is click on other windows, like the VS IDE to see some interesting Normal Position values. Try it with an IE window too. RageInTheMachine9532