Microsoft KB Archive/96539

= FOXTOOLS.FLL Calls to GetDC, GetDeviceCaps and ReleaseDC =

Article ID: 96539

Article Last Modified on 11/17/2003

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0 Standard Edition
 * Microsoft FoxPro 2.6 Standard Edition
 * Microsoft FoxPro 2.6a Standard Edition

-



This article was previously published under Q96539



SUMMARY
The code below demonstrates how to use the FOXTOOLS.FLL library commands to call the following Microsoft Windows application programming interface (API) functions: GetDC GetDeviceCaps ReleaseDC



MORE INFORMATION
The program first loads the FOXTOOLS.FLL library that is supplied with FoxPro for Windows and creates some variables. It then retrieves the handle to the display device and calls the GetDeviceCaps function. Next, it displays the width and height of the physical display in millimeters in two consecutive windows that can be seen by clicking the left mouse button. Finally, it releases the handle to the device context and the library. set library to sys(2004)+&quot;foxtools.fll&quot; additive

* create variables to pass index to GetDeviceCaps * these values are found in the WINDOWS.H file

HORZSIZE = 4 VERTSIZE = 6

* get the handle to the device context

gethdc = RegFN(&quot;GetDC&quot;,&quot;I&quot;,&quot;I&quot;) hdc = CallFN(gethdc,0)

* get the screen size in millimeters

getsize = RegFN(&quot;GetDeviceCaps&quot;,&quot;II&quot;,&quot;I&quot;) Hsize = CallFN(getsize,hdc,HORZSIZE) Vsize = CallFN(getsize,hdc,VERTSIZE)

* display the results in two windows

wait window &quot;Width is: &quot; + alltrim(str(Hsize)) + &quot; mm&quot; wait window &quot;Height is: &quot; + alltrim(str(Vsize)) + &quot; mm&quot;

* release the handle to the device context

releasehdc = RegFN(&quot;ReleaseDC&quot;,&quot;II&quot;,&quot;I&quot;) = CallFN(releasehdc,0,hdc)

release library sys(2004)+&quot;foxtools.fll&quot;

