© J.C. Kessels 2009
MyDefrag Forum
May 25, 2013, 01:22:35 am
Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News
:
Home
Help
Search
Login
Register
MyDefrag Forum
>
JkDefrag v3 Forum
>
Programming with the library
>
defragdll in delphi error
Pages: [
1
]
« previous
next »
Print
Author
Topic: defragdll in delphi error (Read 3131 times)
delphino
Newbie
Posts: 1
defragdll in delphi error
«
on:
May 18, 2007, 12:39:23 am »
delphino2006 a écrit :
Salut...,
j'utilise une dll ecrite en C++,dans delphi,
type
charp=^char;
var
Form1: TForm;
const
NomDLL = 'DefragDll.dll';
//1° - declaration static:
Function RunDefrag(MountPoint : pchar;Mode:integer):integer;cdecl; external 'DefragDll.dll' name 'RunDefrag';
implementation
{$R *.dfm}
function LierFonction(DLL: String; var HandleDLL: THandle; NomFct: String; IndexFct: Integer = -1): Pointer;
begin
Result := nil;
HandleDLL := 0;
HandleDLL := LoadLibrary(pAnsiChar(DLL));
If HandleDLL = 0 then
Exit;
If IndexFct < 0 then
Result := GetProcAddress(HandleDLL, pAnsiChar(NomFct))
else
Result := GetProcAddress(HandleDLL, pAnsiChar(IndexFct));
end;
2° -declaration denamique.
procedure TForm1.Button1Click(Sender: TObject);
var HandleDLL: THandle;
RunDefrag : function(MountPoint:charp;Mode:integer):integer;cdecl ; //Notre fonction, sous forme de variable.
begin
RunDefrag := LierFonction(NomDLL, HandleDLL, 'RunDefrag');
If assigned(RunDefrag) then
begin
RunDefrag(nil,1);
FreeLibrary(HandleDLL);
end
else
ShowMessage('Erreur de chargement de la fonction "rundefrag"');
end;
//----------------------
//Static procedure .....
procedure TForm1.Button2Click(Sender: TObject);
begin
RunDefrag(nil,1);
end;
mais toujour rien erreur de compilation ;
Logged
Pages: [
1
]
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
MyDefrag v4 Forum
-----------------------------
=> Announcements
=> Questions and help
=> Bugs and problems
=> Requests for new features
=> Scripts, and other contributions
-----------------------------
JkDefrag v3 Forum
-----------------------------
=> Announcements
=> Questions and help
=> Bugs and problems
=> Requests for new features
=> Programming with the library
Loading...