I got the below code, which I believe producing "Resource is busy" and since it is in a Timer keep on repeating. I use it to find out what the website I am trying to automate telling me and act accordingly.
Anyone can tell me how to fix the code or debug it?
procedure TimerAutoOKTimer(Sender: TObject);
const
Messagefromwebpage = 'Message from webpage';
var
wnd: hWnd;
begin
wnd := FindWindow(nil, Messagefromwebpage); // 'Message from webpage';
if wnd <> 0 then
begin
Memo1.Lines.Clear;
EnumChildWindows(wnd, @EnumChildrenProc, Integer(Memo1.Lines));
if POS('NOT possible', Memo1.Lines.Text)>0 then
SendMessage(Application.ActiveFormHandle, WM_COMMAND, ID_OK, 0);
if Pos('The webpage you are viewing is trying to close the window.', Memo1.Lines.Text)>0 then
SendMessage(Application.ActiveFormHandle, WM_COMMAND, ID_NO, 0);
end;
end;