Einzelnen Beitrag anzeigen

hathor
(Gast)

n/a Beiträge
 
#3

Re: Webbrowser Refresh mit anschließenden OnDocumentComplete

  Alt 22. Mai 2009, 17:13
Ich habe das in einem eigenen Programm so gelöst:

Delphi-Quellcode:
// Refresh Webbrowser in Unit WBFuncs.pas
procedure WB_Refresh(WB: TWebbrowser);
const REFRESH_COMPLETELY = 3;
var KeyState: TKeyBoardState; RefreshLevel: OleVariant;
begin
  if WB_DocumentLoaded(WB) then begin GetKeyboardState(KeyState);
    try if not ((KeyState[vk_Control] and 128) <> 0) then WB.Refresh
      else // if control key pressed then REFRESH_COMPLETELY
           // RefreshLevel specifies the refresh level.
        RefreshLevel := REFRESH_COMPLETELY;
      WB.DefaultInterface.Refresh2(RefreshLevel);
    except end; end;
end;
...
// Get the current (visible) TWebbrowser in PC1=PageControl
function TForm1.GetCurrentWB: TWebbrowser;
begin Result := nil;
  with PC1 do if ActivePage.ControlCount > 0 then
    begin if ActivePage.Controls[0] is TWebbrowser then
      begin Result := (TWebbrowser(ActivePage.Controls[0]));
      end else Result := FPrevBrowser; end;
end;
...
WB_Refresh(GetCurrentWB);
  Mit Zitat antworten Zitat