Hi again,
How could i get the window of a process I got the process and i know it has a windows, called mainwindow. now how could i show it the a user if he clicks on a button associated with the name of the mainwindow of the process
thnx
Hi again,
How could i get the window of a process I got the process and i know it has a windows, called mainwindow. now how could i show it the a user if he clicks on a button associated with the name of the mainwindow of the process
thnx
how to get windows
ThomasAG
pwhitaker
To show the Window to the user, you need to use the SetForegroundWindow API:
To get the handle of a process, simply use the Process class, which lives in the System.Diagnostics namespace, to get the list of processes, then find the one you want and get the handle to it, then use the SetForegroundWindows API to show the process Window to the user
You could also use the FindWindow API to find the Window by the name of the process (title) if you have not already:
http://www.pinvoke.net/default.aspx/user32/FindWindow.html
http://www.pinvoke.net/default.aspx/user32/SetForegroundWindow.html
hope this helps
Gilles Lafreniere
there are a couple of thread on these forums...try looking at these:
http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=643672&SiteID=1
unfortunately for yourself, that code is in C# but a VB.NET translation would be:
'Me.theSystrayNotifyIcon = new NotifyIcon(Me.components)
Me.theSystrayNotifyIcon.Icon = new Icon(Me.Icon, Me.Icon.Width, Me.Icon.Height)
Me.theSystrayNotifyIcon.Visible = true
'AddHandler theSystrayNotifyIcon.DoubleClick, AddressOf Me.theSystrayNotifyIcon_DoubleClick
'unsure how to handle event declaration in VB.NET...something for you to perhaps look at if the above doesnt work
... Private Sub theSystrayNotifyIcon_DoubleClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles theSystrayNotifyIcon.DoubleClick
if Me.Visible = true then
Me.Hide()
else
Me.Show()
Me.BringToFront()
Me.Activate()
end if
End Sub
try also this
http://msdn.microsoft.com/library/default.asp url=/library/en-us/dncodefun/html/code4fun03282003.asp
http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=330178&SiteID=1
does this help
VoiceOfExperience
thank you for your kind help. i have one more difficult question:
how could i work with the notification icons besides the clock
Neil Enns MSFT
unfortunatelly not... i meant the system's notification icons, other programs, and every else that is shown besides the clock. and i would like to use them as windows does it.
so if i run winamp and it puts its icon into the notification area, i'd like to get that icon and handle its events as windows does.