Results 1 to 10 of 10

Thread: Need Help Launching a Program from VB

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2000
    Posts
    316

    I am trying to launch a game from my VB app, but when I do and get into the game I click anywhere on the screen and it immediately minimizes my full screen game to the taskbar. I click on the taskbar and then the game calls up and works fine, but I want to avoid this glitch. What can I do?

    Thanks for all the help. I really do appreciate the help.
    Using VS 6 Enterprise w/ SP5 & Windows 2000 Professional

  2. #2
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    How do you Shell the game now?

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2000
    Posts
    316
    Like this:

    Code:
    Private Sub cmdEnter_Click()
    Dim MyLaunch As String
    MyLaunch = "D:\Program Files\Game\Whatever.exe"
    Shell (MyLaunch)
    End Sub
    Thanks
    Using VS 6 Enterprise w/ SP5 & Windows 2000 Professional

  4. #4
    Hyperactive Member PJB's Avatar
    Join Date
    Aug 2000
    Location
    dunno at the moment
    Posts
    302
    Don't know if it will work but try unloading your app when you start the game, unless you still need your app running for something...
    VB6.0 SP4
    Windows 2000
    I'm thinking of a number between

  5. #5
    Fanatic Member
    Join Date
    Jul 2000
    Location
    Manchester NH
    Posts
    833
    this works better than plane old shell
    ---------------------------------------------

    Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal opOperation As String, ByVal lpFile As String, ByVal opParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

    ' just call it like this ShellExe("Explorer")

    Public Sub ShellExe(What As String)
    On Error Resume Next
    Call ShellExecute(0&, vbNullString, What, vbNullString, vbNullString, vbNormalFocus)
    End Sub



    Kurt Simons
    [I know I'm a hack but my clients don't!]

  6. #6
    Hyperactive Member PJB's Avatar
    Join Date
    Aug 2000
    Location
    dunno at the moment
    Posts
    302
    Well if ya wanna go around doing things the right way i suppose that'll work Kurt
    VB6.0 SP4
    Windows 2000
    I'm thinking of a number between

  7. #7
    Fanatic Member
    Join Date
    Jul 2000
    Location
    Manchester NH
    Posts
    833
    Right Way???
    Kurt Simons
    [I know I'm a hack but my clients don't!]

  8. #8
    Hyperactive Member PJB's Avatar
    Join Date
    Aug 2000
    Location
    dunno at the moment
    Posts
    302
    well everything i do involves crashing so i'm just guessing there might be a right way out there
    VB6.0 SP4
    Windows 2000
    I'm thinking of a number between

  9. #9
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    Since it is an EXE file you are shelling you don't have to resort to ShellExecute. You can go with the Shell function.
    Shell has a second optional argument that determents the window state. If it's omitted the Window is started minimized with focus. Since your game normally takes the full screen it will not be minimized before you take any action in the window (like clicking somewhere).

    Shell the application like this instead:
    Code:
    Private Sub cmdEnter_Click()
        Dim MyLaunch As String
        MyLaunch = "D:\Program Files\Game\Whatever.exe"
        Shell MyLaunch, vbMaximizedFocus
    End Sub
    Good luck!

  10. #10
    Fanatic Member
    Join Date
    Jul 2000
    Location
    Manchester NH
    Posts
    833
    someone else posted a few weeks ago that they were trying the shell a program and it kept crashing...

    this fixed it
    Kurt Simons
    [I know I'm a hack but my clients don't!]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width