Хамик
Старожил
Почему данный пример не работает? Использую unicode от restools
Код:
[Setup]
AppName=My Program
AppVerName=My Program v.1.2
DefaultDirName={pf}\My Program
[Code]
const
BM_CLICK = $F5;
WM_GETTEXT = $D;
WM_GETTEXTLENGTH = $E;
function FindWindowEx(hWndM, hWndC: LongWord; lpszClass, lpszWindow: PChar): LongWord;
external 'FindWindowExA@user32.dll stdcall';
procedure InitializeWizard();
var
ResultCode: Integer;
AppWnd, EditWnd: LongWord;
length: LongInt;
Text: String;
begin
if Exec(ExpandConstant('{sys}\calc.exe'), '', '', SW_SHOW,
ewWaitUntilIdle, ResultCode) then
begin
AppWnd:= FindWindowByWindowName('Калькулятор');
if AppWnd <> 0 then
begin
SendMessage(FindWindowEx(AppWnd, 0, 'Button', '7'), BM_CLICK, 0, 0);
SendMessage(FindWindowEx(AppWnd, 0, 'Button', '/'), BM_CLICK, 0, 0);
SendMessage(FindWindowEx(AppWnd, 0, 'Button', '8'), BM_CLICK, 0, 0);
SendMessage(FindWindowEx(AppWnd, 0, 'Button', '='), BM_CLICK, 0, 0);
EditWnd:= FindWindowEx(AppWnd, 0, 'EDIT', '');
length:= SendMessage(EditWnd, WM_GETTEXTLENGTH, 0, 0);
Text:= StringOfChar(' ', length);
SendMessage(EditWnd, WM_GETTEXT, length, CastStringToInteger(Text));
MsgBox(Text, mbInformation, MB_OK);
end;
end;
end;
Последнее редактирование: