1 /****************************************************************************
3 * Display Doctor Windows Interface Code
5 * ======================================================================
6 * |REMOVAL OR MODIFICATION OF THIS HEADER IS STRICTLY PROHIBITED BY LAW|
8 * |This copyrighted computer code is a proprietary trade secret of |
9 * |SciTech Software, Inc., located at 505 Wall Street, Chico, CA 95928 |
10 * |USA (www.scitechsoft.com). ANY UNAUTHORIZED POSSESSION, USE, |
11 * |VIEWING, COPYING, MODIFICATION OR DISSEMINATION OF THIS CODE IS |
12 * |STRICTLY PROHIBITED BY LAW. Unless you have current, express |
13 * |written authorization from SciTech to possess or use this code, you |
14 * |may be subject to civil and/or criminal penalties. |
16 * |If you received this code in error or you would like to report |
17 * |improper use, please immediately contact SciTech Software, Inc. at |
20 * |REMOVAL OR MODIFICATION OF THIS HEADER IS STRICTLY PROHIBITED BY LAW|
21 * ======================================================================
26 * Description: Dialog driven configuration program for UniVBE and
27 * WinDirect Professional products.
29 ****************************************************************************/
33 /*------------------------------ Implementation ---------------------------*/
35 void _EXPORT CenterWindow(HWND hWndCenter, HWND parent, BOOL repaint)
36 /****************************************************************************
38 * Function: CenterWindow
39 * Parameters: hWndCenter - Window to center
40 * parent - Handle for parent window
41 * repaint - true if window should be re-painted
43 * Description: Centers the specified window within the bounds of the
44 * specified parent window. If the parent window is NULL, then
45 * we center it using the Desktop window.
47 ****************************************************************************/
49 HWND hWndParent = (parent ? parent : GetDesktopWindow());
52 int CenterX,CenterY,Height,Width;
54 GetWindowRect(hWndParent, &RectParent);
55 GetWindowRect(hWndCenter, &RectCenter);
57 Width = (RectCenter.right - RectCenter.left);
58 Height = (RectCenter.bottom - RectCenter.top);
59 CenterX = ((RectParent.right - RectParent.left) - Width) / 2;
60 CenterY = ((RectParent.bottom - RectParent.top) - Height) / 2;
62 if ((CenterX < 0) || (CenterY < 0)) {
63 /* The Center Window is smaller than the parent window. */
64 if (hWndParent != GetDesktopWindow()) {
65 /* If the parent window is not the desktop use the desktop size. */
66 CenterX = (GetSystemMetrics(SM_CXSCREEN) - Width) / 2;
67 CenterY = (GetSystemMetrics(SM_CYSCREEN) - Height) / 2;
69 CenterX = (CenterX < 0) ? 0: CenterX;
70 CenterY = (CenterY < 0) ? 0: CenterY;
73 CenterX += RectParent.left;
74 CenterY += RectParent.top;
77 /* Copy the values into RectCenter */
78 RectCenter.left = CenterX;
79 RectCenter.right = CenterX + Width;
80 RectCenter.top = CenterY;
81 RectCenter.bottom = CenterY + Height;
83 /* Move the window to the new location */
84 MoveWindow(hWndCenter, RectCenter.left, RectCenter.top,
85 (RectCenter.right - RectCenter.left),
86 (RectCenter.bottom - RectCenter.top), repaint);
89 void _EXPORT CenterLogo(HWND hWndLogo, HWND hWndParent, int CenterY)
90 /****************************************************************************
92 * Function: CenterLogo
93 * Parameters: hWndLogo - Window to center
94 * hWndParent - Handle for parent window
95 * CenterY - Top coordinate for logo
97 * Description: Centers the specified window within the bounds of the
98 * specified parent window in the horizontal direction only.
100 ****************************************************************************/
104 int CenterX,Height,Width;
106 GetWindowRect(hWndParent, &RectParent);
107 GetWindowRect(hWndLogo, &RectCenter);
108 Width = (RectCenter.right - RectCenter.left);
109 Height = (RectCenter.bottom - RectCenter.top);
110 CenterX = ((RectParent.right - RectParent.left) - Width) / 2;
112 /* Copy the values into RectCenter */
113 RectCenter.left = CenterX;
114 RectCenter.right = CenterX + Width;
115 RectCenter.top = CenterY;
116 RectCenter.bottom = CenterY + Height;
118 /* Move the window to the new location */
119 MoveWindow(hWndLogo, RectCenter.left, RectCenter.top,
120 (RectCenter.right - RectCenter.left),
121 (RectCenter.bottom - RectCenter.top), false);