Thanks guys, I'm now at least in motion.
>>Folks,
>>
>>Having trouble declaring API functions, in particular printer functions.
>>
>>First, GetDefaultPrinter is supposed to have a boolean return, but DECLARE DLL does not support keywords BOOLEAN or LOGICAL. I have been using SHORT on the assumption that a C logical is actually an integer.
>>
>>Second, I cannot figure how to translate MSDN's libraries into the actual "IN..." clause of the Declare DLL command. For instance, GetDefaultPrinter is supposed to be in library Winspool.lib, but:
>>
>>If I try DECLARE SHORT GetDefaultPrinter In Winspool I get "Cannot open 32-bit library Winspool". Same for "...in Winspool.lib" and "...in Winspool.dll"
>>
>>If I try Win32api, the declaration fails with "Cannot find entry point..."
>>
>>If I try User32.dll it will accept the declaration, but fail on the call with "Cannot find entry point..."
>>
>>Have been very careful about case throughout.
>>
>>Any help much appreciated
>
>This works in Win2K and beyond (not NT/9X/ME):
>local lcbuff, lnbuff
>lcbuff = replicate(chr(0),255)
>lnbuff = 255
>declare integer GetDefaultPrinter in winspool.drv string@, integer@
>if GetDefaultPrinter(@lcbuff,@lnbuff) > 0 then
> ? left(lcbuff,lnbuff)
>endif
>
>HTH.