View Full Version : Starting TS2 "Minimized & no focus" from another application ?
using vb 6's shell command to start the app minimzed and with out focus with this code:
Shell "d:\Program Files\teamSpeak2_RC2\TeamSpeak.exe", vbMinimizedNoFocus
how ever the TSs client starts with focus , there is nothing wrong with the code i am using TS client seems to ask for focus on start up... is there a command line i can use with the client path to start TS minimized with out focus?
reason i am asking is because i am starting the client from inside the game and dont want the game window to lose focus.
You'll have to do it with the Windows API
Here's a link to a great API viewer and helper (gives samples, etc):
http://www.mentalis.org/agnet/appdown.shtml
I believe the items you want are either of these:
CreateProcess
or...
ShellExecute or ShellExecuteEx (I think this will require IE installed though)
EDIT:
With either of these, since TS is not a console app, then you could probably just keep the window hidden too, just make sure you shut down the client when you exit your code.
ahh thanks me2 i had actually tryed using just the windows api, where i went wrong was that i kept using the vb's built in shell constants and the window api constants are off by one.
Hmm seems i spoke to soon, using sellexecute starts ts and minimizes it and keeps the focus of the original window when i tested it outside the game (didnt have time to log in the game this afternoon). but when i am in game , the game window loses focus still (boots me out of the game window).
here is the code i am useing:
/// the window api declaration in my ts.bas
Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Declare Function GetActiveWindow Lib "user32" () As Long
/// call to the function in my class
ShellExecute GetActiveWindow, vbNullString, "TeamSpeak.exe", vbNullString, "D:\Program Files\teamspeak2_RC2", 7
Edit 1, Ok done a bit more testing it seems the client still asks for focus as it is starting up. did some tests loading another exe while inside the game with the same code , loads fine and i dont get booted out, but when i try the client exe it boots me out.
that really bites the big one. no matter which flags are used, it still steals the focus...i checked it out for a while too...
sorry...this is up to the devs :(
vBulletin® v3.7.0, Copyright ©2000-2008, Jelsoft Enterprises Ltd.