Domac said:
Hi,
I've solved my problem with SetWindowPos API function, now I have another
problem;
SetWindowPos works with pixels as argument , how to convert pixels to twips
and vice versa.
Thanks a lot!
Domac
The GetDeviceCaps function returns data about your computer's display.
This information includes the display type (plotter, raster screen, and
so forth), the size of the display, and whether the device can rotate
text 90 degrees. Take a look at the online help for a complete list of
this function's abilities.
GetDeviceCaps takes as parameters a device context and a flag indicating
the kind of information you want to retrieve. If you use the RASTERCAPS
flag, the function returns a long integer containing the sum of several
possible values.
-- Visual Basic Graphics Programming, Rod Stephens, Wiley 2000, ISBN
0-471-35599-2
Useful flags:
HORZRES Screen width in pixels
VERTRES Screen height in raster lines
LOGPIXELSX Width pixels per logical inch
LOGPIXELSY Height pixels per logical inch
pixels * inches/pixel * twips/inch = twips
twips * inches/twips * pixels/inch = pixels
(BTW, I think the DeviceCapabilities API can return a list of all
possible screen resolutions for the video adapter.)
twips/inch = 1440
inches/twips = 1 / 1440
GetDeviceCaps should be able to get you the inches/pixel in each
direction to get the last number needed for this conversion.
Sample declaration:
Private Declare Function GetDeviceCaps Lib "gdi32.dll" (ByVal hdc As
Long, ByVal nIndex As Long) As Long
I think GetDeviceCaps is available on all 32-bit windows OS's. I'm not
sure if there's an easier way to do this.
James A. Fortune
(e-mail address removed)
Disclaimer: I'm not responsible if using an API function causes your
computer to crash, so please verify these statements for yourself before
using the GetDeviceCaps or DeviceCapabilities API functions.