PDA

View Full Version : Window.Restore help



MigLeader
12-21-2008, 08:37 AM
hi there i have made a program that blocks the desktop and every key combination for the user yet provides a nice interface to to let him pick what game he want (i have a computer gaming center) and i have did a lot of coding but i faced a big problem:

i have used the SSides dll's to block the keys but when i run a game inside this game i can use these keys that SSides dll's ave blocked , and i have made a script when the user press a button to launch a game it removes any other buttons on the application so that they dont run two or more games at the same time , but if he run a game then press CTRL+ESC the game will minimize and he will get stuck because no buttons are visable to him unless he quits the game.

so i did a button to make the game maximize but it didn't work as i want here its code.


processes = Window.EnumerateProcesses();
pro = {};
pro[1] = "BF2.exe";
pro[2] = "CoD2MP_s.exe";
pro[3] = "CoD2SP_s.exe";
pro[4] = "cstrike.exe";
pro[5] = "quake3.exe";
pro[6] = "Transformers.exe";
pro[7] = "AirRaid.exe";
pro[8] = "Tqit.exe";
pro[9] = "Onslaught.exe";
pro[10] = "hl2.exe";
pro[11] = "Game.exe";

for i = 1, 11 do
Window.Restore(pro[i]);
Window.Maximize(pro[i]);
Window.Show(pro[i]);
end

these codes are in the on click tab on the button

note : the pro = {} is the names of the games EXE's that run in the taskmaneger


thanks

Imagine Programming
12-21-2008, 09:27 AM
Well you're trying to restore a window without parsing a windowhandle but a string.



Windowhandle=Application.GetWndHandle();

Window.Restore(Windowhandle)
Window.Show(Windowhandle)
Window.Maximize(Windowhandle)

You could try to fetch all titles and handles using



Windows=Window.EnumerateTitles(true);
if(Windows)then
for handle, title in Windows do
--Actions using the windowhandle
Window.Restore(handle)
Window.Show(handle)
--etc...
end
end

MigLeader
12-21-2008, 05:42 PM
thanks but i will try it tomorrow when i get to my work pc :), but how can i let it just look for only these exe's that i wrote before .:huh


thanks

MigLeader
12-23-2008, 03:29 AM
hi there
it works as i want thanks , but it search for all titles in the task manager , how can i make it search only for titles i write for like these:

pro = {};
pro[1] = "BF2.exe";
pro[2] = "CoD2MP_s.exe";
pro[3] = "CoD2SP_s.exe";
pro[4] = "cstrike.exe";
pro[5] = "quake3.exe";
pro[6] = "Transformers.exe";
pro[7] = "AirRaid.exe";
pro[8] = "Tqit.exe";
pro[9] = "Onslaught.exe";
pro[10] = "hl2.exe";
pro[11] = "Game.exe";

sorry but i still don't understand how can i use [Application.GetWndHandle(?)] well in my application , what can i put in place of the ? , what it really do???


thanks a lot

Imagine Programming
12-23-2008, 04:19 AM
Application.GetWndHandle accepts no arguments, it returns the Window Handle for your application. That's it.

if you search the forum for Close Multiple Instances you'll find more information about this.