Open New Project>C# Projects>Class Library
Then add this source code as an existing item. You can remove the automatically added class (class1). Add the required references, in this case they are System.Windows.Forms and System.Drawing and also in this case let it be compiled with Unsafe code (you can set it in the project build properties). Then build the project. Depending on you have chosen to build as debug or realse you will find a dll in the project\bin\release or \debug folder.
Now you have the dll.
Open your VB.NET project and add a refernce and select Browse from .NET tab and point to the dll just created. and choose select, and ok.
Now in your Imports section of your form add:
Imports Win32Utils
This should be the name you will see, or something like that. And then use it.
Alternatively you can add that C# project to the Soloution you are working on and the rest is the same.
If you still have problem let me know to sendyou the compiled dll.
'Heading for the automatic overload'
Marillion, Brave, The Great Escape, 1994
'How will WE stand the FIRE TOMORROW?'
Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979
Yeah. For a window like Internet Explorer, would I use IE6 or something like that or would I use the actual title (in this case it's "VBForums.com - Reply to Topic - Microsoft Internet Explorer")
Thanks again,
Rick
Eat long and prosper!
If someone helps you, find someone you can help.
If you still have time, click on the darn banner up there and help the forum!
For some applications for example Iexplorer each open window is representative of one process so you can simply check for their existence as follows:
VB Code:
Dim pr As Process
For Each pr In Process.GetProcesses
If pr.MainWindowTitle = "somthing" Then
MessageBox.Show("That window exists")
End If
Next
But the problem is when the application has some child windows and you are looking to see if the child window is open or not. By the above example you will get the main window title. So you may use this code:
VB Code:
Dim pr As Process
For Each pr In Process.GetProcesses
If pr.MainWindowTitle = "Somthing" Then
Dim winds As New Win32Util.Win32Window(pr.MainWindowHandle)
Dim child As Win32Util.Win32Window
For Each child In winds.GetThreadWindows(winds.ThreadId)
MessageBox.Show(child.Text)
Next
End If
Next
'Heading for the automatic overload'
Marillion, Brave, The Great Escape, 1994
'How will WE stand the FIRE TOMORROW?'
Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979
Ah I see. Seems like these functions are quite dynamic. Since this is something you created (I think) I must ask the question is there documentation for this somewhere?
Thankyou for your time!
Eat long and prosper!
If someone helps you, find someone you can help.
If you still have time, click on the darn banner up there and help the forum!