wpSaveDeferred - Example Code
MRESULT EXPENTRY MyWindowProc ( HWND hwndDlg, ULONG msg
, MPARAM mp1, MPARAM mp2 )
{
SOMAny *somSelf; /* Temporary ptr to object instance */
PWINDATA pwin; /* Window data */
PSZ psz; /* User title to manipulate */
HWND hwndEntry; /* Window handle */
CHAR buf[30]; /* Buffer */
switch( msg )
{
case WM_INITDLG:
somSelf = (SOMAny *) mp2; /* obtain creation parms */
pwin = (PWINDATA) _wpAllocMem ( somSelf, sizeof (WINDATA), NULL );
WinSetWindowPtr (hwndDlg, QWL_USER, pwin );
/* Initialize the windata structure */
pwin->somSelf = somSelf;
pwin->somClassObj = _somGetClass ( pwin->somSelf );
/* query title string from instance data, and fill */
/* entryfield with the string */
psz = _UserGetTitle ( pwin->somSelf );
/* Change title, and then save it to the OS2.INI file
whenever it is convenient */
strcat( psz, ":1" );
_UserSetTitle ( pwin->somSelf, (PSZ) &buf );
/* return TRUE to tell PM that we changed focus */
return (MRESULT) TRUE ;
_wpSaveDeferred ( pwin -> somSelf );
hwndEntry = WinWindowFromID ( hwndDlg, DLG_ENTRYFIELD );
WinSetWindowText ( hwndEntry, psz );
WinSetFocus ( HWND_DESKTOP, hwndEntry );
[Back: wpSaveDeferred - Related Methods]
[Next: wpSaveDeferred - Topics]