Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

miscutil.c

Go to the documentation of this file.
00001 /****************************************************************************\ 00002 * Module Name: minmax.c 00003 * 00004 * Copyright (c) 1985 - 1999, Microsoft Corporation 00005 * 00006 * Misc util functions 00007 * 00008 * 10-25-90 MikeHar Ported from Windows. 00009 * 14-Feb-1991 mikeke Added Revalidation code (None) 00010 \****************************************************************************/ 00011 00012 #include "precomp.h" 00013 #pragma hdrstop 00014 00015 00016 VOID ZapActiveAndFocus(VOID) 00017 { 00018 PQ pq = PtiCurrent()->pq; 00019 00020 Unlock(&pq->spwndActive); 00021 Unlock(&pq->spwndFocus); 00022 } 00023 00024 VOID SetDialogPointer(PWND pwnd, LONG_PTR lPtr) { 00025 00026 if ((pwnd->cbwndExtra < DLGWINDOWEXTRA) 00027 || TestWF(pwnd, WFSERVERSIDEPROC) 00028 || (PpiCurrent() != GETPTI(pwnd)->ppi)) { 00029 RIPMSG1(RIP_WARNING, "SetDialogPointer: Unexpected pwnd:%#p", pwnd); 00030 return; 00031 } 00032 00033 ((PDIALOG)pwnd)->pdlg = (PDLG)lPtr; 00034 00035 if (lPtr == 0) { 00036 pwnd->fnid |= FNID_CLEANEDUP_BIT; 00037 ClrWF(pwnd, WFDIALOGWINDOW); 00038 } else { 00039 if (pwnd->fnid == 0) { 00040 pwnd->fnid = FNID_DIALOG; 00041 } 00042 SetWF(pwnd, WFDIALOGWINDOW); 00043 } 00044 00045 00046 } 00047 00048 BOOL _SetProgmanWindow(PWND pwnd) { 00049 00050 PDESKTOPINFO pdeskinfo = GETDESKINFO(PtiCurrent()); 00051 00052 if (pwnd != NULL) { 00053 // Fail the call if another shell window exists 00054 if (pdeskinfo->spwndProgman != NULL) 00055 return(FALSE); 00056 } 00057 00058 Lock(&pdeskinfo->spwndProgman, pwnd); 00059 00060 return(TRUE); 00061 } 00062 00063 BOOL _SetTaskmanWindow(PWND pwnd) { 00064 00065 PDESKTOPINFO pdeskinfo = GETDESKINFO(PtiCurrent()); 00066 00067 if (pwnd != NULL) { 00068 // Fail the call if another shell window exists 00069 if (pdeskinfo->spwndTaskman != NULL) 00070 return(FALSE); 00071 } 00072 00073 Lock(&pdeskinfo->spwndTaskman, pwnd); 00074 00075 return(TRUE); 00076 } 00077 00078 /***************************************************************************\ 00079 * 00080 * SetShellWindow() 00081 * 00082 * Returns true if shell window is successfully set. Note that we return 00083 * FALSE if a shell window already exists. I.E., this works on a first 00084 * come, first serve basis. 00085 * 00086 * We also do NOT allow child windows to be shell windows. Other than that, 00087 * it's up to the caller to size her window appropriately. 00088 * 00089 * The pwndBkGnd is provided for the explorer shell. Since the shellwnd 00090 * and the window which does the drawing of background wallpapers are 00091 * different, we need to provide means by which we can draw directly on 00092 * the background window during hung-app drawing. The pwnd and pwndBkGnd 00093 * will be identical if called through the SetShellWindow() api. 00094 * 00095 * 00096 \***************************************************************************/ 00097 BOOL xxxSetShellWindow(PWND pwnd, PWND pwndBkGnd) 00098 { 00099 PTHREADINFO ptiCurrent = PtiCurrent(); 00100 PDESKTOPINFO pdeskinfo = GETDESKINFO(ptiCurrent); 00101 00102 PPROCESSINFO ppiShellProcess; 00103 00104 UserAssert(pwnd); 00105 00106 /* 00107 * Fail the call if another shell window exists 00108 */ 00109 if (pdeskinfo->spwndShell != NULL) 00110 return(FALSE); 00111 00112 /* 00113 * The shell window must be 00114 * (1) Top-level 00115 * (2) Unowned 00116 * (3) Not topmost 00117 */ 00118 if (TestwndChild(pwnd) || 00119 (pwnd->spwndOwner != NULL) || 00120 TestWF(pwnd, WEFTOPMOST)) { 00121 00122 RIPMSG0(RIP_WARNING, "xxxSetShellWindow: Invalid type of window"); 00123 return(FALSE); 00124 } 00125 00126 /* 00127 * Chicago has a totally different input model which has special code 00128 * that checks for Ctrl-Esc and sends it to the shell. We can get 00129 * the same functionality, without totally re-writing our input model 00130 * by just automatically installing the Ctrl-Esc as a hotkey for the 00131 * shell window. The hotkey delivery code has a special case which 00132 * turns this into a WM_SYSCOMMAND message instead of a WM_HOTKEY 00133 * message. 00134 * 00135 * We don't both checking for failure. Somebody could already have 00136 * a Ctrl-Esc handler installed. 00137 */ 00138 _RegisterHotKey(pwnd,SC_TASKLIST,MOD_CONTROL,VK_ESCAPE); 00139 00140 /* 00141 * This is the shell window wright. 00142 * So get the process id for the shell. 00143 */ 00144 ppiShellProcess = GETPTI(pwnd)->ppi; 00145 00146 /* 00147 * Set the shell process id to the desktop only if it's the first instance 00148 */ 00149 if ((ppiShellProcess != NULL) && (pdeskinfo->ppiShellProcess == NULL)) { 00150 pdeskinfo->ppiShellProcess = ppiShellProcess; 00151 } 00152 00153 Lock(&pdeskinfo->spwndShell, pwnd); 00154 Lock(&pdeskinfo->spwndBkGnd, pwndBkGnd); 00155 00156 /* 00157 * Push window to bottom of stack. 00158 */ 00159 SetWF(pdeskinfo->spwndShell, WFBOTTOMMOST); 00160 xxxSetWindowPos(pdeskinfo->spwndShell, 00161 PWND_BOTTOM, 00162 0, 00163 0, 00164 0, 00165 0, 00166 SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); 00167 00168 return(TRUE); 00169 } 00170 00171 00172 00173 00174 /***************************************************************************\ 00175 * _InitPwSB() 00176 * 00177 * History: 00178 * 10-23-90 MikeHar Ported from WaWaWaWindows. 00179 * 11-28-90 JimA Changed to int * 00180 * 01-21-91 IanJa Prefix '_' denoting exported function (although not API) 00181 \***************************************************************************/ 00182 00183 PSBINFO _InitPwSB( 00184 PWND pwnd) 00185 { 00186 if (pwnd->pSBInfo) { 00187 00188 /* 00189 * If memory is already allocated, don't bother to do it again. 00190 */ 00191 return pwnd->pSBInfo; 00192 } 00193 00194 pwnd->pSBInfo = (PSBINFO)DesktopAlloc(pwnd->head.rpdesk, 00195 sizeof(SBINFO), 00196 DTAG_SBINFO); 00197 00198 if (pwnd->pSBInfo != NULL) { 00199 00200 /* 00201 * rgw[0] = 0; */ /* LPTR zeros all 6 words 00202 */ 00203 00204 /* 00205 * rgw[1] = 0; 00206 */ 00207 00208 /* 00209 * rgw[3] = 0; 00210 */ 00211 00212 /* 00213 * rgw[4] = 0; 00214 */ 00215 pwnd->pSBInfo->Vert.posMax = 100; 00216 pwnd->pSBInfo->Horz.posMax = 100; 00217 } 00218 00219 return pwnd->pSBInfo; 00220 } 00221

Generated on Sat May 15 19:40:49 2004 for test by doxygen 1.3.7