Hi Gene

I thought that the height was sorted as it appeared to work on my
development machine.  Testing on other computers proved the opposite.

The following code works courtesy of Matt Slay in an article on VFUG
about Screen Capture from VFP.
http://vfug.org/Newsletters/Newsletters2.Afp?!_1NS14PGYLDate=02/01/2004

Local cDevMode As Character,lnScreenWidth As Number,lnScreenHeight As
Number
Local lnWidth As Number ,lnHeight As Number
Local lpRect, lnLeft, lnTop, lnRight, lnBottom

#Define ENUM_CURRENT_SETTINGS       0xffffffff
#Define MAX_DWORD  4294967295  && 0xffffffff

cDevMode=Replicate(Chr(0),36)+BinToC(156,"2sr")+Replicate(Chr(0),118)

Declare Integer EnumDisplaySettings In WIN32API Integer,Integer,String @
Declare Integer FindWindow In user32 String cClassName,String
cWindowName
Declare Integer GetWindowRect In user32 Integer HWnd, String @lpRect

If EnumDisplaySettings(0,ENUM_CURRENT_SETTINGS,@cDevMode)=0

        Return

Endif

lnScreenWidth=CToBin(Substr(cDevMode,109,4),"4sr") && get Width & Height
of Display
lnScreenHeight=CToBin(Substr(cDevMode,113,4),"4sr")

htb = FindWindow('Shell_TrayWnd','')  && get HWND of TaskBar

Store 0 To lnWidth,lnHeight
lpRect = Repli(Chr(0), 16)
= GetWindowRect (Htb, @lpRect)
lnLeft   = buf2dword(Substr(lpRect,  1,4))
lnTop    = buf2dword(Substr(lpRect,  5,4))
lnRight  = buf2dword(Substr(lpRect,  9,4))
lnBottom = buf2dword(Substr(lpRect, 13,4))


_Screen.Icon = 'AWillsScreen4.ico'
_Screen.WindowState=0
_Screen.Width = lnScreenWidth
_Screen.Height = lnTop
_Screen.WindowState=2   

BufToWord Function below

Function  buf2dword (lcBuffer)
        Return Asc(Substr(lcBuffer, 1,1)) + ;
                Asc(Substr(lcBuffer, 2,1)) * 256 +;
                Asc(Substr(lcBuffer, 3,1)) * 65536 +;
                Asc(Substr(lcBuffer, 4,1)) * 16777216

Endfunc


-----Original Message-----
From: [email protected] [mailto:[email protected]] On
Behalf Of Gene Wirchenko
Sent: 28 July 2009 18:31
To: ProFox Email List
Subject: RE: My App does not display properly.

At 06:56 2009-07-28, Peter Hart <[email protected]> wrote:
>Tried your suggestion without success.  Incidentally the _Screen.Height
>= 0  made the app open up showing the ribbon with about an inch of
>desktop.
>Have solved it with:
>
>_Screen.Windowstate=2
>_Screen.Width = Sysmetric(1)
>_Screen.Height=Sysmetric(2)

      I am puzzled why
           _screen.windowstate=2
did not work for you.  Setting the width and height as above does not 
quite work.  You are liable to display something to _screen that will 
not show up on the monitor.

      The sysmetric() values for width and height are for the whole 
screen.  There is no allowance for the taskbar or the titlebar and 
menu bar of the VFP main window.  My system runs at 1024x768.  If I 
maximise the main VFP window,
           ? _screen.height
prints 700.  If I were to set _screen width and height to the 
sysmetric() values, there would be 68 pixels high of _screen that 
would not fit on the screen.

[snip]

Sincerely,

Gene Wirchenko



_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/a57fa4cf19531343a2ee11b57db8e3af04c...@server.peterhartcomputers.local
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to