-
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.
-
How do you Shell the game now?
-
Like this:
Code:
Private Sub cmdEnter_Click()
Dim MyLaunch As String
MyLaunch = "D:\Program Files\Game\Whatever.exe"
Shell (MyLaunch)
End Sub
Thanks
-
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...
-
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
-
Well if ya wanna go around doing things the right way i suppose that'll work Kurt :)
-
-
well everything i do involves crashing so i'm just guessing there might be a right way out there
-
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!
-
someone else posted a few weeks ago that they were trying the shell a program and it kept crashing...
this fixed it