[[https://www.revelation.com/|Sign up on the Revelation Software website to have access to the most current content, and to be able to ask questions and get answers from the Revelation community]]
==== Using GetDeviceCaps in GDI32 (OpenInsight 32-bit Specific) ====
=== At 25 APR 2005 04:59:20AM Brian Scarth wrote: ===
{{tag>"OpenInsight 32-bit Specific"}}
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?
[url=http://www.sprezzatura.com]The Sprezzatura Group[/url]
[i]World leaders in all things RevSoft[/i]
[img]http://www.sprezzatura.com/zz.gif[/img]
----
=== 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 [url=http://www.srpcs.com/articles/DLL_Parameter_Types_in_OpenInsight.pdf]here[/url].
[url=http://www.sprezzatura.com]The Sprezzatura Group[/url]
[i]World leaders in all things RevSoft[/i]
[img]http://www.sprezzatura.com/zz.gif[/img]
----
=== 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
[[https://www.revelation.com/revweb/oecgi4p.php/O4W_HANDOFF?DESTN=O4W_RUN_FORM&INQID=NONWORKS_READ&SUMMARY=1&KEY=769A12756AB98C1D85256FEE003160B4|View this thread on the forum...]]