Need help opening a Command Window in VB6 on Win2K

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • RJ Web

    Need help opening a Command Window in VB6 on Win2K

    I have a DOS program that needs to run in a Full Screen DOS window
    when running on WIN2000. I have not discoverd how to set up the call
    such that WIN2000 switches to full screen mode, as if I pressed
    ALT+Enter.


    The program I'm trying to run will not execute properly unless I
    switch to full screen.


    Thanks in advance for working suggestions :)



    Here's the code I'm using now:


    Private Sub Command1_Click( )
    Dim AppToLaunch As String
    Call ExecuteAndWait( "C:\EMP10\emp10 .exe", "C:\EMP10\" )
    End Sub



    Public Sub ExecuteAndWait( cmdline$, SDir$)
    Dim NameOfProc As PROCESS_INFORMA TION
    Dim NameStart As STARTUPINFO
    Dim X As Long


    NameStart.cb = Len(NameStart)
    NameStart.wShow Window = 3
    X = CreateProcessA( 0&, cmdline$, 0&, 0&, 0&,
    NORMAL_PRIORITY _CLASS, 0&, SDir$, NameStart, NameOfProc)
    X = WaitForSingleOb ject(NameOfProc .hProcess, INFINITE)
    X = CloseHandle(Nam eOfProc.hProces s)
    End Sub


    -----
    Type STARTUPINFO
    cb As Long
    lpReserved As String
    lpDesktop As String
    lpTitle As String
    dwX As Long
    dwY As Long
    dwXSize As Long
    dwYSize As Long
    dwXCountChars As Long
    dwYCountChars As Long
    dwFillAttribute As Long
    dwFlags As Long
    wShowWindow As Integer
    cbReserved2 As Integer
    lpReserved2 As Long
    hStdInput As Long
    hStdOutput As Long
    hStdError As Long
    End Type


    Type PROCESS_INFORMA TION
    hProcess As Long
    hThread As Long
    dwProcessID As Long
    dwThreadID As Long
    End Type


    Global Const NORMAL_PRIORITY _CLASS = &H20&
    Global Const INFINITE = -1&
    Declare Function CloseHandle Lib "kernel32" (hObject As Long) As
    Boolean
    Declare Function WaitForSingleOb ject Lib "kernel32" (ByVal hHandle As
    Long, ByVal dwMilliseconds As Long) As Long
    Declare Function CreateProcessA Lib "kernel32" (ByVal
    lpApplicationNa me As Long, ByVal lpCommandLine As String, ByVal
    lpProcessAttrib utes As Long, ByVal lpThreadAttribu tes As Long, ByVal
    bInheritHandles As Long, ByVal dwCreationFlags As Long, ByVal
    lpEnvironment As Long, ByVal lpCurrentDirect ory As String,
    lpStartupInfo As STARTUPINFO, lpProcessInform ation As
    PROCESS_INFORMA TION) As Long
  • Fergus Cooney

    #2
    Re: Need help opening a Command Window in VB6 on Win2K

    Hi RJ,

    Workaround:
    Create a shortcut to your application and set the properties so that it
    runs in full-screen mode. Then, in your program, launch the shortcut rather
    than the exe.

    Regards,
    Fergus


    Comment

    Working...