Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Calculation for size of VFP Desktop area?
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00723216
Message ID:
00723326
Views:
19
>Sorry, left out that I was using VFP 6.0 (not by personal choice).
>
>So, it's my understanding that _Screen.Height and _Screen.Width is the height and width of the window containing the VFP desktop (including title bars, menus, status bar and area for forms to appear in). I would need to subtract from that the Title Bar and Menu Bar size (38) and the Status Bar size (23, which I have turned on in my application). I don't use toolbars in this application, so that does not need to be subtracted.
>
>so ...
>
>desktop_height = _Screen.Height - 38 - 23
>
>Does this sound right???
>

You're better off using the SYSMETRIC() function to handle the various elements. Unfortunately, the height of the status bar has to be taken into account as well. Between the API and Foxtools, however, it becomes simpler.
* Foxtools must be loaded before using this.
* Get the window handle of the main VFP window
lnhwnd = MainhWnd()
* Initialize API call
DELCARE INTEGER GetWindow IN Win32API;
  INTEGER hwnd, INTEGER dFlag
STORE 0 TO lndesktop, lnlast
lldone = .F.
DO WHILE NOT lldone
  * The desktop is the last child window
  lnlast = GetWindow(lnhwnd, 5) && GW_CHILD
  lldone = (lnlast = 0)
  IF NOT lldone
   lndesktop = lnlast
  ENDIF
ENDDO
STORE 0 TO nTop, nLeft, nBottom, nRight
* Call Foxtools to get the co-ordinates.
= _GetWRect(lndesktop, @nTop, @nLeft, @nBottom, @nRight)
Now it becomes a simple matter of subtraction.
George

Ubi caritas et amor, deus ibi est
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform