Visual Basic Development Bookmark and Share   
 Home > Visual Basic General > Get all open windows
 

Get all open windows

Im trying to use a global mouse hook to check and see if the mouse location is in the title bar of any open form. I have the hook, so how would I get therectangle of the NC (Non-Client) area of every open form in windows?
swalker1595  Wednesday, November 25, 2009 9:37 PM

Thank you Acamar for your friendly help.

Hi swalker,

Here is another idea for you toget all open windows.

Dim Proc() As Process = Process.GetProcesses()

For Each p As Process In Proc

If p.MainWindowTitle <> Nothing Then
' Gets the native handle of the associated process
Dim hwnd As IntPtr =p.Handle
End If
Next

Process' members:
http://msdn.microsoft.com/en-us/library/system.diagnostics.process_members.aspx



Best regards,
Martin Xie


Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
Martin Xie - MSFT  20 hours 49 minutes ago
MS has an example for VB6 which you could translate:
http://support.microsoft.com/default.aspx/kb/183009
Acamar  Wednesday, November 25, 2009 10:34 PM

Thank you Acamar for your friendly help.

Hi swalker,

Here is another idea for you toget all open windows.

Dim Proc() As Process = Process.GetProcesses()

For Each p As Process In Proc

If p.MainWindowTitle <> Nothing Then
' Gets the native handle of the associated process
Dim hwnd As IntPtr =p.Handle
End If
Next

Process' members:
http://msdn.microsoft.com/en-us/library/system.diagnostics.process_members.aspx



Best regards,
Martin Xie


Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
Martin Xie - MSFT  20 hours 49 minutes ago

You can use google to search for other answers

Custom Search

More Threads

• bringToFront problem!!!
• Define label?
• Directory Contents into SQL Server
• Help with xml comments
• database searching box
• wild card
• FTP file change
• Apostraphy in a sting field
• Fill DataSets dynamically
• how to suppress the validating event when the form closes