Programming/Delphi

다른 프로그램의 버튼 클릭하기

통통만두 2010. 6. 30. 15:33
반응형
procedure TForm2.Button1Click(Sender: TObject);
var
   HParent : HWND;
   HChild : HWND;
begin
   HParent := FindWindow('TForm1', nil);
   if HParent <> 0 then
   begin
      HChild := FindWindowEx(HParent, 0, 'TButton', nil);
      if HChild <> 0 then
      begin
         SendMessage(HChild, WM_LBUTTONDOWN, 0, 0);
         SendMessage(HChild, WM_LBUTTONUP, 0, 0);
      end;
   end;
end;
반응형