Problem closing DLL load direct And indirect
"rizky" <[email protected]>
| Newsgroups | gmane.comp.lang.delphi.programming |
|---|---|
| Message-ID | <!~!UENERkVCMDkAAQACAAAAAAAAAAAAAAAAABgAAAAAAAAAYmQ7wwSlbkWa9nZkbLYY8sKAAAAQAAAAcyh/[email protected]> |
I have a problem when closing dll form which is load indirect (list
01)...the error message EAccessviolation keep appear when i click the
close window button (x) or use the ' form.close ' syntax...but if i load
the dll directly(list 02) the problem doesn't appear....So whats the
different between that two method ?, which one should i use best ?, is
there any other technique that i can use ?, and how can i get out from
the error message if i want to use the indirect technique ?
thanks a bunch guys....i really appriciate any help and suggestion that
given to this message...
list 01 :
procedure TfrmMain.Button1Click(Sender: TObject);
var
lhandle : tHandle;
sForm:tShowForm;
cDll:pChar;
begin
if cbListModule.Text <> '' then
begin
cDll := StrPCopy(cDll,cbListModule.Text+'.dll'); //get DLL
Name from combobox
lHandle:=LoadLibrary(cDll); // Load DLL indirect
try
if lHandle = 0 then
raise eDllLoadError.create('Dll Tidak Ada');
@sForm:= GetProcAddress(lhandle,'ShowForm');
if not (@sform = nil) then
begin
showform;
end
else
RaiseLastWin32Error;
finally
FreeLibrary(lhandle);
end;
end;
end;
list 02 :
procedure TfrmMain.Button1Click(Sender: TObject);
var
lhandle : tHandle;
sForm:tShowForm;
cDll:pChar;
begin
if cbListModule.Text <> '' then
begin
lHandle:=LoadLibrary('RekapPertumbuhanAngkatan.dll'); // Load
DLL Direct
try
if lHandle = 0 then
raise eDllLoadError.create('Dll Tidak Ada');
@sForm:= GetProcAddress(lhandle,'ShowForm');
if not (@sform = nil) then
begin
showform;
end
else
RaiseLastWin32Error;
finally
FreeLibrary(lhandle);
end;
end;
end;
Richness Is Not Measure By How Much You Have...
But How Less You Need....
RichKey
[Non-text portions of this message have been removed]
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Free shipping on all inkjet cartridge & refill kit orders to US & Canada. Low prices up to 80% off. We have your brand: HP, Epson, Lexmark & more.
http://www.c1tracking.com/l.asp?cid=5510
http://us.click.yahoo.com/GHXcIA/n.WGAA/ySSFAA/i7folB/TM
---------------------------------------------------------------------~->
CodeCoffer - new Delphi code protection Tool!
http://www.delphicollection.com/public/CodeCoffer.htm
---------------------------------------------------------------
Unsubscribe:[email protected]
List owner:[email protected]
---------------------------------------------------------------
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/