请高手看看我的程序为什么不对啊!!(100分)

L

lsc0530

Unregistered / Unconfirmed
GUEST, unregistred user!
我照书敲的程序可是总是报以下错误
[Error] Unit1.pas(17): Declaration of 'CopyCallback' differs from declaration in interface 'ICopyHookA'
请那为给个答案 谢了

library Project2;

uses
ComServ,
Unit1 in 'Unit1.pas';

exports
DllGetClassObject,
DllCanUnloadNow,
DllRegisterServer,
DllUnregisterServer;

{$R *.RES}

begin
end.

unit Unit1;
interface
uses
Windows,Messages,ComObj,ComServ,SysUtils,Classes,Graphics,Controls,Forms,Dialogs,shellapi,shlobj,ActiveX;

const
CLSID_PascalcopHook:TGUID='{80A06FA0-7df2-11D0-98D0-444553540000}';


type
TpasCopyHooK=class(TComObject,ICopyHook)
public
function CopyCallback(Hwnd:THandle;wFunc,
wFlags:UINT;pszSrcFile:pAnsiChar;dwSrcAttribs:DWORD;
pszDestFile:pAnsiChar;dwDestAttribs:DWORD):UINT;stdcall;
end;

type
ICopyHookA=interface(IUnKnown)
function CopyCallback(Wnd:Hwnd;wFunc,
wFlags:UINT;pszSrcFile:pAnsiChar;dwSrcAttribs:DWORD;
pszDestFile:pAnsiChar;dwDestAttribs:DWORD):UINT;
end;
ICopyHook=ICopyHookA;


implementation
function TpasCopyHooK.CopyCallback(Hwnd:THandle;wFunc,wFlags:UINT;pszSrcFile:pAnsiChar;dwSrcAttribs:DWORD;pszDestFile:pAnsiChar;dwDestAttribs:DWORD):UINT;stdcall;
var
Msg:string;
MessType:TMsgDlgType;
begin
Application.Handle:=Hwnd;
Msg:='';
MessType:=mtconfirmation;
case wFunc of
FO_COPY:
begin
Msg:=Format('Are yopu sure you want to copy the %s'+'folder to the %s destination ',[PszSrcFile,pszDestFile]);
end;
FO_DELETE:
begin
Msg:=Format('Are yopu sure you want to del the %s',[PszSrcFile,pszDestFile]);
end;
end;
if msg<>'' then
result:=messageDlg(Msg,MessType,mbYesNoCancel,0 )
else
result:=id_Yes;
end;
initialization
TComObjectFactory.Create(comserver,TPasCopyHook,CLSID_PascalcopHook,'PasalCopyHook','CopyHook Demo from Mastering Delphi 3',ciMultiInstance);


end.
 
unit Unit1;
interface
uses
Windows,Messages,ComObj,ComServ,SysUtils,Classes,Graphics,Controls,Forms,Dialogs,shellapi,shlobj,ActiveX;

const
CLSID_PascalcopHook:TGUID='{80A06FA0-7df2-11D0-98D0-444553540000}';

type
ICopyHookA=interface(IUnKnown)
function CopyCallback(Hwnd:THandle;wFunc, wFlags:UINT;pszSrcFile:pAnsiChar;dwSrcAttribs:DWORD;
pszDestFile:pAnsiChar;dwDestAttribs:DWORD):UINT; stdcall;
end;
ICopyHook=ICopyHookA;


type
TpasCopyHooK=class(TComObject,ICopyHook)
public
function CopyCallback(Hwnd:THandle;wFunc, wFlags:UINT;pszSrcFile:pAnsiChar;dwSrcAttribs:DWORD;
pszDestFile:pAnsiChar;dwDestAttribs:DWORD):UINT; stdcall;
end;


implementation
function TpasCopyHooK.CopyCallback(HWnd:THandle;wFunc,wFlags:UINT;pszSrcFile:pAnsiChar;dwSrcAttribs:DWORD;pszDestFile:pAnsiChar;dwDestAttribs:DWORD):UINT;
var
Msg:string;
MessType:TMsgDlgType;
begin
Application.Handle:=Hwnd;
Msg:='';
MessType:=mtconfirmation;
case wFunc of
FO_COPY:
begin
Msg:=Format('Are yopu sure you want to copy the %s'+'folder to the %s destination ',[PszSrcFile,pszDestFile]);
end;
FO_DELETE:
begin
Msg:=Format('Are yopu sure you want to del the %s',[PszSrcFile,pszDestFile]);
end;
end;
if msg<>'' then
result:=messageDlg(Msg,MessType,mbYesNoCancel,0 )
else
result:=id_Yes;
end;
initialization
TComObjectFactory.Create(comserver,TPasCopyHook,CLSID_PascalcopHook,'PasalCopyHook','CopyHook Demo from Mastering Delphi 3',ciMultiInstance);


end.
 
接受答案了.
 
能告诉我为什么要换位置吗?
 
顶部