Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to call GetDialogBaseUnits API from VFP
Message
From
22/09/2006 10:33:45
 
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01155826
Message ID:
01156439
Views:
82
>How do I call these two API functions GetDialogBaseUnits and MapDialogRect in VFP. I'm trying to get the convert dialog units into pixels using the following formula:
>
>pixelx = (dialogunitX * baseuntX) /4
>pixely = (dialogunitY * baseuntY) /8
>
>I need to calculate the baseunitX and baseunitY. I have readup and found that these two functions should give me the values to the two variables. Or is there another way to get these values from within VFP
>
>Thanks in advance.

Hi Stuart,

I'm not quite sure with your question. GetDialogBaseUnits already gives you the X and Y of the BaseUnit.
Anyway, Here is the sample call
** Using GetDialogBaseUnits
nBaseUnits = GetDialogBaseUnits()
nBaseUnitX = BitAnd( nBaseUnits, 0xFFFF )
nBaseUnitY = BitRShift( BitAnd( nBaseUnits, 0xFFFF0000 ), 16 )

** Using MapDialogRect
sRect = space( 16 )
SetRect( @sRect, nLeft, nTop, nRight, nBottom )

** hDialog is Handle to a Dialog Window. Or else it fails or worst...CRASHED!
MapDialogRect( hDialog, @sRect )
** Convert back sRect structure to nLeft, nTop, nRight, nBottom
Sorry if I'm wrong. But, perhaps, you are looking for the wrong solution there. Because it only works for "Dialog Window". AFAIK, all VFP form is NOT Dialog Window.

Regards
Herman
Previous
Reply
Map
View

Click here to load this message in the networking platform