Methods 2 | |||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Where:
Navigate2: Use Navigate2 to locate and download a specific resource. Navigate can send an HTTP message to a specified URL and display the results, display the results of a specified file, or navigate to a resource that can't be expressed as an URL such as an item identifier list. URL specifies the UNC path name of a file, the Uniform Resource Locator of an Internet resource, or a pointer to an item identifier list (PIDL). Flags is a set of values that specify whether to add the resource to the history list, whether to read from or write to the cache, and whether to display the resource in a new window. It can be a sum of zero or more of the following:
TargetFrameName is the name of the frame in which the resource will be displayed, or NULL if the resource should not be displayed in a named frame. PostData contains the data sent to the server when usingNavigateto generate an HTTP POST message. If PostData is NULL,Navigategenerates an HTTP GET message. PostData is ignored if URL does not specify an HTTP URL. Headers contains any headers sent to the servers when the URL represents an HTTP URL. HTTP headers specify such things as the intended action required of the server, the type of data, and so on. (See TWebRequest object, whose properties represent many of the more common headers). A: I call the below method with a URL destination, PostData in the format of 'animal=cat&color=brown' etc. and the TEmbeddedWB object that I want to load the URL inside of... procedure TDBModule.Navigate(stURL, stPostData: String; var wbEmbeddedWB: TEmbeddedWB);var vWebAddr, vPostData, vFlags, vFrame, vHeaders: OleVariant; iLoop: Integer;begin {Are we posting data to this Url?} if Length(stPostData)> 0 then begin {Require this header information if there is stPostData.} vHeaders:= 'Content-Type: application/x-www-form-urlencoded'+ #10#13#0; {Set the variant type for the vPostData.} vPostData:= VarArrayCreate([0, Length(stPostData)], varByte); for iLoop := 0 to Length(stPostData)- 1 do // Iterate begin vPostData[iLoop]:= Ord(stPostData[iLoop+ 1]); end; // for {Final terminating Character.} vPostData[Length(stPostData)]:= 0; {Set the type of Variant, cast} TVarData(vPostData).vType:= varArray; end; {And the other stuff.} vWebAddr:= stURL; {Make the call Rex.} wbEmbeddedWB.Navigate2(vWebAddr, vFlags, vFrame, vPostData, vHeaders);end; {End of Navigate procedure.} This tip provided by Craig Foley based on techniques from Nathan Wilhelmi's Usenet posting to borland.public.delphi.internet on the 31/1/99 A: Here's another option: procedure TForm1.SubmitPostForm;var strPostData: string; Data: Pointer; URL, Flags, TargetFrameName, PostData, Headers: OleVariant;begin { <!-- submit this html form: --> <form method="post" action="http://127.0.0.1/cgi-bin/register.pl"> <input type="text" name="FIRSTNAME" value="Hans"> <input type="text" name="LASTNAME" value="Gulo"> <input type="text" name="NOTE" value="thats it"> <input type="submit"> </form> } strPostData := 'FIRSTNAME=Hans&LASTNAME=Gulo&NOTE=thats+it'; PostData := VarArrayCreate([0, Length(strPostData) - 1], varByte); Data := VarArrayLock(PostData); try Move(strPostData[1], Data^, Length(strPostData)); finally VarArrayUnlock(PostData); end; URL := 'http://127.0.0.1/cgi-bin/register.pl'; Flags := EmptyParam; TargetFrameName := EmptyParam; Headers := EmptyParam; // TEmbeddedWB will see that we are providing // post data and then should automatically fill // this Headers with appropriate value EmbeddedWB1.Navigate2(URL, Flags, TargetFrameName, PostData, Headers);end; This tip provided by Hans Gulo.
browsing on special folders—such as Desktop and My Computer: Procedure NavigatePidl(pidl : PItemIdList);
Refresh2: (ByBorland) Call Refresh2 to reload the current document. Unlike theRefreshmethod, Refresh2 lets you specify what level of refresh to perform. Level indicates what type of information is refreshed. The following table lists the possible values:
When Level is omitted, a value of REFRESH_COMPLETELY is assumed.
This procedure is added to make it possible to TAB the way to the content of the EmbeddedWB . It is also useful for functions, that need to have the focus set on the document in EmbeddedWB (ex. see OnShowHelp). function HtmlHelp; API call to make it easy to implement Help-file in the EmbeddedWB application. (see OnShowHelp). Opens a blank page in EmbeddedWB-control if document is unassigned. Used in LoadFromStrings and LoadFromStream. function LoadFromStrings(aStrings : TStrings) : HRESULT;
Register the temporary namespacehandler clsid. There seems to be a unconfirmed bug in IInternetProtocol.RegisterNameSpace, so namespace-patterns cannot be added. Instead you can add your namespace in function "Start" in your namespacehandler-object:
function UnregisterNameSpace : HRESULT; function RegisterMIMEFilter(clsid: TGUID; MIME : PWideChar) : HRESULT;
Zoom: The following lines of code are all you need to add a textsize menu to your application, similar to the one in Internet Explorer. Create 5 Menuitems: Smallest, Small, Medium, Larger, Largest.
|
最后修改:2009 年 08 月 16 日
© 允许规范转载