Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Is there a way to get screen height * width ?
Message
De
29/12/1999 09:45:44
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00309284
Message ID:
00309815
Vues:
59
>>>>>>With native VFP. I prefer not to use WinAPI. TIA.
>>>>>
>>>>>Cetin,
>>>>>
>>>>>I know you well enough to know you're probably not asking for the size in pixels, but the physical dimensions (in meters I assume) of the monitor. That right?
>>>>
>>>>
No George :) If I can get the pixels I could get the twips :)
>>>>Mark I'm a human too :) and being honest just couldn't think sysmetric().
>>>>Fred and Ed unfortunately I talked too early about sysmetric() being the answer. My sesssion was somehow a normal "maximizable" session. I should reproduce the effect first and I can only do it tomorrow. I'll be back if that doesn't work :)
>>>>
>>>>Here a short detail (Just can't remeber exact steps):
>>>>-A VFP task open (max or norm ? don't remember)
>>>>-Screen res. from 1280*1024 to 800*600
>>>>-Anýother VFP task (fox screen max. or norm again can't remember :( )
>>>>-Restore resol.
>>>>-Return to first VFP task
>>>>-Maximize
>>>>-Maximized state is obviously about 800*600
>>>>
>>>
>>>I'd be willing to bet that the Form's MaxHeight and MaxWidth properties were set to 600 and 800 respectively; you can get around this by writing the returns of SYSMETRIC(1) and SYSMETRIC(2) into the properties if you need to.
>>
>>
Hi,
>>I'll again CC to all of you because I know you want it for at least info ( don't you :)
>>I reproduced it and sysmetric() was not the answer (and I'm not sure if there is an answer).
>>Ed you lost the bet :)
>>Here is how to reproduce it :
>>-Screen res : 1280*1024
>>-Invoke a VFP session (nothing else just VFP) and maximize
>>-Go to desktop and set res. to 800*600
>>-Invoke another VFP task - Comes up maximized to 800*600
>>-Go to desktop and set resolution back to 1280*1024
>>-Switch to second VFP task
>>-_screen.maxheight and _screen.maxwidth are both -1 (none set - max possible I think). I didn't touch their settings just checked for the bet :)
>>-Now sysmetric() show that res is 800*600 (!!!)
>>-You play with maximize-restore button and VFP just max-restore in place ! Threats the max desktop as 800*600. Sysmetric() also say it's 800*600
>>
>>But of course other (1st) VFP session knows it's 1280*1024.
>>
>>I sense that this is not a matter of VFP but Windows itself. I use w2000 built 2128 and you might not be able to reproduce under another version.
>>George as to your info it maps to WinAPI GetSystemMetrics I think I shouldn't seek further for the moment :)
>>If anyone has an idea to change it wellcome.
>>Happy new year to all of you and families.
>
>Cetin,
>
>And a happy new year to you to.
>
>This is only partially for you. It's also intended to correct part of the erroneous information (regarding SYSMETRIC()) that I posted yesterday.
>
>In that post, I stated that the function maps to GetSystemMetrics(). As I discovered this isn't totally right. It may actually be re-reading this information that's stored in the registry or elsewhere. When GetSystemMetrics() is called with the height parameter, it returns only the area not covered by the task bar. For example, I run 640x480 (no comments, please< g >). Passing SM_CYFULLSCREEN (17) to the function, it returns 461.
>
>Now I know that you don't want to use the API here, but it might be interesting to find out if the appropriate API call correctly returns the information. If it doesn't, then there might not be a solution to this. So, if you don't mind running the following snippet and reporting back the results, it might go towards determinign if this can be solved.
#DEFINE SPI_GETWORKAREA 48
>DECLARE INTEGER SystemParametersInfo IN Win32API;
>  INTEGER uiAction, SHORT uiParam,;
>  STRING @pvParam, INTEGER fWinIni
>lcrect = REPLICATE(CHR(0), 16)
>= SystemParametersInfo(SPI_GETWORKAREA, 0, @lcrect, 0)
>? StringToInteger(SUBSTR(lcrect, 9, 4)) && The width
>? StringToInteger(RIGHT(lcrect, 4)) && The height
>FUNCTION StringToInteger
>
>  LPARAMETER pcstring, plsigned
>
>  LOCAL lnresult, lnlast, lni, llsigned,;
>    lnmsb, lnmax
>  lnresult = 0
>  lnlast = LEN(pcstring)
>  * Return Signed Integer?
>  IF PCOUNT() = 2
>    llsigned = plsigned
>  ELSE
>    llsigned = .F.
>  ENDIF
>  FOR lni = 1 TO lnlast
>    lnresult = lnresult + ASC(SUBSTR(pcstring, lni, 1)) * (256 ^ (lni - 1))
>  NEXT
>  IF llsigned
>    lnmsb = (lnlast * 8) - 1
>    IF BITTEST(lnresult, lnmsb)
>      lnmax = (2 ^ (lnmsb + 1))
>      lnresult = lnresult - lnmax
>    ENDIF
>  ENDIF
>  RETURN lnresult
>ENDFUNC

Hi George,
It returns 1280*996 with one line taskbar and 1280*972 with 2 lines taskbar. As to my understanding it does report taskbar area subtracted. Well I take my word back about WinAPI :) This is valuable routine for me, thanks :)
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform