Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

example of using LoadLibrary in delphi

1,529 views
Skip to first unread message

Jonathan Wilson

unread,
Jun 8, 2004, 10:32:57 AM6/8/04
to
Is there an example somewhere of the right way to use LoadLibrary,
GetProcAddress etc in delphi (including calling the function you have
gotten the address of)

Rob Kennedy

unread,
Jun 8, 2004, 11:57:30 AM6/8/04
to

Look at the TlHelp32 unit that comes with Delphi.

--
Rob

Mustits

unread,
Jun 9, 2004, 3:48:11 AM6/9/04
to
Jonathan Wilson <jon...@tpgi.com.au> wrote in message news:<40c5cdfd$1...@dnews.tpgi.com.au>...

> Is there an example somewhere of the right way to use LoadLibrary,
> GetProcAddress etc in delphi (including calling the function you have
> gotten the address of)

uses Windows;

type
TMessageBoxAFunc = function (hWnd: HWND; lpText, lpCaption:
PAnsiChar; uType: UINT): Integer; stdcall;

procedure TMainForm.TestBtnClick(Sender: TObject);
var
Handle: THandle;
Func: TMessageBoxAFunc;
begin
Handle := LoadLibrary('user32.dll');
try
Func := GetProcAddress(Handle, 'MessageBoxA');
Func(0, 'test', 'test', MB_OK);
finally
FreeLibrary(Handle);
end;
end;

0 new messages