Casey McGuire wrote:
> *-- DECLARE DLL statements for reading/writing to private INI files
> 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
>
>
> * Example of saving form position to ini
>
> * Write to ini
> lcValue = ALLT(STR(MAX(THISFORM.TOP, 0))) + ',' + ;
>            ALLT(STR(MAX(THISFORM.LEFT, 0)))
>
> *-- Write the entry to the INI file
> =WritePrivStr("FormPositions", THISFORM.CAPTION, ;
>                lcValue, oApp.cProgramDirectory + INIFILE)
>
> * Read from ini
> lcBuffer = SPACE(10) + CHR(0)
> lcOldError = ON('ERROR')
>
> *-- Read the window position from the INI file
> IF GetPrivStr("FormPositions", THISFORM.CAPTION, "", ;
>                 @lcBuffer, LEN(lcBuffer), ;
>                 oApp.cProgramDirectory + INIFILE) > 0
>    *-- If an error occurs while parsing the string,
>    *-- just ignore the string and use the form's
>    *-- defaults
>    ON ERROR llError = .T.
>    lnCommaPos = AT(",", lcBuffer)
>    lnTop  = VAL(LEFT(lcBuffer, lnCommaPos - 1))
>    lnLeft = VAL(SUBSTR(lcBuffer, lnCommaPos + 1))
>    ON ERROR &lcOldError
>    IF !llError
>      THISFORM.TOP = lnTop
>      THISFORM.LEFT = lnLeft
>    ENDIF
> ENDIF
>
>   

Impressive!

-- 
Michael J. Babcock, MCP
MB Software Solutions, LLC
http://mbsoftwaresolutions.com
http://fabmate.com
"Work smarter, not harder, with MBSS custom software solutions!"



_______________________________________________
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
** 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