RE: Execute a DLL function

Kiran <[email protected]>
Newsgroups gmane.comp.lang.delphi.programming
Message-ID <31A8B0E01204D51197B10050BA8D970D173783@BHAVYA>
here is the sample code... hope this works..

procedure myprocedure;
var
myFunc : Function (param1: String; param2: Integer): Boolean; stdcall;
hlib : Handle;
begin
	hlib := LoadLibrary('mylib.dll');
	if (hlib <> 0) then
	begin
		myFunc := GetProcAddress(hlib,'FunctionName');
		if (@myFunc <> nil)
		begin
			// call your function..
			if myFunc( with param1, and param2 values) then
				Showmessage('function executed succesfully')
			else	Showmessage('function returned false');
		end;
		FreeLibrary(hlib);
	end;
end;

regards,
Kiran Kurapaty.

-----Original Message-----
From: davidmuinos [mailto:[email protected]]
Sent: Tuesday, August 05, 2003 6:21 PM
To: [email protected]
Subject: [Delphi] Execute a DLL function

HI guys, I'd like to execute a function of my DLL in my application.

I've already found two functions in Windows SDK : LoadLibrary and
GetProcAddress. They worked, got the Address of my DLL's function  ,
but how can i execute it ?
One more thing : the DLL's function has parameters.

Thanks very much.


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/








------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for Your HP, Epson, Canon or Lexmark
Printer at Myinks.com. Free s/h on orders $50 or more to the US & Canada. http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/sO0ANB/LIdGAA/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/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.