problem closing DLL load direct And indirect - solved - finished
"rizky" <[email protected]> Wed, 6 Aug 2003 15:10:05 +0700
| Newsgroups | gmane.comp.lang.delphi.jedi,gmane.comp.lang.delphi.programming |
|---|---|
| Message-ID | <!~!UENERkVCMDkAAQACAAAAAAAAAAAAAAAAABgAAAAAAAAAYmQ7wwSlbkWa9nZkbLYY8sKAAAAQAAAADPWKa8tEDEieNh1gTUCRvQEAAAAA@sierad.co.id> |
The Problem is in the strPcopy and my variable when something to do with
assigning memory, (Thanks to Klaus Gerding...).
For All the member that participating thanks a lot for your time and
ideas, I hope this can help other programmers to understand more about
dll as its help me
Thank You Guys Keep On Rockin \m/ And Peace ...
Present Code :
procedure TfrmMain.Button1Click(Sender: TObject);
var
lhandle : tHandle;
sForm:tShowForm;
begin
if cbListModule.Text <> '' then
begin
lHandle:=LoadLibrary(PChar(cbListModule.Text+'.dll'));
//Changing Here
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;
-----Original Message-----
From: Klaus Gerding [mailto:[email protected]]
Sent: Wednesday, August 06, 2003 2:15 PM
To: [email protected]
Subject: Re: [Delphi-JEDI] problem closing DLL load direct And indirect
your command
cDll := StrPCopy(cDll,cbListModule.Text+'.dll'); //get DLL
copies text to an pchar. but there is no memory behind this pointer!
help description from delphi
StrPCopy copies a Pascal-type string Source into a null-terminated
string Dest. It returns a pointer to Dest.
StrPCopy does not perform any length checking.
bye,
klaus
The destination buffer must have room for at least Length(Source)+1
characters.
rizky schrieb:
>
> 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]
>
>
> To unsubscribe from this group, send an email to:
> [email protected]
>
>
>
> Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/
Yahoo! Groups Sponsor
<http://rd.yahoo.com/M=259395.3614674.4902533.1261774/D=egroupweb/S=1705
115362:HM/A=1524963/R=0/SIG=12o885gmo/*http://hits.411web.com/cgi-bin/au
toredir?camp=556&lineid=3614674&prop=egroupweb&pos=HM>
<http://us.adserver.yahoo.com/l?M=259395.3614674.4902533.1261774/D=egrou
pmail/S=:HM/A=1524963/rand=766269274>
To unsubscribe from this group, send an email to:
[email protected]
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service
<http://docs.yahoo.com/info/terms/> .
[Non-text portions of this message have been removed]
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Rent DVDs from home.
Over 14,500 titles. Free Shipping
& No Late Fees. Try Netflix for FREE!
http://us.click.yahoo.com/BVVfoB/hP.FAA/ySSFAA/i7folB/TM
---------------------------------------------------------------------~->
To unsubscribe from this group, send an email to:
[email protected]
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/