SRL Archive - Help and Support

How would you hide a window useing scar?


Lalaji

2007-12-04 17:00:19

How would you "hide" a target window or the active client useing scar

Like the way you hide scar useing ::

Begin
// Hides scar.exe.
GetSelf.HIDE;
Wait(1000);
// Shows scar.exe.
GetSelf.SHOW;
End.

R0b0t1

2007-12-04 17:12:44

EDIT:


program New;
//ALLOW API CALLS! SCRIPT -> ALLOW API CALLS

const //Constants for ShowWindow
SW_HIDE = 0;
SW_SHOWNORMAL = 1;
SW_NORMAL = 1;
SW_SHOWMINIMIZED = 2;
SW_SHOWMAXIMIZED = 3;
SW_MAXIMIZE = 3;
SW_SHOWNOACTIVATE = 4;
SW_SHOW = 5;
SW_MINIMIZE = 6;
SW_SHOWMINNOACTIVE = 7;
SW_SHOWNA = 8;
SW_RESTORE = 9;
SW_SHOWDEFAULT = 10;
SW_FORCEMINIMIZE = 11;
SW_MAX = 11;

function FindWindowW(lpClassName, lpWindowName: String): HWND; external 'FindWindowW@user32.dll';
function ShowWindow(hwnd: HWND; nCmdShow: Integer): Boolean; external 'ShowWindow@user32.dll';

begin
end.

I included my own FindWindow function so you wouldn't have to use SCAR's watered down one. To just find something by title, use "FindWindowW('', 'Some Title')" to return the HWND. And to use ShowWindow, use something like this: "ShowWindow(SomeHWND, SW_HIDE)" and that would hide it…

Oh, if you wanted the start bar, use: "FindWindowW('Shell_TrayWnd', '')". If you want the desktop, I believe its HWND is always zero.

Lalaji

2007-12-04 18:59:28

So, if i wanted to see a window, it would be
ShowWindow(hwnd: HWND; 1)

Whats HWND?

P.S. How would i hide it in the first place?
EDIT : in the const did you mean for sw_max to be 12?

R0b0t1

2007-12-04 19:42:14

Nope. SW_MAX is sposed to be 11.

A HWND is a windows handle. Its like its "computer" name.

R0b0t1

2007-12-04 20:49:02

Dis work? Its keeps crashing SCAR for me…


program New;

const
SW_HIDE = 0;
SW_SHOWNORMAL = 1;
SW_NORMAL = 1;
SW_SHOWMINIMIZED = 2;
SW_SHOWMAXIMIZED = 3;
SW_MAXIMIZE = 3;
SW_SHOWNOACTIVATE = 4;
SW_SHOW = 5;
SW_MINIMIZE = 6;
SW_SHOWMINNOACTIVE = 7;
SW_SHOWNA = 8;
SW_RESTORE = 9;
SW_SHOWDEFAULT = 10;
SW_FORCEMINIMIZE = 11;
SW_MAX = 11;

function ShowWindow(hWnd: HWND; nCmdShow: Integer): Boolean; external 'ShowWindow@user32.dll';

begin
FindWindow('Put your window''s title here.');

ShowWindow(GetClientWindowHandle, SW_HIDE);
Wait(5000);
ShowWindow(GetClientWindowHandle, SW_SHOW);
end.

Lalaji

2007-12-04 20:49:15

That help…kinda…

First tried to run it, and didnt compile and realized i didnt have API on. Turned it on and ran it again

Second time it hid scar. and never brought it bach, lol?
I am pretty sure i have the window title right…