Re: system tray help -- IT WORKS!

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



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



.



Relevant Pages

  • Re: isnumeric compile error...
    ... Private Sub Text47_AfterUpdate ... I agree that an unbound textbox with value of 1.1.1 will run IsNumeric ... Is isn't a number, it's a string" ... everything from the debug/immediate window. ...
    (comp.databases.ms-access)
  • Re: getting the dimensions/location of a workbook
    ... (ByVal lpClassName As String, ByVal lpWindowName As String) ... Private Declare Function GetClientRect Lib "user32" (ByVal hwnd As Long, ... Here's how I find the handle of the current workbook window: ... IntPtr hWndExcel = new IntPtr; ...
    (microsoft.public.excel.programming)
  • RE: Open a form with a filter based on dependent data
    ... and I am prompted in a window called "Enter parameter ... data_entry's primary key is known as "ID", and has a bunch of other fields. ... Private Sub Command200_Click'This is the relations button ... Dim holdval As String ...
    (microsoft.public.access.forms)
  • ComboBox class, CB_INSERTSTRING , VB.NET and marshalling... [WORKING VERSION]
    ... send the message WM_SETTEXT with the string You wanted. ... Below You find the declaration of SendMessage and the line of code that send ... IntPtr, ByVal wMsg As IntPtr, ByVal wParam As IntPtr, ... 'Code (argl_hChildWnd is the handle of the Edit window into the combo) ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Auto Advance Textbox.text as if using a scrollbar
    ... But once the texbox window fills, the user has to scroll to the see new ... Private Sub AddText(Text2Add As String, Optional AddCR As Boolean = True) ...
    (microsoft.public.vb.general.discussion)