还
还是朋友
Unregistered / Unconfirmed
GUEST, unregistred user!
要弹出自己的对话框,不要IE的那个保存文件的对话框。
只知道IE提供了一个IDownloadManager接口,要实现它。
大家帮帮忙。
unit NewWebBrowser;
interface
uses
{$IFDEF VER140}Variants,{$ENDIF} ActiveX, IEConst, Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, OleCtrls, EmbeddedWB, SHDocVw_EWB, EwbAcc, UrlMon, IEAddress,
ExtCtrls, EwbCore, SHDocVw;
type
TNewWebBrowser = class(TWebBrowser)
protected
procedure DoQueryService(const rsid, iid: TGUID; out Obj); virtual;
public
function Download(
pmk: IMoniker; // Identifies the object to be downloaded
pbc: IBindCtx; // Stores information used by the moniker to bind
dwBindVerb: DWORD; // The action to be performed during the bind
grfBINDF: DWORD; // Determines the use of URL encoding during the bind
pBindInfo: PBindInfo; // Used to implement IBindStatusCallback::GetBindInfo
pszHeaders: PWidechar; // Additional headers to use with IHttpNegotiate
pszRedir: PWidechar; // The URL that the moniker is redirected to
uiCP: UINT // The code page of the object's display name
): HRESULT; stdcall;
function QueryService(const rsid, iid: TGUID; out Obj): HRESULT; stdcall;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('Samples', [TNewWebBrowser]);
end;
{ TNewWebBrowser }
procedure TNewWebBrowser.DoQueryService(const rsid, iid: TGUID; out Obj);
begin
if IsEqualGuid(rsid, IID_IDownloadManager) then
IUnknown(Obj) := Self as IDownloadManager;
end;
function TNewWebBrowser.Download(pmk: IMoniker; pbc: IBindCtx; dwBindVerb,
grfBINDF: DWORD; pBindInfo: PBindInfo; pszHeaders, pszRedir: PWidechar;
uiCP: UINT): HRESULT;
begin
ShowMessage('Download');
end;
function TNewWebBrowser.QueryService(const rsid, iid: TGUID;
out Obj): HRESULT;
begin
Pointer(Obj) := nil;
DoQueryService(rsid, iid, Obj);
if Pointer(Obj) <> nil then
Result := S_OK;
end;
end.
只知道IE提供了一个IDownloadManager接口,要实现它。
大家帮帮忙。
unit NewWebBrowser;
interface
uses
{$IFDEF VER140}Variants,{$ENDIF} ActiveX, IEConst, Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, OleCtrls, EmbeddedWB, SHDocVw_EWB, EwbAcc, UrlMon, IEAddress,
ExtCtrls, EwbCore, SHDocVw;
type
TNewWebBrowser = class(TWebBrowser)
protected
procedure DoQueryService(const rsid, iid: TGUID; out Obj); virtual;
public
function Download(
pmk: IMoniker; // Identifies the object to be downloaded
pbc: IBindCtx; // Stores information used by the moniker to bind
dwBindVerb: DWORD; // The action to be performed during the bind
grfBINDF: DWORD; // Determines the use of URL encoding during the bind
pBindInfo: PBindInfo; // Used to implement IBindStatusCallback::GetBindInfo
pszHeaders: PWidechar; // Additional headers to use with IHttpNegotiate
pszRedir: PWidechar; // The URL that the moniker is redirected to
uiCP: UINT // The code page of the object's display name
): HRESULT; stdcall;
function QueryService(const rsid, iid: TGUID; out Obj): HRESULT; stdcall;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('Samples', [TNewWebBrowser]);
end;
{ TNewWebBrowser }
procedure TNewWebBrowser.DoQueryService(const rsid, iid: TGUID; out Obj);
begin
if IsEqualGuid(rsid, IID_IDownloadManager) then
IUnknown(Obj) := Self as IDownloadManager;
end;
function TNewWebBrowser.Download(pmk: IMoniker; pbc: IBindCtx; dwBindVerb,
grfBINDF: DWORD; pBindInfo: PBindInfo; pszHeaders, pszRedir: PWidechar;
uiCP: UINT): HRESULT;
begin
ShowMessage('Download');
end;
function TNewWebBrowser.QueryService(const rsid, iid: TGUID;
out Obj): HRESULT;
begin
Pointer(Obj) := nil;
DoQueryService(rsid, iid, Obj);
if Pointer(Obj) <> nil then
Result := S_OK;
end;
end.