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

Delphi Bug? DeviceCapabilities??

125 views
Skip to first unread message

Adrian Chapman

unread,
Feb 16, 1998, 3:00:00 AM2/16/98
to

I was trying to use the Windows API function Device Capabilities in order to
determine the list of paper types and sizes that are available to a
particular printer. (Similar to the Printer Options dialog available in
windows NT).

The reason for this is I will be accessing a printer with multi-stationary
types loaded and I want to be able to select the correct stationary for
different printed reports.

I was going to use the above function to determine the paper options, it is
declared in the Windows.pas source file as:
function DeviceCapabilitiesEx(pDriverName, pDeviceName, pPort: PChar;
iIndex: Integer; pOutput: PChar; DevMode: PDeviceMode): Integer; stdcall;

I tried to run an application using this function but the following error
occurred :
Unable to get entry point in gdi32.DLL.

I checked the Delphi source and 'Quick Viewed' the DLL and noticed that
Delphi was declaring an external function 'DeviceCapabilitiesA' from
gdi32.DLL, whereas the DLL itself was exporting the function name as
'DeviceCapabilitiesExA'.

So I've had to re-declare the function local to my application.

Is this a known problem?

Jason Terando

unread,
Feb 16, 1998, 3:00:00 AM2/16/98
to Adrian Chapman

I ran into this myself, and what it appears to be is that Windows included the
DeviceCapabilitiesEx function in the GDI32 which was designed to replace the
DeviceCapabilities found in the print spooler. I guess Borland fixed their
headers in 3.0, but us 2.0 guys have to do the following.

interface

{$IFDEF Win32}
function DeviceCapabilitiesA(pDevice, pPort: PAnsiChar; fwCapability: Word;
pOutput: PAnsiChar; DevMode: PDeviceModeA): Integer; stdcall;
function DeviceCapabilitiesW(pDevice, pPort: PWideChar; fwCapability: Word;
pOutput: PWideChar; DevMode: PDeviceModeW): Integer; stdcall;
function DeviceCapabilities(pDevice, pPort: PChar; fwCapability: Word;


pOutput: PChar; DevMode: PDeviceMode): Integer; stdcall;

{$ENDIF}

implementation

{$IFDEF Win32}
function DeviceCapabilitiesA; external winspl name 'DeviceCapabilitiesA';
function DeviceCapabilitiesW; external winspl name 'DeviceCapabilitiesW';
function DeviceCapabilities; external winspl name 'DeviceCapabilitiesA';
{$ENDIF}


Best Regards,
Jason

Peter Below

unread,
Feb 16, 1998, 3:00:00 AM2/16/98
to

In article <6c9985$mr...@forums.borland.com>, Adrian Chapman wrote:
> Is this a known problem?
>
Yes, i reported it a while ago. Use DeviceCapabilities from the WinSpool
unit. The "Ex" functions are just an indirect reference to the WinSpool
functions.

Peter Below (TeamB) 10011...@compuserve.com)


0 new messages