OSDN Git Service

挿入文字列だけ変更して適用できない不具合の修正
[gikonavigoeson/gikonavi.git] / BrowserRecord.pas
index 616d856..cd8ced2 100644 (file)
@@ -30,8 +30,10 @@ type
                property        LastSize        : Integer               read FLastSize  write FLastSize;
                property        Repaint         : Boolean               read FRepaint   write FRepaint;
                //property      Movement        : string                read FMovement  write FMovement;
-               procedure       Move(const AName: string);
+               procedure       Move(const AName: string); overload;
+        procedure      Move(scroll: Integer); overload;
                procedure       IDAnchorPopup(Abody :string);
+        procedure OpenFindDialog;
        end;
        // BrowserRecord\82É\82Â\82¢\82Ä\82¢\82éFBrowser\82ð\8aO\82·
        procedure ReleaseBrowser( BRecord: TBrowserRecord);
@@ -108,6 +110,29 @@ begin
                end;
        end;
 end;
+// *************************************************************************
+//! \83u\83\89\83E\83U\82ð\83X\83N\83\8d\81[\83\8b\82³\82¹\82é
+// *************************************************************************
+procedure TBrowserRecord.Move(scroll: Integer);
+begin
+       //\83u\83\89\83E\83U\82ª\95t\82¢\82Ä\82é\82Æ\82«\82¾\82¯\8f\88\97\9d\82·\82é
+       if (Self.Browser <> nil) then begin
+               //\83u\83\89\83E\83U\82ª\83f\81[\83^\82Ì\93Ç\82Ý\8d\9e\82Ý\92\86\82Ì\8e\9e\82Í\93Ç\82Ý\8d\9e\82Ý\82ð\91Ò\82Â
+               while (Self.Browser.ReadyState <> READYSTATE_COMPLETE) and
+                                       (Self.Browser.ReadyState <> READYSTATE_INTERACTIVE) do begin
+                       Sleep(1);
+                       Application.ProcessMessages;
+               end;
+
+               try
+                       OleVariant(Self.Browser.Document as IHTMLDocument2).body.scrollTop
+                := OleVariant(Self.Browser.Document as IHTMLDocument2).body.scrollTop
+                    + scroll;
+               except
+               end;
+       end;
+end;
+
 //ID\83A\83\93\83J\81[\92Ç\89Á
 procedure TBrowserRecord.IDAnchorPopup(Abody :string);
 const
@@ -148,6 +173,48 @@ begin
                end;
        end;
 end;
-
+{
+\brief \8c\9f\8dõ\83_\83C\83A\83\8d\83O\8cÄ\82Ñ\8fo\82µ
+}
+procedure TBrowserRecord.OpenFindDialog();
+const
+       CGID_WebBrowser: TGUID = '{ED016940-BD5B-11cf-BA4E-00C04FD70816}';
+       HTMLID_FIND = 1;
+var
+       CmdTarget : IOleCommandTarget;
+       vaIn, vaOut: OleVariant;
+       PtrGUID: PGUID;
+begin
+       if (Self.Browser <> nil) and (Self.Browser.Document <> nil) then begin
+               //\83u\83\89\83E\83U\82ª\83f\81[\83^\82Ì\93Ç\82Ý\8d\9e\82Ý\92\86\82Ì\8e\9e\82Í\93Ç\82Ý\8d\9e\82Ý\82ð\91Ò\82Â
+               while (Self.Browser.ReadyState <> READYSTATE_COMPLETE) and
+                                       (Self.Browser.ReadyState <> READYSTATE_INTERACTIVE) do begin
+                       Sleep(1);
+                       Application.ProcessMessages;
+               end;
+        vaIn  := 0;
+        vaOut := 0;
+               New(PtrGUID);
+               PtrGUID^ := CGID_WebBrowser;
+        try
+               try
+                       if Self.Browser.Document
+                    .QueryInterface(IOleCommandTarget, CmdTarget)
+                    = S_OK then begin
+                           if CmdTarget <> nil then begin
+                                   try
+                                           CmdTarget.Exec(PtrGUID, HTMLID_FIND, 0, vaIn, vaOut);
+                                       finally
+                                               CmdTarget._Release;
+                                       end;
+                               end;
+                end;
+                   except
+                   end;
+        finally
+               Dispose(PtrGUID);
+        end;
+       end;
+end;
 
 end.