20.02.2013, 09:11
|
|
Let Me Show You
|
|
Регистрация: 30.04.2010
Адрес: Северодвинск
Сообщения: 5,426
Версия Delphi: 7, XE5
Репутация: 59586
|
|
все честно. запускает 2 калькулятора и сворачивает оба:
Код:
unit Unit1;
interface
uses
ShellAPI,
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Memo1: TMemo;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
function EnumWindowsProc(hwnd: HWND; lParam: LPARAM): Boolean; stdcall;
var
buf: array [0..$ff] of Char;
l: Integer;
s: String;
begin
Result:=True;
l:=GetWindowText(hwnd, @buf[0], Length(buf));
if l>0 then
begin
s:=Copy(buf, 1, l);
if s='Калькулятор' then
begin
Form1.Memo1.Lines.Add(s+' = '+IntToStr(hwnd));
SendMessage(hwnd, WM_SYSCOMMAND, SC_MINIMIZE, 0);
end;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
ShellExecute(0, 'open', 'c:\WINDOWS\system32\calc.exe', nil, nil, SW_SHOWNORMAL);
ShellExecute(0, 'open', 'c:\WINDOWS\system32\calc.exe', nil, nil, SW_SHOWNORMAL);
Sleep(1000);
EnumWindows(@EnumWindowsProc, 0);
end;
end.
__________________
Пишу программы за еду.
__________________
|