[fpc-pascal]Linking to Windows

Anton Tichawa anton.tichawa at chello.at
Thu Feb 6 15:28:12 CET 2003


Hello, Hans!

You may use the GetProcAddress (Win32 API function) to retrieve the 
procedure's START-ADDRESS, wehre the input parameter is EITHER an index, I 
think of limited size, OR a name, that must be SPELLED CORRECTLY.

If you try both, and look for MATCHING ADDRESSES, you should be able to get 
all (?) you need.

The function's interface is:

GetProcAddress returns address of specified DLL functions:

FARPROC GetProcAddress(HMODULE hModule, LPCSTR lpProcName);

hModule = handle returned by LoadLibrary or GetModuleHandle

lpProcName

Either hi-word = 0 and lo-word = index; or ASCIIZ string

returns: 0 = error (call GetLastError); else address of DLL function

Hope this Helps.

Anton Tichawa.


On Wednesday 05 February 2003 15:58, you wrote:
> At 19:10 04-02-2003 -0500, you wrote:
> >You can get the SDK help files from Borland:
> >
> >ftp://ftp.borland.com/pub/delphi/techpubs/delphi3/d3ms.zip
> >
> >Be warned, this is a 15M download.
> >
> >Rolf Grunsky
>
> Thank you for the link, but I have allready got these help files allthough
> in an older version, and they don't include the information of DLL names
> and indices.
>
> My problem is that I want to use some win32 functions that are not included
> in the FreePascal Windows unit, e. g. OpenPrinter or SetPrinter. According
> to the FreePascal Programmers' manual (ch. 4.1) the easyist way to do this
> is  declaring an external procedure. But then you have to know the name of
> the DLL and the index where the function resides. The Borland help files
> have all the information of the win32 functions except in which DLLs they
> resides.
>
> Hans M.
>
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal

-- 

----------

"Adas Methode war, wie sich zeigen wird, Tagträume in offenbar korrekte 
Berechnungen einzuweben."

Doris Langley Moore: Ada, Countess of Lovelace (London 1977).

----------

Anton Tichawa
Volkertstrasse 19 / 20
A-1020 Wien
mobil: +43 664 52 07 907
email: anton.tichawa at chello.at

----------



More information about the fpc-pascal mailing list