Changeset 337 for branches/branch-1-0/src/helpers/winh.c
- Timestamp:
- Oct 31, 2006, 3:11:11 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/branch-1-0/src/helpers/winh.c
r336 r337 2470 2470 2471 2471 /* 2472 *@@ winhStoreWindowPos: 2473 * saves the position of a certain window in the same format 2474 * as the barely documented WinStoreWindowPos API. 2475 * This uses the completely undocumented calls 2476 * WinGetFrameTreePPSize and WinGetFrameTreePPs imported 2477 * from PMWIN.DLL ordinals 972 and 973. 2478 * 2479 * The window should still be visible on the screen 2480 * when calling this function. Do not call it in WM_DESTROY, 2481 * because then the SWP data is no longer valid. 2482 * 2483 * This returns TRUE if saving was successful. 2484 * 2485 *@@added XWP V1.0.6 (2006-10-31) [pr]: @@fixes 458 2486 */ 2487 2488 BOOL winhStoreWindowPos(HWND hwnd, // in: window to save 2489 HINI hIni, // in: INI file (or HINI_USER/SYSTEM) 2490 const char *pcszApp, // in: INI application name 2491 const char *pcszKey) // in: INI key name 2492 { 2493 BOOL brc = FALSE; 2494 SWP swp; 2495 2496 if (WinQueryWindowPos(hwnd, &swp)) 2497 { 2498 ULONG ulSizePP = WinGetFrameTreePPSize(hwnd); 2499 ULONG ulSize = sizeof(STOREPOS) + ulSizePP; 2500 PSTOREPOS pStorePos; 2501 2502 if ((pStorePos = malloc(ulSize))) 2503 { 2504 // This first bit is all guesswork as I don't know what it all means, 2505 // but it always seems to be the same everywhere I've looked. 2506 pStorePos->usMagic = 0x7B6A; 2507 pStorePos->ulRes1 = 1; 2508 pStorePos->ulRes2 = 1; 2509 pStorePos->ulRes3 = 0x0400; 2510 pStorePos->ulRes4 = 0x0300; 2511 pStorePos->ulRes5 = 0xFFFFFFFF; 2512 pStorePos->ulRes6 = 0xFFFFFFFF; 2513 2514 pStorePos->ulFlags = swp.fl; 2515 pStorePos->usXPos = pStorePos->usRestoreXPos = swp.x; 2516 pStorePos->usYPos = pStorePos->usRestoreYPos = swp.y; 2517 pStorePos->usWidth = pStorePos->usRestoreWidth = swp.cx; 2518 pStorePos->usHeight = pStorePos->usRestoreHeight = swp.cy; 2519 if (swp.fl & (SWP_MAXIMIZE | SWP_MINIMIZE)) 2520 { 2521 pStorePos->usRestoreXPos = WinQueryWindowUShort(hwnd, QWS_XRESTORE); 2522 pStorePos->usRestoreYPos = WinQueryWindowUShort(hwnd, QWS_YRESTORE); 2523 pStorePos->usRestoreWidth = WinQueryWindowUShort(hwnd, QWS_CXRESTORE); 2524 pStorePos->usRestoreHeight = WinQueryWindowUShort(hwnd, QWS_CYRESTORE); 2525 } 2526 2527 pStorePos->usMinXPos = WinQueryWindowUShort(hwnd, QWS_XMINIMIZE); 2528 pStorePos->usMinYPos = WinQueryWindowUShort(hwnd, QWS_YMINIMIZE); 2529 pStorePos->ulPPLen = WinGetFrameTreePPs(hwnd, ulSizePP, pStorePos + 1); 2530 ulSize = pStorePos->ulPPLen + sizeof(STOREPOS); 2531 brc = PrfWriteProfileData(hIni, (PSZ)pcszApp, (PSZ)pcszKey, pStorePos, ulSize); 2532 free(pStorePos); 2533 } 2534 } 2535 return brc; 2536 } 2537 2538 /* 2472 2539 *@@ winhAdjustControls: 2473 2540 * helper function for dynamically adjusting a window's
Note:
See TracChangeset
for help on using the changeset viewer.