[fpc-pascal]Missing Win32 API Function -- Part 2
Michał Bartoszkiewicz
embe at magma-net.pl
Thu Aug 8 20:16:02 CEST 2002
James_Wilson at i2.com <James_Wilson at i2.com> wrote:
> Now, I've run into a number of compatibility issues with these 3 compilers
> before, so a glitch between what works for one and what works for another
> isn't uncommon, but this discrepancy seems to be different. Any ideas what
> I'm doing wrong here?
1. You call Unicode version of the function - you probably want to call
EnumPrintersA
2. You call the function from wrong library - correct is 'winspool.dll'
3. You call the function with invalid calling convention - you should
use 'stdcall' for API functions
4. API functions don't return Booleans but Bools
The correct declaration would be:
Function EnumPrinters (Flags: dword; Name: pchar; Level: dword; pPrinterEnum: pointer;
cbBuf: dword; var pcbNeeded, pcReturned: dword): bool; stdcall;
external 'winspool' name 'EnumPrintersA';
--
__ ______________________________________________________________
| \/ | Michał Bartoszkiewicz <embe at magma-net.pl> | _ )
| |\/| | GG:2298240 ICQ:63168292 | _ \
|_| |_|_____Keyboard not detected. Press F1 to continue.______|___/
More information about the fpc-pascal
mailing list