| View previous topic :: View next topic |
| Author |
Message |
DeletedUser14087 I post too much
Reputation: 2
Joined: 21 Jun 2006 Posts: 3069
|
Posted: Sat Sep 29, 2007 10:17 am Post subject: [Delphi]Minimize Another application *SOLVED* |
|
|
Hey, i've tryed myself using:
| Code: |
var
h: hWnd;
begin
h:= FindWindowA(nil,'Window Caption'); //doesn't matter wich
if h<>0 then
SendMessageA(h,SC_MINIMIZE,0,0);
|
To a certain game, but it wont minimize, i've tryed (to be sure) to see if it returns value to make it ShowMessage('Hi'); and it did, but when i try Send/PostMessageA on it, it wont work, any idea ?
thanks.
Last edited by DeletedUser14087 on Sat Sep 29, 2007 11:22 am; edited 1 time in total |
|
| Back to top |
|
 |
Cx Master Cheater
Reputation: 0
Joined: 27 Jul 2007 Posts: 367
|
Posted: Sat Sep 29, 2007 10:52 am Post subject: |
|
|
Though you say "doesn't matter wich", it does matter.
Is it hooked?
_________________
armed with this small butterfly net
i will face the world alone
& never be lonely. |
|
| Back to top |
|
 |
Renkokuken GO Moderator
Reputation: 4
Joined: 22 Oct 2006 Posts: 3249
|
Posted: Sat Sep 29, 2007 11:06 am Post subject: |
|
|
| Code: | procedure TForm1.Button1Click(Sender: TObject);
VAR LOLHANDLE : THANDLE;
begin
LOLHANDLE := FINDWINDOW(NIL,'Untitled - Notepad');
if LOLHANDLE <> 0 then
BEGIN
POSTMESSAGE(LOLHANDLE, WM_SYSCOMMAND, SC_MINIMIZE, 0);
SHOWMESSAGE('LOL MINIMIZED.');
END;
end; |
LOLCAPS.
|
|
| Back to top |
|
 |
DeletedUser14087 I post too much
Reputation: 2
Joined: 21 Jun 2006 Posts: 3069
|
Posted: Sat Sep 29, 2007 11:07 am Post subject: |
|
|
i tryed this:
| Code: |
function MinimizeApp(const sCapt: PChar) : boolean;
var AppHandle:THandle;
begin
AppHandle:=FindWindow(Nil, sCapt) ;
Result:=PostMessage(AppHandle, SC_MINIMIZE, 0, 0) ;
end;
procedure TMainForm.Button1Click(Sender: TObject);
Begin
MinimizeApp(pchar(Edit1.Text));
end;
|
|
|
| Back to top |
|
 |
Renkokuken GO Moderator
Reputation: 4
Joined: 22 Oct 2006 Posts: 3249
|
Posted: Sat Sep 29, 2007 11:11 am Post subject: |
|
|
Wouldn't work, incorrect parameters for PostMessage!
| Code: | | POSTMESSAGE(APPHANDLE, WM_SYSCOMMAND, SC_MINIMIZE, 0); |
|
|
| Back to top |
|
 |
|