Ich hab nochwas ausprobiert, aber auch ohne Erfolg:
Delphi-Quellcode:
procedure TForm1.EncodefixtimerPredTimer(Sender: TObject);
var Key: Char;
wnd2,wnd3: hWnd;
pfad:string;
begin
memo1.lines.add(TimeToStr(time)+' '+'timer start');
memo1.lines.add(TimeToStr(time)+' '+'##################');
pfad := ExtractFilePath(ParamStr(0)) ;
wnd2 := FindWindow('#32770', PChar(Fenstertitel.text);
memo1.lines.add(TimeToStr(time)+' '+inttostr(wnd2));
wnd3 := FindWindowEx(wnd2, 0, 'Button', 'Knopf');
memo1.lines.add(TimeToStr(time)+' '+inttostr(wnd2));
memo1.lines.add(TimeToStr(time)+' '+inttostr(wnd3));
//if wnd2=0 then exit else
if wnd3 <> 0 then
begin
SendMessage(wnd3,BM_CLICK,0,0);
memo1.lines.add(TimeToStr(time)+' '+inttostr(wnd2));
memo1.lines.add(TimeToStr(time)+' '+inttostr(wnd3));
//wnd2:=0;
end;
memo1.lines.add(TimeToStr(time)+' '+inttostr(wnd2));
memo1.lines.add(TimeToStr(time)+' '+inttostr(wnd3));
EncodefixtimerPred.Enabled:=false;
memo1.lines.add(TimeToStr(time)+' timer end');
memo1.lines.add(TimeToStr(time)+' ##################');
end;
Code:
15:56:24 timer start
15:56:24 ##################
15:56:24 wnd2 1247346
15:56:24 wnd2 1247346
15:56:24 wnd3 1575014
15:57:44 wnd2 1247346
15:57:44 wnd3 1575014
15:57:44 wnd2 1247346
15:57:44 wnd3 1575014
15:57:44 timer end
15:57:44 ##################
Ich hab den Code mit X-Spy generiert. Hier der Code von X-Spy:
Delphi-Quellcode:
var
wnd: HWND;
begin
wnd := FindWindow('#32770', Fenstertitel);
wnd := FindWindowEx(wnd, 0, 'Button', 'Button1');
if wnd <> 0 then
begin
end;
end;