home *** CD-ROM | disk | FTP | other *** search
- Larry Salomon, Jr.:
-
- SHORT winDisplayMessage(HWND hwndParent,
- HWND hwndOwner,
- ULONG ulStyle,
- HMODULE hmDll,
- USHORT usId,
- USHORT usHelpId,...)
- //------------------------------------------------
-
- // This function puts a message to the screen in
- // PM mode (using WinMessageBox).
-
- // The title of the message box is assumed to have
- // the message id usId|0x8000.
-
- //
- // Input: hwndParent - handle of the parent window
- // hwndOwner - handle of the owning window
- // ulStyle - specifies the WinMessageBox styles
- // hmDll - handle of the DLL containing the message
- // usId - specifies the id of the message to load
- // usHelpId - specifies the id of the
- corresponding help panel
- // Returns: TRUE if successful, FALSE otherwise
- //------------------------------------------------
- {
- CHAR achMsg[1024];
- CHAR achTitle[256];
- va_list vlArgs;
- CHAR achBuf[2048];
- ULONG ulRc;
-
- if (ulStyle==0L) {
- ulStyle=MB_INFORMATION | MB_OK;
- } /* endif */
-
- if ((ulStyle & MB_SYSTEMMODAL)==0) {
- ulStyle|=MB_APPLMODAL;
- } /* endif */
-
- if (usHelpId!=0) {
- ulStyle|=MB_HELP;
- } /* endif */
-
- ulStyle|=MB_MOVEABLE;
-
- //----------------------------------------------
- // Load the message box text and title
- //----------------------------------------------
- if (WinLoadString(NULLHANDLE,
- hmDll,
- usId,
- sizeof(achMsg),
- achMsg)==0) {
- return MBID_ERROR;
- } /* endif */
-
- if (WinLoadString(NULLHANDLE,
- hmDll,
- usId | 0x8000,
- sizeof(achTitle),
- achTitle)==0) {
- return MBID_ERROR;
- } /* endif */
-
- //----------------------------------------------
- // Format the message and display it
- //----------------------------------------------
- va_start(vlArgs,usHelpId);
- vsprintf(achBuf,achMsg,vlArgs);
- va_end(vlArgs);
-
- ulRc=WinMessageBox(hwndParent,
- hwndOwner,
- achBuf,
- achTitle,
- usHelpId,
- ulStyle);
- return ulRc;
- }
-
- VOID winCenterWindow(HWND hwndCenter)
- //------------------------------------------------
- // This function centers the window within its parent
- //
- // Input: hwndCenter - handle of the window to center
- //-----------------------------------------------
- {
- SWP swpCenter;
- RECTL rclParent;
-
- WinQueryWindowPos(hwndCenter,&swpCenter);
- WinQueryWindowRect(WinQueryWindow(hwndCenter,QW_PARENT),
- &rclParent);
-
- swpCenter.x=(rclParent.xRight-swpCenter.cx)/2;
- swpCenter.y=(rclParent.yTop-swpCenter.cy)/2;
-
-
- WinSetWindowPos(hwndCenter,NULLHANDLE,swpCenter.x,
- swpCenter.y,0,0,SWP_MOVE);
-
- }
-
-