Changeset 232 for trunk/src/helpers/winh.c
- Timestamp:
- Dec 5, 2002, 9:36:28 PM (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/helpers/winh.c
r229 r232 271 271 /* ****************************************************************** 272 272 * 273 * Global variables 274 * 275 ********************************************************************/ 276 277 extern LONG G_cxScreen = 0, 278 G_cyScreen = 0, 279 G_cxIcon = 0, 280 G_cyIcon = 0, 281 G_lcol3DDark = 0, // lo-3D color 282 G_lcol3DLight = 0; // hi-3D color 283 284 /* ****************************************************************** 285 * 273 286 * Generics 274 287 * 275 288 ********************************************************************/ 289 290 /* 291 *@@ winhInitGlobals: 292 * initializes a few global variables that are usually 293 * used all the time in many applications and also 294 * internally by many helper routines. You must call 295 * this at the start of your application if you want 296 * to use these. 297 * 298 *@@added V1.0.1 (2002-11-30) [umoeller] 299 */ 300 301 VOID winhInitGlobals(VOID) 302 { 303 G_cxScreen = WinQuerySysValue(HWND_DESKTOP, SV_CXSCREEN); 304 G_cyScreen = WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN); 305 G_cxIcon = WinQuerySysValue(HWND_DESKTOP, SV_CXICON); 306 G_cyIcon = WinQuerySysValue(HWND_DESKTOP, SV_CYICON); 307 G_lcol3DDark = WinQuerySysColor(HWND_DESKTOP, SYSCLR_BUTTONDARK, 0); 308 G_lcol3DLight = WinQuerySysColor(HWND_DESKTOP, SYSCLR_BUTTONLIGHT, 0); 309 } 276 310 277 311 /* … … 2805 2839 // if (xNew + swpThis.cy > WinQuerySysValue(HWND_DESKTOP, SV_CXSCREEN)) 2806 2840 // not cy, but cx V1.0.0 (2002-08-26) [umoeller] 2807 if (xNew + swpThis.cx > WinQuerySysValue(HWND_DESKTOP, SV_CXSCREEN))2841 if (xNew + swpThis.cx > G_cxScreen) 2808 2842 { 2809 2843 // place left then … … 2902 2936 2903 2937 /* 2938 *@@ winhQueryDefaultFont: 2939 * 2940 *@@added V1.0.1 (2002-11-30) [umoeller] 2941 */ 2942 2943 PCSZ winhQueryDefaultFont(VOID) 2944 { 2945 if (doshIsWarp4()) 2946 return "9.WarpSans"; 2947 2948 return "8.Helv"; 2949 } 2950 2951 /* 2904 2952 *@@ winhSetWindowFont: 2905 2953 * this sets a window's font by invoking … … 2914 2962 * 2915 2963 *@@added V0.9.0 [umoeller] 2964 *@@changed V1.0.1 (2002-11-30) [umoeller]: optimized 2916 2965 */ 2917 2966 … … 2919 2968 const char *pcszFont) 2920 2969 { 2921 CHAR szFont[256]; 2922 2923 if (pcszFont == NULL) 2924 { 2925 if (doshIsWarp4()) 2926 strhncpy0(szFont, "9.WarpSans", sizeof(szFont)); 2927 else 2928 strhncpy0(szFont, "8.Helv", sizeof(szFont)); 2929 } 2930 else 2931 strhncpy0(szFont, pcszFont, sizeof(szFont)); 2970 if (!pcszFont) 2971 pcszFont = winhQueryDefaultFont(); 2932 2972 2933 2973 return WinSetPresParam(hwnd, 2934 2974 PP_FONTNAMESIZE, 2935 strlen( szFont)+1,2936 szFont);2975 strlen(pcszFont) + 1, 2976 (PSZ)pcszFont); 2937 2977 } 2938 2978 … … 3082 3122 } 3083 3123 } 3124 3084 3125 return brc; 3126 } 3127 3128 /* 3129 *@@ winhCreateDefaultPresparams: 3130 * 3131 * Caller must free() the return value. 3132 * 3133 *@@added V1.0.1 (2002-11-30) [umoeller] 3134 */ 3135 3136 PPRESPARAMS winhCreateDefaultPresparams(VOID) 3137 { 3138 PPRESPARAMS ppp = NULL; 3139 3140 PCSZ pcszFont = winhQueryDefaultFont(); 3141 LONG lColor; 3142 3143 winhStorePresParam(&ppp, 3144 PP_FONTNAMESIZE, 3145 strlen(pcszFont) + 1, 3146 (PVOID)pcszFont); 3147 3148 lColor = WinQuerySysColor(HWND_DESKTOP, 3149 SYSCLR_DIALOGBACKGROUND, 3150 0); 3151 winhStorePresParam(&ppp, 3152 PP_BACKGROUNDCOLOR, 3153 sizeof(lColor), 3154 &lColor); 3155 3156 lColor = RGBCOL_BLACK; 3157 winhStorePresParam(&ppp, 3158 PP_FOREGROUNDCOLOR, 3159 sizeof(lColor), 3160 &lColor); 3161 3162 return ppp; 3085 3163 } 3086 3164 … … 3497 3575 3498 3576 /* 3499 *@@ winhMyAnchorBlock:3500 * returns the proper anchor block (HAB)3501 * for the calling thread.3502 *3503 * Many Win* functions require an HAB to be3504 * passed in. While many of them will work3505 * when passing in NULLHANDLE, some (such as3506 * WinGetMsg) won't. If you don't know the3507 * anchor block of the calling thread, use3508 * this function.3509 *3510 * This creates a temporary object window to3511 * find out the anchor block. This is quite3512 * expensive so only use this if there's no3513 * other way to find out.3514 *3515 *@@added V0.9.11 (2001-04-20) [umoeller]3516 */3517 3518 HAB winhMyAnchorBlock(VOID)3519 {3520 HAB hab = NULLHANDLE;3521 HWND hwnd;3522 if (hwnd = winhCreateObjectWindow(WC_BUTTON, NULL))3523 {3524 hab = WinQueryAnchorBlock(hwnd);3525 WinDestroyWindow(hwnd);3526 }3527 3528 return hab;3529 }3530 3531 /*3532 3577 *@@ winhFree: 3533 3578 * frees a block of memory allocated by the … … 3728 3773 3729 3774 /* 3775 *@@ winhQueryWaitPointer: 3776 * shortcut for getting the system "wait" pointer. 3777 * 3778 *@@added V1.0.1 (2002-11-30) [umoeller] 3779 */ 3780 3781 HPOINTER winhQueryWaitPointer(VOID) 3782 { 3783 return WinQuerySysPointer(HWND_DESKTOP, 3784 SPTR_WAIT, 3785 FALSE); // no copy 3786 } 3787 3788 /* 3730 3789 *@@ winhSetWaitPointer: 3731 3790 * this sets the mouse pointer to "Wait". … … 3742 3801 HPOINTER hptr = WinQueryPointer(HWND_DESKTOP); 3743 3802 WinSetPointer(HWND_DESKTOP, 3744 WinQuerySysPointer(HWND_DESKTOP, 3745 SPTR_WAIT, 3746 FALSE)); // no copy 3803 winhQueryWaitPointer()); 3747 3804 return hptr; 3748 3805 } … … 3760 3817 { 3761 3818 PSZ pszText = NULL; 3762 ULONG cbText = WinQueryWindowTextLength(hwnd); 3763 // additional null character 3764 if (cbText) 3765 { 3766 if (pszText = (PSZ)malloc(cbText + 1)) 3819 ULONG cbText; 3820 if (cbText = WinQueryWindowTextLength(hwnd)) 3821 { 3822 if (pszText = (PSZ)malloc(cbText + 1)) // additional null character 3767 3823 WinQueryWindowText(hwnd, 3768 3824 cbText + 1, 3769 3825 pszText); 3770 3826 } 3827 3771 3828 return pszText; 3772 3829 } … … 3821 3878 { 3822 3879 BOOL brc = FALSE; 3823 PSZ pszText = winhQueryWindowText(hwnd); 3824 if (pszText) 3880 PSZ pszText; 3881 3882 if (pszText = winhQueryWindowText(hwnd)) 3825 3883 { 3826 3884 ULONG ulOfs = 0; … … 3830 3888 brc = TRUE; 3831 3889 } 3890 3832 3891 free(pszText); 3833 3892 } 3893 3834 3894 return brc; 3835 3895 } … … 3939 3999 *@@changed V0.9.5 (2000-08-13) [umoeller]: flStyleClient never worked, fixed 3940 4000 *@@changed V0.9.7 (2000-12-08) [umoeller]: fixed client calc for invisible window 4001 *@@changed V1.0.1 (2002-11-30) [umoeller]: added support for NULL pcszClassClient 3941 4002 */ 3942 4003 … … 3947 4008 const char *pcszFrameTitle, // in: frame title (title bar) 3948 4009 ULONG ulResourcesID, // in: according to FCF_* flags 3949 const char *pcszClassClient, // in: client class name 4010 const char *pcszClassClient, // in: client class name (can be NULL for no client) 3950 4011 ULONG flStyleClient, // in: client style 3951 4012 ULONG ulID, // in: frame window ID 3952 4013 PVOID pClientCtlData, // in: pCtlData structure pointer for client 3953 PHWND phwndClient) // out: created client wnd 4014 PHWND phwndClient) // out: created client wnd (required) 3954 4015 { 3955 4016 FRAMECDATA fcdata; … … 3962 4023 fcdata.idResources = ulResourcesID; 3963 4024 3964 / * Create the frame and client windows. */3965 hwndFrame = WinCreateWindow(hwndFrameParent,3966 WC_FRAME,3967 (PSZ)pcszFrameTitle,3968 ulFrameStyle,3969 0,0,0,0, // size and position = 03970 NULLHANDLE, // no owner3971 HWND_TOP, // z-order3972 ulID, // frame window ID3973 &fcdata, // frame class data3974 NULL); // no presparams3975 3976 if (hwndFrame)3977 {3978 if (*phwndClient = WinCreateWindow(hwndFrame, // parent3979 (PSZ)pcszClassClient, // class3980 NULL, // no title3981 flStyleClient, // style3982 0,0,0,0, // size and position = 03983 hwndFrame, // owner3984 HWND_BOTTOM, // bottom z-order3985 FID_CLIENT, // frame window ID3986 pClientCtlData, // class data3987 NULL)) // no presparams4025 // create the frame and client windows 4026 if (hwndFrame = WinCreateWindow(hwndFrameParent, 4027 WC_FRAME, 4028 (PSZ)pcszFrameTitle, 4029 ulFrameStyle, 4030 0,0,0,0, 4031 NULLHANDLE, 4032 HWND_TOP, 4033 ulID, 4034 &fcdata, 4035 NULL)) 4036 { 4037 if ( (!pcszClassClient) // V1.0.1 (2002-11-30) [umoeller] 4038 || (*phwndClient = WinCreateWindow(hwndFrame, // parent 4039 (PSZ)pcszClassClient, // class 4040 NULL, // no title 4041 flStyleClient, // style 4042 0,0,0,0, // size and position = 0 4043 hwndFrame, // owner 4044 HWND_BOTTOM, // bottom z-order 4045 FID_CLIENT, // frame window ID 4046 pClientCtlData, // class data 4047 NULL)) // no presparams 4048 ) 3988 4049 { 3989 4050 if (pswpFrame) … … 3998 4059 pswpFrame->fl); 3999 4060 4000 // position client 4001 // WinQueryWindowRect(hwndFrame, &rclClient); 4002 // doesn't work because it might be invisible V0.9.7 (2000-12-08) [umoeller] 4003 rclClient.xLeft = 0; 4004 rclClient.yBottom = 0; 4005 rclClient.xRight = pswpFrame->cx; 4006 rclClient.yTop = pswpFrame->cy; 4007 WinCalcFrameRect(hwndFrame, 4008 &rclClient, 4009 TRUE); // calc client from frame 4010 WinSetWindowPos(*phwndClient, 4011 HWND_TOP, 4012 rclClient.xLeft, 4013 rclClient.yBottom, 4014 rclClient.xRight - rclClient.xLeft, 4015 rclClient.yTop - rclClient.yBottom, 4016 SWP_MOVE | SWP_SIZE | SWP_SHOW); 4061 if (!pcszClassClient) 4062 *phwndClient = NULLHANDLE; 4063 else 4064 { 4065 // position client 4066 // WinQueryWindowRect(hwndFrame, &rclClient); 4067 // doesn't work because it might be invisible V0.9.7 (2000-12-08) [umoeller] 4068 rclClient.xLeft = 0; 4069 rclClient.yBottom = 0; 4070 rclClient.xRight = pswpFrame->cx; 4071 rclClient.yTop = pswpFrame->cy; 4072 WinCalcFrameRect(hwndFrame, 4073 &rclClient, 4074 TRUE); // calc client from frame 4075 WinSetWindowPos(*phwndClient, 4076 HWND_TOP, 4077 rclClient.xLeft, 4078 rclClient.yBottom, 4079 rclClient.xRight - rclClient.xLeft, 4080 rclClient.yTop - rclClient.yBottom, 4081 SWP_MOVE | SWP_SIZE | SWP_SHOW); 4082 } 4017 4083 } 4018 4084 } … … 4119 4185 if (WinQueryClassName(hwndThis, sizeof(szClass), szClass)) 4120 4186 { 4121 if ( strcmp(szClass, "#32767") == 0)4187 if (!strcmp(szClass, "#32767")) 4122 4188 { 4123 4189 // message queue window: … … 4132 4198 { 4133 4199 // get HMQ from window words 4134 rc = WinQueryWindowULong(hwndThis, QWL_HMQ); 4135 if (rc) 4200 if (rc = WinQueryWindowULong(hwndThis, QWL_HMQ)) 4136 4201 if (phab) 4137 4202 *phab = WinQueryAnchorBlock(hwndThis); 4203 4138 4204 break; 4139 4205 } … … 4178 4244 // enumerate all child windows of HWND_OBJECT 4179 4245 henumObject = WinBeginEnumWindows(HWND_OBJECT); 4180 while ((hwndObjectChild = WinGetNextWindow(henumObject)) != NULLHANDLE)4246 while ((hwndObjectChild = WinGetNextWindow(henumObject))) 4181 4247 { 4182 4248 // see if the current HWND_OBJECT child window runs in the … … 4272 4338 WS_VISIBLE, // window style 4273 4339 0, 0, // position and size 4274 WinQuerySysValue(HWND_DESKTOP, SV_CXSCREEN),4275 WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN),4340 G_cxScreen, 4341 G_cyScreen, 4276 4342 NULLHANDLE, // owner window 4277 4343 hwndSibling, // sibling window … … 4426 4492 * was encountered. 4427 4493 * 4428 * You can specify DT_QUERYEXTENT with flDraw to only have 4429 * these text boundaries calculated without actually drawing. 4494 * The following DT_* flags are supported: 4495 * 4496 * -- DT_LEFT, DT_CENTER, DT_RIGHT all work. 4497 * 4498 * -- Vertically however only DT_TOP is supported. 4499 * 4500 * -- You can specify DT_QUERYEXTENT to only have 4501 * these text boundaries calculated without actually 4502 * drawing. 4503 * 4504 * Note that DT_TEXTATTRS will always be added, so you 4505 * will want to call GpiSetColor before this. 4430 4506 * 4431 4507 * This returns the number of lines drawn. 4432 *4433 * Note that this calls WinDrawText with DT_TEXTATTRS set,4434 * that is, the current text primitive attributes will be4435 * used (fonts and colors).4436 4508 * 4437 4509 *@@changed V0.9.0 [umoeller]: prcl.xLeft and xRight are now updated too upon return … … 4443 4515 // (modified) 4444 4516 const char *pcszText, // in: text to draw (zero-terminated) 4445 ULONG flCmd) // in: flags like in WinDrawText; I have 4446 // only tested DT_TOP and DT_LEFT though. 4447 // DT_WORDBREAK | DT_TEXTATTRS are always 4448 // set. 4449 // You can specify DT_QUERYEXTENT to only 4450 // have prcl calculated without drawing. 4517 ULONG flCmd) // in: DT_* flags like in WinDrawText; see remarks 4451 4518 { 4452 4519 PSZ p = (PSZ)pcszText; … … 4472 4539 memcpy(&rcl2, prcl, sizeof(rcl2)); 4473 4540 lDrawn = WinDrawText(hps, 4474 ulTextLen -lTotalDrawn,4541 ulTextLen - lTotalDrawn, 4475 4542 p, 4476 4543 &rcl2, 4477 0, 0, // colors 4544 0, 4545 0, // colors 4478 4546 flCmd2); 4479 4547 … … 4494 4562 lLineCount++; 4495 4563 } 4564 4496 4565 prcl->xLeft = xLeftmost; 4497 4566 prcl->xRight = xRightmost; … … 4521 4590 PSWBLOCK winhQuerySwitchList(HAB hab) 4522 4591 { 4523 ULONG cItems = WinQuerySwitchList(hab, NULL, 0); 4524 ULONG ulBufSize = (cItems * sizeof(SWENTRY)) + sizeof(HSWITCH); 4525 PSWBLOCK pSwBlock = (PSWBLOCK)malloc(ulBufSize); 4526 if (pSwBlock) 4527 { 4528 cItems = WinQuerySwitchList(hab, pSwBlock, ulBufSize); 4529 if (!cItems) 4592 ULONG cItems = WinQuerySwitchList(hab, NULL, 0); 4593 ULONG ulBufSize = (cItems * sizeof(SWENTRY)) + sizeof(HSWITCH); 4594 PSWBLOCK pSwBlock; 4595 if (pSwBlock = (PSWBLOCK)malloc(ulBufSize)) 4596 { 4597 if (!(cItems = WinQuerySwitchList(hab, pSwBlock, ulBufSize))) 4530 4598 { 4531 4599 free(pSwBlock); … … 4747 4815 &ShiftState, DataLen, &DataLen, 4748 4816 NULL, 0L, NULL); 4817 4749 4818 // now close OS/2 keyboard driver 4750 4819 DosClose(hKbd); 4751 4820 } 4752 return;4753 4821 } 4754 4822 … … 4798 4866 4799 4867 /* 4800 *@@category: Helpers\PM helpers\Extended frame windows4801 */4802 4803 /* ******************************************************************4804 *4805 * Extended frame4806 *4807 ********************************************************************/4808 4809 /*4810 *@@ winhCalcExtFrameRect:4811 * implementation for WM_CALCFRAMERECT in fnwpSubclExtFrame.4812 * This is exported so it can be used independently4813 * (XWorkplace status bars).4814 *4815 *@@added V1.0.0 (2002-08-28) [umoeller]4816 */4817 4818 VOID winhCalcExtFrameRect(MPARAM mp1,4819 MPARAM mp2,4820 LONG lStatusBarHeight)4821 {4822 PRECTL prclPassed = (PRECTL)mp1;4823 4824 // mp2 == TRUE: Frame rectangle provided, calculate client4825 // mp2 == FALSE: Client area rectangle provided, calculate frame4826 if (mp2)4827 {4828 // TRUE: calculate the rectl of the client;4829 // call default window procedure to subtract child frame4830 // controls from the rectangle's height4831 LONG lClientHeight;4832 4833 // position the static text frame extension below the client4834 lClientHeight = prclPassed->yTop - prclPassed->yBottom;4835 if (lStatusBarHeight > lClientHeight)4836 // extension is taller than client, so set client height to 04837 prclPassed->yTop = prclPassed->yBottom;4838 else4839 {4840 // set the origin of the client and shrink it based upon the4841 // static text control's height4842 prclPassed->yBottom += lStatusBarHeight;4843 prclPassed->yTop -= lStatusBarHeight;4844 }4845 }4846 else4847 {4848 // FALSE: calculate the rectl of the frame;4849 // call default window procedure to subtract child frame4850 // controls from the rectangle's height;4851 // set the origin of the frame and increase it based upon the4852 // static text control's height4853 prclPassed->yBottom -= lStatusBarHeight;4854 prclPassed->yTop += lStatusBarHeight;4855 }4856 }4857 4858 #define STATUS_BAR_HEIGHT 204859 4860 /*4861 *@@ fnwpSubclExtFrame:4862 * subclassed frame window proc.4863 *4864 *@@added V0.9.16 (2001-09-29) [umoeller]4865 */4866 4867 MRESULT EXPENTRY fnwpSubclExtFrame(HWND hwndFrame, ULONG msg, MPARAM mp1, MPARAM mp2)4868 {4869 MRESULT mrc = 0;4870 4871 PEXTFRAMEDATA pData = (PEXTFRAMEDATA)WinQueryWindowPtr(hwndFrame, QWL_USER);4872 4873 switch (msg)4874 {4875 case WM_QUERYFRAMECTLCOUNT:4876 {4877 // query the standard frame controls count4878 ULONG ulrc = (ULONG)pData->pfnwpOrig(hwndFrame, msg, mp1, mp2);4879 4880 // if we have a status bar, increment the count4881 ulrc++;4882 4883 mrc = (MPARAM)ulrc;4884 }4885 break;4886 4887 case WM_FORMATFRAME:4888 {4889 // query the number of standard frame controls4890 ULONG ulCount = (ULONG)pData->pfnwpOrig(hwndFrame, msg, mp1, mp2);4891 4892 // we have a status bar:4893 // format the frame4894 ULONG ul;4895 PSWP swpArr = (PSWP)mp1;4896 4897 for (ul = 0; ul < ulCount; ul++)4898 {4899 if (WinQueryWindowUShort(swpArr[ul].hwnd, QWS_ID) == 0x8008)4900 // FID_CLIENT4901 {4902 POINTL ptlBorderSizes;4903 WinSendMsg(hwndFrame,4904 WM_QUERYBORDERSIZE,4905 (MPARAM)&ptlBorderSizes,4906 0);4907 4908 // first initialize the _new_ SWP for the status bar.4909 // Since the SWP array for the std frame controls is4910 // zero-based, and the standard frame controls occupy4911 // indices 0 thru ulCount-1 (where ulCount is the total4912 // count), we use ulCount for our static text control.4913 swpArr[ulCount].fl = SWP_MOVE | SWP_SIZE | SWP_NOADJUST | SWP_ZORDER;4914 swpArr[ulCount].x = ptlBorderSizes.x;4915 swpArr[ulCount].y = ptlBorderSizes.y;4916 swpArr[ulCount].cx = swpArr[ul].cx; // same as cnr's width4917 swpArr[ulCount].cy = STATUS_BAR_HEIGHT;4918 swpArr[ulCount].hwndInsertBehind = HWND_BOTTOM; // HWND_TOP;4919 swpArr[ulCount].hwnd = WinWindowFromID(hwndFrame, FID_STATUSBAR);4920 4921 // adjust the origin and height of the container to4922 // accomodate our static text control4923 swpArr[ul].y += swpArr[ulCount].cy;4924 swpArr[ul].cy -= swpArr[ulCount].cy;4925 }4926 }4927 4928 // increment the number of frame controls4929 // to include our status bar4930 mrc = (MRESULT)(ulCount + 1);4931 }4932 break;4933 4934 case WM_CALCFRAMERECT:4935 mrc = pData->pfnwpOrig(hwndFrame, msg, mp1, mp2);4936 4937 // we have a status bar: calculate its rectangle4938 winhCalcExtFrameRect(mp1,4939 mp2,4940 STATUS_BAR_HEIGHT);4941 break;4942 4943 case WM_DESTROY:4944 WinSubclassWindow(hwndFrame, pData->pfnwpOrig);4945 free(pData);4946 WinSetWindowPtr(hwndFrame, QWL_USER, NULL);4947 break;4948 4949 default:4950 mrc = pData->pfnwpOrig(hwndFrame, msg, mp1, mp2);4951 }4952 4953 return mrc;4954 }4955 4956 /*4957 *@@ winhCreateStatusBar:4958 * creates a status bar for a frame window.4959 *4960 * Normally there's no need to call this manually,4961 * this gets called by winhCreateExtStdWindow4962 * automatically.4963 *4964 *@@added V0.9.16 (2001-09-29) [umoeller]4965 */4966 4967 HWND winhCreateStatusBar(HWND hwndFrame,4968 HWND hwndOwner,4969 const char *pcszText, // in: initial status bar text4970 const char *pcszFont, // in: font to use for status bar4971 LONG lColor) // in: foreground color for status bar4972 {4973 // create status bar4974 HWND hwndReturn = NULLHANDLE;4975 PPRESPARAMS ppp = NULL;4976 4977 winhStorePresParam(&ppp,4978 PP_FONTNAMESIZE,4979 strlen(pcszFont) + 1,4980 (PVOID)pcszFont);4981 4982 lColor = WinQuerySysColor(HWND_DESKTOP,4983 SYSCLR_DIALOGBACKGROUND,4984 0);4985 winhStorePresParam(&ppp,4986 PP_BACKGROUNDCOLOR,4987 sizeof(lColor),4988 &lColor);4989 4990 lColor = CLR_BLACK;4991 winhStorePresParam(&ppp,4992 PP_FOREGROUNDCOLOR,4993 sizeof(lColor),4994 &lColor);4995 4996 hwndReturn = WinCreateWindow(hwndFrame,4997 WC_STATIC,4998 (PSZ)pcszText,4999 SS_TEXT | DT_VCENTER | WS_VISIBLE,5000 0, 0, 0, 0,5001 hwndOwner,5002 HWND_TOP,5003 FID_STATUSBAR,5004 NULL,5005 ppp);5006 free(ppp);5007 5008 return hwndReturn;5009 }5010 5011 /*5012 *@@ winhCreateExtStdWindow:5013 * creates an extended frame window.5014 *5015 * pData must point to an EXTFRAMECDATA structure5016 * which contains a copy of the parameters to be5017 * passed to winhCreateStdWindow. In addition,5018 * this contains the flExtFlags field, which allows5019 * you to automatically create a status bar for5020 * the window.5021 *5022 * Note that we subclass the frame here and require5023 * QWL_USER for that. The frame's QWL_USER points5024 * to an EXTFRAMEDATA structure whose pUser parameter5025 * you may use for additional data, if you want to5026 * do further subclassing.5027 *5028 *@@added V0.9.16 (2001-09-29) [umoeller]5029 */5030 5031 HWND winhCreateExtStdWindow(PEXTFRAMECDATA pData, // in: extended frame data5032 PHWND phwndClient) // out: created client wnd5033 {5034 HWND hwndFrame;5035 5036 if (hwndFrame = winhCreateStdWindow(HWND_DESKTOP,5037 pData->pswpFrame,5038 pData->flFrameCreateFlags,5039 pData->ulFrameStyle,5040 pData->pcszFrameTitle,5041 pData->ulResourcesID,5042 pData->pcszClassClient,5043 pData->flStyleClient,5044 pData->ulID,5045 pData->pClientCtlData,5046 phwndClient))5047 {5048 if (pData->flExtFlags & XFCF_STATUSBAR)5049 {5050 // create status bar as child of the frame5051 HWND hwndStatusBar = winhCreateStatusBar(hwndFrame,5052 hwndFrame,5053 "",5054 "9.WarpSans",5055 CLR_BLACK);5056 5057 // subclass frame for supporting status bar and msgs5058 PEXTFRAMEDATA pFrameData;5059 if (pFrameData = NEW(EXTFRAMEDATA))5060 {5061 ZERO(pFrameData),5062 memcpy(&pFrameData->CData, pData, sizeof(pFrameData->CData));5063 if (pFrameData->pfnwpOrig = WinSubclassWindow(hwndFrame,5064 fnwpSubclExtFrame))5065 {5066 WinSetWindowPtr(hwndFrame, QWL_USER, pFrameData);5067 }5068 else5069 free(pFrameData);5070 }5071 }5072 }5073 5074 return hwndFrame;5075 }5076 5077 /*5078 4868 *@@category: Helpers\PM helpers\Workplace Shell\WPS class list 5079 4869 */ … … 5156 4946 while (pocThis) 5157 4947 { 5158 if ( strcmp(pocThis->pszClassName, pszClass) == 0)4948 if (!strcmp(pocThis->pszClassName, pszClass)) 5159 4949 { 5160 4950 pbReturn = (PBYTE)pocThis; 5161 4951 break; 5162 4952 } 4953 5163 4954 // next class 5164 4955 pocThis = pocThis->pNext; … … 5237 5028 // failed: do more error checking then, try DosLoadModule 5238 5029 HMODULE hmod = NULLHANDLE; 5239 arc = DosLoadModule(pszBuf, cbBuf, 5240 (PSZ)pcszModule, 5241 &hmod); 5242 if (arc == NO_ERROR) 5030 if (!(arc = DosLoadModule(pszBuf, cbBuf, 5031 (PSZ)pcszModule, 5032 &hmod))) 5243 5033 { 5244 5034 // DosLoadModule succeeded: … … 5266 5056 { 5267 5057 BOOL brc = FALSE; 5268 PBYTE pClassList = winhQueryWPSClassList(); 5269 if (pClassList) 5058 PBYTE pClassList; 5059 5060 if (pClassList = winhQueryWPSClassList()) 5270 5061 { 5271 5062 if (winhQueryWPSClass(pClassList, pcszClass)) 5272 5063 brc = TRUE; 5064 5273 5065 free(pClassList); 5274 5066 } … … 5331 5123 return ulrc; 5332 5124 } 5125
Note:
See TracChangeset
for help on using the changeset viewer.