I have an exe (A), shell out another exe (B)
What I want to do is keep A on the screen, but cannot get focus (like in modal form)
and focus to B until B is unloaded
Any Idea?
Printable View
I have an exe (A), shell out another exe (B)
What I want to do is keep A on the screen, but cannot get focus (like in modal form)
and focus to B until B is unloaded
Any Idea?
Here we going...
VB Code:
Option Explicit Public Const PROCESS_QUERY_INFORMATION = &H400 Public Const STATUS_PENDING = &H103& Public Declare Function OpenProcess Lib "kernel32" _ (ByVal dwDesiredAccess As Long, _ ByVal bInheritHandle As Long, _ ByVal dwProcessId As Long) As Long Public Declare Function GetExitCodeProcess Lib "kernel32" _ (ByVal hProcess As Long, lpExitCode As Long) As Long Public Declare Function CloseHandle Lib "kernel32" _ (ByVal hFile As Long) As Long Public Sub subShellAndWait(cmdline As String, Optional Param As Variant = 1) Dim hProcess As Long Dim ProcessId As Long Dim exitCode As Long ProcessId = Shell(cmdline, Param) hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, False, ProcessId) Do Call GetExitCodeProcess(hProcess, exitCode) DoEvents Loop While exitCode = STATUS_PENDING Call CloseHandle(hProcess) MsgBox "The shelled process " & cmdline & " has ended." End Sub
That is the code I am using now.
But that will not make the original form modal, user can still click it and get the focus.
I tried to have Me.Enabled in the original form, it works fine (it will not response to any click or keyboard event),
except it got the focus.
Is what you asking actually possible? because they are two complete seperate programs, so windows will treat them like two seperate programs.
As far as i can see, it just isnt possible
Though I could be wrong