Re: system tray help -- IT WORKS!
- From: "Robert S. Liles" <rliles@xxxxxxxxxxxxxxx>
- Date: Sat, 18 Jun 2005 15:19:58 GMT
This code will take a program minimized into the system tray and restore it
to the screen with the focus instead of opening a new window.
Bobbo
__________________________________________
Public Class Form1
Inherits System.Windows.Forms.Form
Declare Auto Function FindWindow Lib "user32.dll" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As IntPtr
Declare Auto Function ShowWindow Lib "user32.dll" _
(ByVal hWnd As IntPtr, ByVal nCmdShow As Integer) As Boolean
#Region " Windows Form Designer generated code "
#End Region
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Const SW_RESTORE As Integer = 9
Dim SearchText As String = Me.Text
If UBound(System.Diagnostics.Process.GetProcessesByName( _
System.Diagnostics.Process.GetCurrentProcess.ProcessName)) > 0 Then
Me.Text = Me.Text & "X"
Dim Handle As IntPtr = FindWindow(Nothing, SearchText)
ShowWindow(Handle, SW_RESTORE)
End
End If
End Sub
End Class
.
- References:
- system tray help
- From: shivaranjani . s . adimulam
- Re: system tray help
- From: Ken Tucker [MVP]
- system tray help
- Prev by Date: Re: System tray help -- IT WORKS!
- Next by Date: Re: restore application from systray -- IT WORKS!
- Previous by thread: Re: system tray help
- Next by thread: Re: Process.Exit event not being raised
- Index(es):
Relevant Pages
|