I have the source to all apps, certainly nothing weird with Windows messaging.
Below is the code.
The process is passed into the tag property of a button.
Code:Dim mvk As New Process Dim sTitle As String = "" Dim I As Integer = 0 With mvk .EnableRaisingEvents = True .StartInfo.FileName = "c:\projects\test\app.exe" AddHandler mvk.Exited, AddressOf ProcessExit .Start() End With sTitle = mvk.MainWindowTitle Do Until sTitle <> "" System.Threading.Thread.Sleep(500) mvk.Refresh() sTitle = mvk.MainWindowTitle I += 1 If I = 20 Then sTitle = "Error" LoopI'll be interested in what see what happens.Code:Private SW_SHOWNORMAL As Integer = &H1 <Runtime.InteropServices.DllImport("user32", EntryPoint:="ShowWindow")> _ Private Shared Function ShowWindow(ByVal hwnd As IntPtr, ByVal nCmdShow As Integer) As Integer End Function <Runtime.InteropServices.DllImport("user32", EntryPoint:="SetForegroundWindow")> _ Private Shared Function SetForegroundWindow(ByVal hwnd As IntPtr) As Integer End Function 'The button click event below. Dim myProc As Process = DirectCast(myButton.Tag, Process) myProc.Refresh() ShowWindow(myProc.MainWindowHandle, SW_SHOWNORMAL) SetForegroundWindow(myProc.MainWindowHandle)
Cheers




Reply With Quote