• TEmbeddedWB Methods1


      This page is still Under Construction

      AddHtmlToAboutBlank: This function allow you to add a string to the blank pages (Like "About : Blank") to create your own personal blank page.
      EmbeddedWB1.AddHtmlToAboutBlank('Enhanced Browser 2006'); 

      AutoFillIEFormAndExcecute: A procedure that can help you analyze and auto fill common forms that contain field name like 'INPUT', 'Text', 'FindWindow',  'Submit' and 'Search'.
      You must remember that web sites programmers not always use the standard text and it will not function without the equal text fields.

      AddToRestrictedSiteList(URL :String): A procedure that will add the URL string into the list of "Restricted Site List".

      AddToTreustedSiteList(URL :String): A procedure that will add the URL string into the list of "Trusted Site List".

      AddToFavorites(URL: String, Title: String); A procedure that will add a site to your favorites sites. You can enter only URL but then you will loose the proper display.
       EmbeddedWB1.AddToFavorites('bsalsa.com', 'Embedded Web Browser page'); 

      AssignDocument: A procedure which will navigate to "About:Blank" page and wait until the page is fully loaded.

      Assign(Source: TPersistent): This procedure comes from Classes.pas.
      Call Assign to copy the properties or other attributes of one object from another.

      AfterConstruction: This procedure is called automatically after the object's last constructor has executed. Do not call it explicitly in your applications.

      BrowseProperties: The procedure comes from OleCtrls and NOT supported anymore.

      Broadcast(var Message): This procedure comes from TWinControl.
      Use Broadcast when you want to send the same message to each of the child controls contained within the windowed control. Specify the message to be passed as the value of the Message parameter

      BeginDrag(Immediate: Boolean; Threshold: Integer):
      Call BeginDrag to start a drag operation. BeginDrag is called in application code only when the value of the control's DragMode is dmManual. If DragMode is dmAutomatic, BeginDrag is called automatically. If the Immediate parameter is true, the mouse pointer changes to the value of the DragCursor property and dragging begins immediately. If Immediate is false, the mouse pointer doesn't change to the value of the DragCursor property and dragging doesn't begin until the user moves the mouse pointer the number of pixels specified by the Threshold parameter. If the caller passes a Threshold value less than 0 (such as the default value for this parameter), BeginDrag uses the DragThreshold property of the global Mouse variable. Setting Immediate to false allows the control to accept mouse clicks without beginning a drag-and-drop or drag-and-dock operation.

      BringToFront: Comes from Controls. You should Call BringToFront to ensure that a form is visible or to reorder overlapping controls within a form.
      Without BringToFront, controls are stacked in their order they were placed on the form. 

      BeforeDestruction: BeforeDestruction is called automatically immediately before the component's first destructor executes. Do not call it explicitly in your applications.

      CheckOnlineStatus: Call CheckOnlineStatus function to check your online status. It will return true if you are online and false for offline.
      If EmbeddedWB1.CheckOnlineStatus then...

      CheckIfInTrustedList(URL:String): Call CheckIfInTrustedList function to check if a URL is in the Trusted List.
      Return true if the URL is in the Trusted List
       if EmbeddedWB1.CheckIfInTrustedList('borland.com') then ...

      CheckIfInRestrictedList(URL:String): Call CheckIfInRestrictedList function to check if a URL is in the Restricted List.
      Return true if the URL is in the Restricted List
       if EmbeddedWB1.CheckIfInRestrictedList('borland.com') then ...

      ClearCache: Call ClearCache procedure to clear all the pc cache.
      You should remember that this procedure is irreversable and will delete also entire IE cache also.

      ClearHistory: Call ClearHistory procedure to clear all the internet History.
      You should remember that this procedure is irreversable and will delete also entire IE History also.

      ClearTypedUrls: Call ClearTypedUrls procedure to clear all the Typed Urls as they appear in the address bar.
      You should remember that this procedure is irreversable and will delete also entire IE Typed Urls also.

      ClientToWindow(var pcx: SYSINT; var pcy: SYSINT):Do not use this method. It is included in the TEmbeddedWB interface because the IWebBrowser2 interface is shared with Internet Explorer. Internet Explorer uses ClientToWindow to convert between client coordinates and window coordinates.

      Copy: Copy procedure will copy the selected text or image to the clipboard.
      Remember to select something before trying to copy.

      CreateDesktopShortcut: This procedure will create a shortcut to the current web site location on your desktop.
      The procedure supports the web site address, title and favicon.

      CreateNewMail: This procedure will lunch your default Email client by creating a new mail without a context.

      Cut: Cut procedure will cut the selected text or image to the clipboard.
      Remember to select something before trying to cut, and that cut procedure is availableunder its terms.

      Create(Owner: TComponent): The Create constructor allow  you to create TEmbeddedWB dynamically.
      procedure TForm1.Button1Click(Sender: TObject);
        WB: TEmbeddedWB;
      WB := TEmbeddedWB.Create(nil);
          TControl(WB).Parent := panel1; //or whatever... 
          WB.Visible := True;


       WB := TEmbeddedWB.(self);

        with TControl(
      WB) do
          Parent := self; //or whatever...
      WB do

          Visible := True;
          DownloadOptions:=[  DLCTL_NO_SCRIPTS , DLCTL_NO_JAVA

      CanFocus: Call CanFocus to find out if the control can receive input from the user. CanFocus returns true if both the control and its parent(s) have their Visible and Enabled properties set to true. If any of the Visible and Enabled properties of the control or the controls in which it is contained are not true, then CanFocus returns false.
      If EmbeddedWb1.CanFocus then...

      CleanupInstance:Do not call CleanupInstance directly. CleanupInstance is called automatically when the object instance is destroyed. CleanupInstance releases all long strings and variants. It sets long strings to empty and variants to Unassigned.

      DesignMode:Use this function to change to design mode on and off.
      DesignMode will return true for on state and false for off state.
      if EmbeddedWb1.DesaignModethen..

      Destroy: Destroy is the component destructor. You do not use it within your application.

      DocumentLoaded: Use this function to query the loaded document.
      It will return false if the document = nil and true if the document is assigned.
      if EmbeddedWb1.DocumentLoadedthen..

      ExploreFolder(Path: String): This procedure will lunch Windows Explorer by the given path using ShellAPI.

      ExecWB: ExecWB lets you use the IOleCommandTarget interface to pass a command to the Web browser control. For more information, see the Microsoft documentation of IOleCommandTarget. cmdID specifies the command to execute. The Web Browser does not support all of the commands for which Microsoft providesconstants. Use the QueryStatusWB method to determine what commands can be used. cmdexecopt modifies how the command is executed. pvaIn specifies a Variant array that contains any input arguments. This value can be omitted if there are not input arguments. pvaOutspecifies a Variant that receives the results of the command, if any. This value can be omitted if there are no results
      if ( ActiveControl is TWebBrowser ) then begin WebBrowser1.ExecWB( OLECMDID_COPY, OLECMDEXECOPT_DODEFAULT ); 

      FillForm(FieldName: string; Value: string):This function allow you to auto insert details into a web page
      procedure TfrmMain.FillFormWithPersonalDetails1Click(Sender: TObject);
      while EmbeddedWB1.ReadyState <> READYSTATE_COMPLETE do
           FillForm('login', 'Mozart');
           FillForm('passwd', 'Bethoven');
           FillForm('.fn', 'lol1');
           FillForm('.ln', 'lol2');
           FillForm('.ln', 'lol2');
           FillForm('.pw', 'lol3333');
           FillForm('.pw2', 'lol444');
           FillForm('.pw_a', 'lolypop');
           FillForm('.pwqa_a', 'lolypop');
           FillForm('.em', 'loly@pop.com');
           FillForm('.pc', '123456');
           FillForm('.secword', ':)');

      FrameCount: This function will return a LongInt that contain the document frames number.
      i:= EmbeddedWB1.FramesCount;

      FrameCountFromDocument(SourceDocIHtmlDocument2)):This function is an enhanced FrameCount and  will return a integer that contain the document frames number.
      i:= EmbeddedWB1.FramesCountFromDocument('bla.html');

      GetCachedFileFromURL(strUL: string; var strLocalFile: string): This function will return the path to a specific file in the cache
      procedure TfrmMain.GetCachedPathClick(Sender: TObject);
      str : string;
        EmbeddedWB1.GetCachedFileFromURL(IEAddress1.Text, str);

      GetCookie: This function will return the Cookie name as a string, if the page contains a cookie. If the page does not contain a cookie, it will return an empty string.
      procedure TfrmMain.CookiesCheck1Click(Sender: TObject);
       st : string;
           st:= EmbeddedWB1.GetCookie;
           SetLength(st, 180);
        if st <> ''then ShowMessage('The web site has just added a cookie:
           +#10+#13+ st) else ShowMessage('No cookies were found.');

      GetCookiesPath: If you Call this function the result will be the IE Cookies path.
      procedure TfrmMain.GetCookiesClick(Sender: TObject);
       st : string;
           st:= EmbeddedWB1.GetCookiesPath;
           ShowMessage('Cookies Path: '+ st);

      GetHistoryPath:If you Call this function the result will be the IE History path.
      procedure TfrmMain.GetHistoryClick(Sender: TObject);
       st : string;
           st:= EmbeddedWB1.GetHistoryPath;
           ShowMessage('History Path: '+ st);

      GetFavoritesPath: If you Call this function the result will be the IE Favorites path.
      procedure TfrmMain.GetFavoritesClick(Sender: TObject);
       st : string;
           st:= EmbeddedWB1.GetFavoritesPath;
           ShowMessage('Favorites Path: '+ st);

      GetFrame(FrameNo : Integer) : IWebbrowser2;:Returns Iwebbrowser2-interface to the specified frame. You can use it to print a particular frame, view frame-source etc

      GetDefaultBrowserFromRegistry: This function will return the Default Browser name as a string (if there is a Default Browser). If no Default Browser is set, then it will return 'No default browser was found' string.
      procedure TfrmMain.GetBrowserClick(Sender: TObject);
       st : string;
           st:= EmbeddedWB1.GetDefaultBrowserFromRegistry;
           ShowMessage('Default Browser: '+ st);

      GetIEHomePage: This function will return the IE Home Page  as a string.
      procedure TfrmMain.GetIEHomePageClick(Sender: TObject);
       st : string;
           st:= EmbeddedWB1.GetIEHomePage;
           ShowMessage('Default Browser: '+ st);

      GetIEHandle(WebBrowser: TEmbeddedWB; ClassName: string): HWND: This function returns the handle of the Internet Explorer window (HWND) to assist the programer Invoke Hidden Commands in the EmbeddedWB.
      The following codes demonstrates an innovative way to invoke hidden commands to show modal dialogs such as "Add To Favorite" dialog, "Import/Export Wizard" dialog in your WebBrowser-based application Command IDs Handled by 'Shell DocObject View'
      Const Uses:
      const ID_IE_FILE_PAGESETUP           = 259;
      const ID_IE_FILE_PRINT               = 260;
      const ID_IE_FILE_NEWWINDOW           = 275;
      const ID_IE_FILE_PRINTPREVIEW        = 277;
      const ID_IE_FILE_NEWMAIL             = 279;
      const ID_IE_FILE_SENDPAGE            = 282;
      const ID_IE_FILE_SENDLINK            = 283;
      const ID_IE_HELP_VERSIONINFO         = 336;
      const ID_IE_HELP_HELPINDEX           = 337;
      const ID_IE_HELP_WEBTUTORIAL         = 338;
      const ID_IE_HELP_FREESTUFF           = 341;
      const ID_IE_HELP_PRODUCTUPDATE       = 342;
      const ID_IE_HELP_FAQ                 = 343;
      const ID_IE_HELP_ONLINESUPPORT       = 344;
      const ID_IE_HELP_FEEDBACK            = 345;
      const ID_IE_HELP_BESTPAGE            = 346;
      const ID_IE_HELP_SEARCHWEB           = 347;
      const ID_IE_HELP_MSHOME              = 348;
      const ID_IE_HELP_VISITINTERNET       = 349;
      const ID_IE_HELP_STARTPAGE           = 350;
      const ID_IE_HELP_NETSCAPEUSER        = 351;
      const ID_IE_FILE_IMPORTEXPORT        = 374;
      const ID_IE_HELP_ENHANCEDSECURITY    = 375;
      const ID_IE_FILE_ADDTRUST            = 376;
      const ID_IE_FILE_ADDLOCAL            = 377;
      const ID_IE_FILE_NEWPUBLISHINFO      = 387;
      const ID_IE_FILE_NEWPEOPLE           = 390;
      const ID_IE_FILE_NEWCALL              =395;
      Command IDs Handled by 'Internet Explorer_Server'
      const ID_IE_CONTEXTMENU_ADDFAV       = 2261;
      const ID_IE_CONTEXTMENU_REFRESH      = 6042;

      procedure TForm1.ToolButton2Click(Sender: TObject);
      //Invoke "Add To Favorite" Dialog
      GetIEHandle(web, 'Internet Explorer_Server'), WM_COMMAND,

       procedure TForm1.ToolButton3Click(Sender: TObject);
      //Invoke "Import/Export Wizard" Dialog
      GetIEHandle(web, 'Shell DocObject View'), WM_COMMAND,

      Function GetIEVersion : String; Use this function to determine which version of Internet Explorer is installed on the computer.
      The function returns the fileversion of shdocvw.dll. 
      The following chart lists the different versions of the Shdocvw.dll file and the corresponding versions of Internet Explorer:

      Version Product
      4.70.1155 Internet Explorer 3.0
      4.70.1158 Internet Explorer 3.0 (OSR2)
      4.70.1215 Internet Explorer 3.01
      4.70.1300 Internet Explorer 3.02
      4.71.1008.3 Internet Explorer 4.0 PP2
      4.71.1712.5 Internet Explorer 4.0
      4.72.2106.7 Internet Explorer 4.01
      4.72.3110.3 Internet Explorer 4.01 Service Pack 1
      4.72.3612.1707 Internet Explorer 4.01 SP2
      5.00.0518.5 Internet Explorer 5 Developer Preview (Beta 1)
      5.00.0910.1308 Internet Explorer 5 Beta (Beta 2)
      5.00.2014.213 Internet Explorer 5
      5.0.2717.2000 Internet Explorer 5 with Update for "Malformed
      Favorites Icon" Security Issue installed
      5.00.2721.1400 Internet Explorer 5 with Update for "ImportExport
      Favorites()" Security Issue installed
      5.00.2919.800 Internet Explorer 5 (Windows 2000 RC1, build 5.00.2072)
      5.00.2919.3800 Internet Explorer 5 (Windows 2000 RC2, build 5.00.2128)
      5.00.2919.6307 Internet Explorer 5.01
      5.50.3825.1300 Internet Explorer 5.5 Developer Preview (Beta)

      Determing Which Version of Internet Explorer you are using

      GetLastVisitedPage(var LastVisitedPage: string): Call this function to get the last visited page (before your browser was closed).
      You must use SaveLastVisitedPage function on you form close event to enable this feature.
      procedure TfrmMain.GetLastVisitedPageClick(Sender: TObject);
         st : string;
           st:= EmbeddedWB1.GetLastVisitedPage;
           ShowMessage('Default Browser: '+ st);

      GetIPAndHostName(var HostName, IPaddr, WSAErr: string): Boolean: Call this function to get the pc Host name and IP address (True result).
      In case of an error, WSAErr will hold an error string and the result will be false.
      procedure TfrmMain.GetHostAndIP1Click(Sender: TObject);
       HostN,HostIP,Err : string;
         if EmbeddedWB1.GetIPAndHostName(HostN, HostIP, Err)then
            MessageDlg('PC Host Name: '+HostN + #10+#13+'Your Internal
            IP: ' + HostIP, mtInformation, [mbOk], 0)
           else MessageDlg(Err, mtError, [mbOk], 0);

      GetSpecialFolderPath(CallerHandle: THandle; CSIDL: Integer): PChar: Call the function to retrive the path to windows special folders path.

      Const Uses:































      procedure TForm1.Button1Click(Sender: TObject);
      OrganizeFavorite(Handle, GetSpecialFolderPath(Handle,

      GetBmpFromBrowser(FileName : String): Boolean: Call GetBmpFromBrowser to create a screen capture of your page. Remember to enter a valid name or path with name for the file.
      Result will be true if the process will end succesfuly.
       procedure TfrmMain.getAScreanCapture1Click(Sender: TObject);
            ShowMessage('The screen capture is in your application       folder.');

      GetDocument: IHtmlDocument2 The result of this function will be the current loaded document as IHtmlDocument2.
      In case of an error, a proper message will be shown.
      if EmbeddedWB1.GetDocument then..

      GetJPEGfromBrowser(FileName: string; SourceHeight, SourceWidth, TargetHeight, TargetWidth: integer): Boolean;
      This function is a different method to get a screen capture.
      This method is more flexible and you can set also the height and width.
      procedure TfrmMain.GetJpegPageCapture1Click(Sender: TObject);
      if EmbeddedWB1.GetJpegFromBrowser('.\Site.jpg', Height, Width, Height, Width) then
           ShowMessage('The page screen capture is in your application folder.')

      Navigates to the previous item in the history list.
      Call GoBack to return to the last document in the history list. GoBack has no effect unless the history list contains additional documents.


      The Navigate or Navigate2 command can change the history list, depending on the specified flags.

      GoForward: Navigates to the next item in the history list.
      Call GoForward to return to the next document in the history list. GoForward reverses the effect of the last GoBack command.

      GoHome:Navigates to the current start page.
       Call GoHome to navigate to the registered home or start page. The URL for this page is specified in the Registry at

      HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main
      under the name Startpage. You can change this value using the TRegistry or TRegistryIniFile object, or using Navigation tab of the Internet Explorer's Options dialog.

      GoSearch:Navigates to the current search page.
      Call GoSearch to navigate to the registered search page. The URL for this page is specified in the Registry at
      HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main
      under the name SearchPage. You can change this value using the TRegistry or TRegistryIniFile object, or using Navigation tab of the Internet Explorer's Options dialog.

      标签: tembeddedwb, methods, fillform, cookie

    • 当前暂无评论 »

      • 发表评论: ( 注意:为了防止广告评论,本站链接已经启用nofollow)
      •   您的名字
      •   E-mail
      •   您的网址(选填)

Powered by Typecho)))   ICP:蜀ICP备05009250号