Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to get windows to save positions in APP
Message
From
20/08/1999 13:48:21
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00255821
Message ID:
00255968
Views:
31
Hi John.

>> HOW THE !@## DO YOU GET YOUR APP TO SAVE THE POSITION AND SIZE WHEN THE USER EXITS THE PROGRAM?!?!?! <<

I generally save and restore form positions from an ini file.

You can save the current position to the ini file using something like this:
lcValue = ALLTRIM(STR(MAX(THISFORM.Top,0))) + ',' + ;
          ALLTRIM(STR(MAX(THISFORM.Left,0))) + ',' + ;
          ALLTRIM(STR(MAX(THISFORM.Height,0))) + ',' + ;
          ALLTRIM(STR(MAX(THISFORM.Width,0)))
ENDIF

*-- Write the entry to the INI file

=WritePrivStr("WindowPositions", lcCaption, ;
              lcValue, MyIniFile)
And you can restore the position by reading the value from the ini file:

*-- Read the window position from the INI file
IF GetPrivStr("WindowPositions", lcCaption, "", ;
@lcBuffer, LEN(lcBuffer), ;
MyIniFile) > 0

Of course, you will need to declare these functions to use them like so:

DECLARE INTEGER GetPrivateProfileString IN Win32API AS GetPrivStr ;
String cSection, String cKey, String cDefault, String @cBuffer, ;
Integer nBufferSize, String cINIFile

DECLARE INTEGER WritePrivateProfileString IN Win32API AS WritePrivStr ;
String cSection, String cKey, String cValue, String cINIFile

HTH

Marcia
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform