0

我得到了下面的代码,我相信它会产生“资源很忙”,因为它在计时器中,所以会不断重复。我用它来找出我试图自动告诉我的网站并采取相应的行动。

谁能告诉我如何修复代码或调试它?

    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;

错误截图

4

0 回答 0