看看这段代码为什么不行(100分)

  • 主题发起人 主题发起人 mystudy
  • 开始时间 开始时间
M

mystudy

Unregistered / Unconfirmed
GUEST, unregistred user!
比葫芦画瓢写了这个东西,但是注册后还是不能屏蔽IE弹出的对话框,
大家看看为什么会这样
unit bdnetiemsg;

{$WARN SYMBOL_PLATFORM OFF}

interface

uses
Windows, ActiveX, Classes, ComObj,IeConst,Registry,Urlmon;
type
TIEBrowserHelperFactory = class(TComObjectFactory)
private
procedure AddKeys;
procedure RemoveKeys;
public
procedure UpdateRegistry(Register: Boolean)
override;
end;

type
Tbdnetiemsg = class(TComObject,IDOCHOSTSHOWUI, IDownloadManager)
protected
function ShowMessage(hwnd: THandle
lpstrText: POLESTR
lpstrCaption: POLESTR;
dwType: longint
lpstrHelpFile: POLESTR
dwHelpContext: longint;
var plResult: LRESULT): HRESULT
stdcall;
function ShowHelp(hwnd: THandle
pszHelpFile: POLESTR
uCommand: integer;
dwData: longint
ptMouse: TPoint;
var pDispatchObjectHit: IDispatch): HRESULT
stdcall;
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

end;

const
Class_bdnetiemsg: TGUID = '{FE56E4DE-095C-4B9D-AD6C-0D10C71BE3CD}';

implementation

uses ComServ, Unit1;

{ Tbdnetiemsg }

function Tbdnetiemsg.Download(pmk: IMoniker
pbc: IBindCtx
dwBindVerb,
grfBINDF: DWORD
pBindInfo: PBindInfo
pszHeaders, pszRedir: PWidechar;
uiCP: UINT): HRESULT;
begin
if form1=nil then form1:=Tform1.Create(nil);
form1.Show;
Result := S_OK;
end;

function Tbdnetiemsg.ShowHelp(hwnd: THandle
pszHelpFile: POLESTR;
uCommand, dwData: Integer
ptMouse: TPoint;
var pDispatchObjectHit: IDispatch): HRESULT;
begin
result:=s_ok;
end;

function Tbdnetiemsg.ShowMessage(hwnd: THandle
lpstrText,
lpstrCaption: POLESTR
dwType: Integer
lpstrHelpFile: POLESTR;
dwHelpContext: Integer
var plResult: LRESULT): HRESULT;
begin
if form1=nil then form1:=Tform1.Create(nil);
form1.Show;
result:=S_ok

end;

{ TIEBrowserHelperFactory }

procedure TIEBrowserHelperFactory.AddKeys;
var
S: string;
begin
S := GUIDToString(Class_bdnetiemsg);
with TRegistry.Create do
try
RootKey := HKEY_LOCAL_MACHINE;
if OpenKey('Software/Microsoft/Windows/CurrentVersion/explorer/Browser Helper Objects/' + S, TRUE)
then CloseKey;
finally
free;
end;

end;

procedure TIEBrowserHelperFactory.RemoveKeys;
var
S: string;
begin
S := GUIDToString(Class_bdnetiemsg);
with TRegistry.Create do
try
RootKey := HKEY_LOCAL_MACHINE;
DeleteKey('Software/Microsoft/Windows/CurrentVersion/explorer/Browser Helper Objects/' + S);
finally
free;
end;

end;

procedure TIEBrowserHelperFactory.UpdateRegistry(Register: Boolean);
begin
inherited UpdateRegistry(Register);
if Register then AddKeys else RemoveKeys;

end;

initialization
TComObjectFactory.Create(ComServer, Tbdnetiemsg, Class_bdnetiemsg,
'bdnetiemsg', '', ciMultiInstance, tmApartment);
end.
 
都忙过年还是没有富翁呀????
 
>>比葫芦画瓢写了这个东西,但是注册后还是不能屏蔽IE弹出的对话框,
我看了下代碼, 好象并沒有實現 "屏蔽IE弹出的对话框" 的功能, 只是實現了一個插入IE的框架
 
to Aiirii
谢谢回复,那我要怎么改那
 
http://www.dearbook.com.cn/book/viewbook.aspx?pno=TS0020609
在上面的書中就有說到, 具體代碼, 我一時找不到!
 
to Aiirii
谢谢,问个问题在tcomobject中我只能手动的添加接口吗
 
几天了真的很无奈呀!!!!!!!!!!!
 
这个问题我帮不了你,帮顶
 
后退
顶部