Home > Back-end > Using DELPHI control download pop-up window and click save to why not
Using DELPHI control download pop-up window and click save to why not
Time:10-04
After I use DELPHI to file download in the pop-up window directly simulate click save button, but is not successful, can only be parked the focus on the save button, after the action does not perform, please expert help, the code is as follows:
Procedure TForm1. Button1Click (Sender: TObject); Var H, hc: HWND; I: integer; The begin H:=findwindow (nil, 'file download); If H & gt; 0 then The begin //FindWindowEx (h, 0, 'Button', 'save (& amp; S) ') Hc:=FindWindowEx (h, 0, 'Button', 'save (& amp; S) "); If hc> 0 then The begin //Windows. SetForegroundWindow (h); SendMessage (hc, WM_LBUTTONDOWN, 0, 0); //Sleep (20); SendMessage (hc, WM_LBUTTONUP, 0, 0); //Sleep (20); //SendMessage (hc, BM_CLICK, 0, 0); //Sleep (20); PostMessage (hc, BM_CLICK, 0, 0);