Knowing the application name, keyname and window handle, the following sample code fragment shows how to save the current size and position of the given window:
#define INCL_WINWORKPLACE #include "os2.h" { BOOL rc; rc = WinStoreWindowPos(vszAppName,szKey,hwnd); if (rc) /* Window size and position saved */ else /* ERROR occurred */ /* Later you would use WinRestoreWindowPos to restore the window */ /* to it's previously saved size and position */ . . . rc = WinRestoreWindowPos(vszAppName,szKey,hwnd); if (rc) /* Window size and position restored */ else /* ERROR occurred */ }