Using GetDeviceCaps in GDI32 (OpenInsight 32-bit Specific)
At 25 APR 2005 04:59:20AM Brian Scarth wrote:
I am upgrading from OI 16-bit to OI 32-bit (7.1) and having problems with GetDeviceCaps in GDI32.DLL
I have deleted the 16-bit objects from SysObj, amended the prototype record to reference GDI32, and run DECLARE_FCNS.
The debugger shows that zero is always being returned for BITSPIXEL, PLANES, HORZRES and VERTRES (12,14,8,10), and presumably any others.
Any thoughts on what I may be doing wrong would be appreciated.
At 25 APR 2005 05:08AM [url=http://www.sprezzatura.com]The Sprezzatura Group[/url] wrote:
Brian,
Can you post the prototype declaration you are using or a code example?
World leaders in all things RevSoft
At 25 APR 2005 05:47AM Brian Scarth wrote:
Prototype declaration :
GDI32
SHORT PASCAL GetDeviceCaps(SHORT, SHORT)
Usage:
Declare Function GetDeviceCaps
Declare Function GetDC
Declare Function ReleaseDC
Equ BITSPIXEL to 12
Equ NULL to ''
hDc=GetDC(NULL)
iBitsPixel=GetDeviceCaps(hDc, BITSPIXEL)
iReturn=ReleaseDC(NULL,hDc)
The debugger shows that iBitsPixel always contains zero
Many thanks
At 25 APR 2005 07:19AM [url=http://www.sprezzatura.com]The Sprezzatura Group[/url] wrote:
Brian,
You need to change your prototype declaration to:
INT PASCAL GetDeviceCaps(HANDLE, INT)
SHORT is explicitly a 16-bit integer whereas the GetDeviceCaps function wants 32 bit values, hence you need to use LONG or INT instead, both of which are 32-bit integers.
Note that LONG is an explicit 32-bit value, whereas INT is dependant on the underlying OS. If we ever get a 64-bit version of the engine then an INT value will translate to a 64-bit integer instead. Likewise with the HANDLE type which allows an OS-dependant handle declaration.
OI v4 and 7 introduced some new datatype declarations when prototyping , and although they haven't made it into the official documentation yet, you can find a list of them on SRPCS's website here.
World leaders in all things RevSoft
At 25 APR 2005 08:15AM Brian Scarth wrote:
Sprezzatura,
Have tested your suggestions and can confirm that it solved my problem.
Many thanks,
Brian Scarth