|
-
Dec 18th, 2002, 03:50 AM
#1
Thread Starter
Addicted Member
How to make System Modal form
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?
-
Dec 18th, 2002, 04:48 AM
#2
Frenzied Member
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
oh1mie/Vic

-
Dec 19th, 2002, 07:30 PM
#3
Thread Starter
Addicted Member
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.
-
Dec 19th, 2002, 07:39 PM
#4
Fanatic Member
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|