- Timestamp:
- Oct 31, 2006, 3:11:11 AM (19 years ago)
- Location:
- branches/branch-1-0
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/branch-1-0/include/helpers/winh.h
r276 r337 15 15 */ 16 16 17 /* Copyright (C) 1997-200 0Ulrich Mller.17 /* Copyright (C) 1997-2006 Ulrich Mller. 18 18 * This file is part of the "XWorkplace helpers" source package. 19 19 * This is free software; you can redistribute it and/or modify … … 673 673 BOOL XWPENTRY winhRestoreWindowPos(HWND hwnd, HINI hIni, const char *pcszApp, const char *pcszKey, ULONG fl); 674 674 675 // V1.0.6 (2006-10-28) [pr] 676 677 /* 678 *@@ STOREPOS: 679 * 680 */ 681 682 #pragma pack(2) 683 typedef struct _STOREPOS 684 { 685 USHORT usMagic; // Always 0x7B6A (???) 686 ULONG ulFlags; 687 USHORT usXPos; 688 USHORT usYPos; 689 USHORT usWidth; 690 USHORT usHeight; 691 ULONG ulRes1; // Always 1 (???) 692 USHORT usRestoreXPos; 693 USHORT usRestoreYPos; 694 USHORT usRestoreWidth; 695 USHORT usRestoreHeight; 696 ULONG ulRes2; // Always 1 (???) 697 USHORT usMinXPos; 698 USHORT usMinYPos; 699 ULONG ulRes3; // Always 0x0400 (???) 700 ULONG ulRes4; // Always 0x0300 (???) 701 ULONG ulRes5; // Always 0xFFFFFFFF (???) 702 ULONG ulRes6; // Always 0xFFFFFFFF (???) 703 ULONG ulPPLen; // Presentation Parameters length 704 } STOREPOS, *PSTOREPOS; 705 #pragma pack() 706 707 #pragma import(WinGetFrameTreePPSize, , "PMWIN", 972) 708 #pragma import(WinGetFrameTreePPs, , "PMWIN", 973) 709 710 ULONG APIENTRY WinGetFrameTreePPSize(HWND hwnd); 711 ULONG APIENTRY WinGetFrameTreePPs(HWND hwnd, ULONG cchMax, PCH pch); 712 713 BOOL XWPENTRY winhStoreWindowPos(HWND hwnd, HINI hIni, const char *pcszApp, const char *pcszKey); 714 675 715 #define XAC_MOVEX 0x0001 676 716 #define XAC_MOVEY 0x0002 -
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.