Changeset 551 for trunk/dll/sysinfo.c
- Timestamp:
- Feb 28, 2007, 2:33:51 AM (19 years ago)
- File:
-
- 1 edited
-
trunk/dll/sysinfo.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/sysinfo.c
r404 r551 34 34 #pragma alloc_text(SYSINFO,SysInfoDlgProc,RunRmview) 35 35 36 VOID RunRmview (VOID *arg)36 VOID RunRmview(VOID * arg) 37 37 { 38 HWND hwnd = (HWND)arg;39 CHAR s[2048],*p;40 HAB thab;41 HMQ thmq;38 HWND hwnd = (HWND) arg; 39 CHAR s[2048], *p; 40 HAB thab; 41 HMQ thmq; 42 42 FILE *fp; 43 HFILE oldstdout, newstdout;43 HFILE oldstdout, newstdout; 44 44 45 45 DosError(FERR_DISABLEHARDERR); 46 46 47 47 thab = WinInitialize(0); 48 thmq = WinCreateMsgQueue(thab, 0);49 WinCancelShutdown(thmq, TRUE);50 if (thab && thmq) {51 if (!WinIsWindow(thab,hwnd))48 thmq = WinCreateMsgQueue(thab, 0); 49 WinCancelShutdown(thmq, TRUE); 50 if (thab && thmq) { 51 if (!WinIsWindow(thab, hwnd)) 52 52 goto Abort; 53 unlinkf("%s", "$RMVIEW.#$#");54 fp = xfopen("$RMVIEW.#$#", "w", pszSrcFile, __LINE__);53 unlinkf("%s", "$RMVIEW.#$#"); 54 fp = xfopen("$RMVIEW.#$#", "w", pszSrcFile, __LINE__); 55 55 if (!fp) 56 56 goto Abort; 57 57 else { 58 58 newstdout = -1; 59 if (DosDupHandle(fileno(stdout),&newstdout)) {60 fclose(fp);61 goto Abort;59 if (DosDupHandle(fileno(stdout), &newstdout)) { 60 fclose(fp); 61 goto Abort; 62 62 } 63 63 oldstdout = fileno(stdout); 64 DosDupHandle(fileno(fp), &oldstdout);64 DosDupHandle(fileno(fp), &oldstdout); 65 65 runemf2(SEPARATE | INVISIBLE | FULLSCREEN | BACKGROUND | WAIT, 66 hwnd,NULL,NULL,"%s","RMVIEW.EXE");66 hwnd, NULL, NULL, "%s", "RMVIEW.EXE"); 67 67 oldstdout = fileno(stdout); 68 DosDupHandle(newstdout, &oldstdout);68 DosDupHandle(newstdout, &oldstdout); 69 69 DosClose(newstdout); 70 70 fclose(fp); 71 71 } 72 if (!WinIsWindow(thab, hwnd))72 if (!WinIsWindow(thab, hwnd)) 73 73 goto Abort; 74 fp = xfopen("$RMVIEW.#$#", "r",pszSrcFile,__LINE__);74 fp = xfopen("$RMVIEW.#$#", "r", pszSrcFile, __LINE__); 75 75 if (fp) { 76 xfgets(s,sizeof(s),fp,pszSrcFile,__LINE__); 77 xfgets(s,sizeof(s),fp,pszSrcFile,__LINE__); 78 if(!feof(fp) && WinIsWindow(thab,hwnd)) 79 WinSendDlgItemMsg(hwnd,SYS_LISTBOX,LM_INSERTITEM, 80 MPFROM2SHORT(LIT_END,0), 81 MPFROMP(" -= RMView Physical Info =-")); 82 while(!feof(fp)) { 83 strset(s,0); 84 if(!xfgets(s,sizeof(s),fp,pszSrcFile,__LINE__)) 85 break; 86 stripcr(s); 87 rstrip(s); 88 p = s; 89 while(*p == '\r' || *p == '\n') 90 p++; 91 if(!WinIsWindow(thab,hwnd)) 92 break; 93 WinSendDlgItemMsg(hwnd,SYS_LISTBOX,LM_INSERTITEM, 94 MPFROM2SHORT(LIT_END,0), 95 MPFROMP(p)); 76 xfgets(s, sizeof(s), fp, pszSrcFile, __LINE__); 77 xfgets(s, sizeof(s), fp, pszSrcFile, __LINE__); 78 if (!feof(fp) && WinIsWindow(thab, hwnd)) 79 WinSendDlgItemMsg(hwnd, SYS_LISTBOX, LM_INSERTITEM, 80 MPFROM2SHORT(LIT_END, 0), 81 MPFROMP(" -= RMView Physical Info =-")); 82 while (!feof(fp)) { 83 strset(s, 0); 84 if (!xfgets(s, sizeof(s), fp, pszSrcFile, __LINE__)) 85 break; 86 stripcr(s); 87 rstrip(s); 88 p = s; 89 while (*p == '\r' || *p == '\n') 90 p++; 91 if (!WinIsWindow(thab, hwnd)) 92 break; 93 WinSendDlgItemMsg(hwnd, SYS_LISTBOX, LM_INSERTITEM, 94 MPFROM2SHORT(LIT_END, 0), MPFROMP(p)); 96 95 } 97 96 fclose(fp); 98 97 } 99 Abort:98 Abort: 100 99 WinDestroyMsgQueue(thmq); 101 100 WinTerminate(thab); … … 104 103 } 105 104 106 MRESULT EXPENTRY SysInfoDlgProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2)105 MRESULT EXPENTRY SysInfoDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) 107 106 { 108 static HWND me = (HWND)0; 109 static LONG ypos = 0; 110 static HPOINTER hptrIcon = (HPOINTER)0; 111 112 switch(msg) { 113 case WM_INITDLG: 114 if(me) { 115 WinSetWindowPos(me,HWND_TOP,0,0,0,0,SWP_ACTIVATE | 116 SWP_SHOW | SWP_RESTORE | SWP_ZORDER); 117 WinDismissDlg(hwnd,0); 118 break; 119 } 120 hptrIcon = WinLoadPointer(HWND_DESKTOP,FM3ModHandle,SYS_FRAME); 121 WinDefDlgProc(hwnd,WM_SETICON,MPFROMLONG(hptrIcon),MPVOID); 122 { 123 static CHAR *names[] = {"Max. Path Length", /* 1 */ 124 "Max. Text Sessions", /* 2 */ 125 "Max. PM Sessions", /* 3 */ 126 "Max. VDM Sessions", /* 4 */ 127 "Boot Drive", /* 5 */ 128 "Dynamic Priority", /* 6 */ 129 "Max. Wait", /* 7 */ 130 "Min. Timeslice", /* 8 */ 131 "Max. Timeslice", /* 9 */ 132 "Page Size", /* 10 */ 133 "Version Major", /* 11 */ 134 "Version Minor", /* 12 */ 135 "Version Revision", /* 13 */ 136 "Millisecs Up", /* 14 */ 137 "Unixtime Low", /* 15 */ 138 "Unixtime High", /* 16 */ 139 "Physical Memory", /* 17 */ 140 "Resident Memory", /* 18 */ 141 "Total Available Memory", /* 19 */ 142 "Max. Private Memory", /* 20 */ 143 "Max. Shared Memory", /* 21 */ 144 "Timer Interval", /* 22 */ 145 "Max. Path Comp. Length", /* 23 */ 146 "Foreground FS Session ID", /* 24 */ 147 "Foreground Process PID", /* 25 */ 148 NULL}; 149 static CHAR *pnames[] = {"Swap button", 150 "Dblclk time", 151 "CX dblclk", 152 "CY dblclk", 153 "CX sizeborder", 154 "CY sizeborder", 155 "Alarm", 156 "", 157 "", 158 "Cursor rate", 159 "First scroll rate", 160 "Scroll rate", 161 "Numbered lists", 162 "Warning freq", 163 "Note freq", 164 "Error freq", 165 "Warning duration", 166 "Note duration", 167 "Error duration", 168 "", 169 "CX screen", 170 "CY screen", 171 "CX vscroll", 172 "CY hscroll", 173 "CY vscroll arrow", 174 "CX hscroll arrow", 175 "CX border", 176 "CY border", 177 "CX dlgframe", 178 "CY dlgframe", 179 "CY titlebar", 180 "CY vslider", 181 "CX hslider", 182 "CX minmaxbutton", 183 "CY minmaxbutton", 184 "CY menu", 185 "CX fullscreen", 186 "CY fullscreen", 187 "CX icon", 188 "CY icon", 189 "CX pointer", 190 "CY pointer", 191 "Debug", 192 "# Mouse buttons", 193 "Pointer level", 194 "Cursor level", 195 "Track rect level", 196 "# timers", 197 "Mouse present", 198 "CX bytealign", 199 "CY bytealign", 200 "", 201 "", 202 "", 203 "", 204 "", 205 "Not reserved", 206 "Extra key beep", 207 "Set lights", 208 "Insert mode", 209 "", 210 "", 211 "", 212 "", 213 "Menu rolldown delay", 214 "Menu rollup delay", 215 "Alt mnemonic", 216 "Tasklist mouse access", 217 "CX icon text width", 218 "# Icon text lines", 219 "Chord time", 220 "CX chord", 221 "CY chord", 222 "CX motion", 223 "CY motion", 224 "Begin drag", 225 "End drag", 226 "Single select", 227 "Open", 228 "Context menu", 229 "Context help", 230 "Text edit", 231 "Begin select", 232 "End select", 233 "Begin drag kb", 234 "End drag kb", 235 "Select kb", 236 "Open kb", 237 "Context menu kb", 238 "Context help kb", 239 "Text edit kb", 240 "Begin select kb", 241 "End select kb", 242 "Animation", 243 "Animation speed", 244 "Mono icons", 245 "Kbd id", 246 "Print screen", 247 NULL}; 248 static CHAR *dnames[] = {"# printers", 249 "# RS232 ports", 250 "# diskette drives", 251 "Coprocessor present", 252 "PC submodel", 253 "PC model", 254 "Display", 255 NULL}; 256 ULONG vals[26],val,x; 257 CHAR s[134],dev; 258 259 if(DosQuerySysInfo(QSV_MAX_PATH_LENGTH,QSV_MAX_COMP_LENGTH + 2L, 260 (PVOID)vals,(ULONG)sizeof(vals))) { 261 WinDismissDlg(hwnd,0); 262 break; 263 } 264 me = hwnd; 265 WinSendDlgItemMsg(hwnd,SYS_LISTBOX,LM_INSERTITEM, 266 MPFROMLONG(LIT_END), 267 MPFROMP(" -= Base OS Info =-")); 268 for(x = 0;names[x];x++) { 269 switch(x) { 270 case 0: 271 case 9: 272 case 22: 273 sprintf(s,"%-28.28s%lu bytes",names[x],vals[x]); 274 break; 275 case 16: 276 case 17: 277 case 18: 278 case 19: 279 case 20: 280 sprintf(s,"%-28.28s%lu bytes (%lu mb)",names[x],vals[x], 281 vals[x] / (1024 * 1024)); 282 break; 283 case 4: 284 sprintf(s,"%-28.28s%c:",names[x],(CHAR)vals[x] + '@'); 285 break; 286 case 5: 287 sprintf(s,"%-28.28s%s",names[x],(vals[x]) ? "On" : "Off"); 288 break; 289 case 6: 290 sprintf(s,"%-28.28s%lu seconds",names[x],vals[x]); 291 break; 292 case 7: 293 case 8: 294 sprintf(s,"%-28.28s%lu milliseconds",names[x],vals[x]); 295 break; 296 case 13: 297 { 298 ULONG numdays,nummins; 299 300 sprintf(s,"%-28.28s%lu (",names[x],vals[x]); 301 vals[x] /= 60000L; 302 numdays = vals[x] / (60L * 24L); 303 if(numdays) 304 sprintf(s + strlen(s),"%lu day%s, ",numdays,&"s"[numdays == 1L]); 305 nummins = vals[x] % (60L * 24L); 306 sprintf(s + strlen(s),"%luh:%02lum)",nummins / 60,nummins % 60); 307 } 308 break; 309 case 21: 310 sprintf(s,"%-28.28s%lu.%01lu milliseconds",names[x], 311 vals[x] / 10,vals[x] % 10); 312 break; 313 default: 314 sprintf(s,"%-28.28s%lu",names[x],vals[x]); 315 break; 316 } 317 if(*s) 318 WinSendDlgItemMsg(hwnd,SYS_LISTBOX,LM_INSERTITEM, 319 MPFROMLONG(LIT_END),MPFROMP(s)); 320 } 321 WinSendDlgItemMsg(hwnd,SYS_LISTBOX,LM_INSERTITEM, 322 MPFROMLONG(LIT_END), 323 MPFROMP(" -= PM Info =-")); 324 for(x = 0;pnames[x];x++) { 325 if(*pnames[x]) { 326 val = WinQuerySysValue(HWND_DESKTOP,x); 327 switch(x) { 328 case SV_CXBYTEALIGN: 329 case SV_CYBYTEALIGN: 330 case SV_CYMOTIONSTART: 331 case SV_CXMOTIONSTART: 332 case SV_CYDBLCLK: 333 case SV_CXDBLCLK: 334 case SV_CYPOINTER: 335 case SV_CXPOINTER: 336 case SV_CYICON: 337 case SV_CXICON: 338 case SV_CXFULLSCREEN: 339 case SV_CYFULLSCREEN: 340 case SV_CYMENU: 341 case SV_CYMINMAXBUTTON: 342 case SV_CXMINMAXBUTTON: 343 case SV_CXHSLIDER: 344 case SV_CYVSLIDER: 345 case SV_CXDLGFRAME: 346 case SV_CYDLGFRAME: 347 case SV_CXSIZEBORDER: 348 case SV_CYSIZEBORDER: 349 case SV_CXBORDER: 350 case SV_CYBORDER: 351 case SV_CYTITLEBAR: 352 case SV_CXHSCROLLARROW: 353 case SV_CYVSCROLLARROW: 354 case SV_CXVSCROLL: 355 case SV_CYHSCROLL: 356 case SV_CYSCREEN: 357 case SV_CXSCREEN: 358 case SV_CXICONTEXTWIDTH: 359 case SV_CXCHORD: 360 case SV_CYCHORD: 361 sprintf(s,"%-28.28s%lu pels",pnames[x],val); 362 break; 363 case SV_CONTEXTMENU: 364 case SV_OPEN: 365 case SV_TEXTEDIT: 366 case SV_BEGINSELECT: 367 case SV_ENDSELECT: 368 case SV_BEGINDRAG: 369 case SV_ENDDRAG: 370 case SV_CONTEXTHELP: 371 case SV_SINGLESELECT: 372 sprintf(s,"%-28.28sWM: %04xh KC: %04xh",pnames[x], 373 LOUSHORT(val),HIUSHORT(val)); 374 break; 375 case SV_TASKLISTMOUSEACCESS: 376 sprintf(s,"%-28.28sWM: %04xh",pnames[x],LOUSHORT(val)); 377 break; 378 case SV_CONTEXTMENUKB: 379 case SV_TEXTEDITKB: 380 case SV_BEGINDRAGKB: 381 case SV_ENDDRAGKB: 382 case SV_SELECTKB: 383 case SV_OPENKB: 384 case SV_CONTEXTHELPKB: 385 case SV_BEGINSELECTKB: 386 case SV_ENDSELECTKB: 387 sprintf(s,"%-28.28sVK: %04xh KC: %04xh",pnames[x], 388 LOUSHORT(val),HIUSHORT(val)); 389 break; 390 case SV_CHORDTIME: 391 case SV_DBLCLKTIME: 392 case SV_CURSORRATE: 393 case SV_FIRSTSCROLLRATE: 394 case SV_SCROLLRATE: 395 case SV_MENUROLLDOWNDELAY: 396 case SV_MENUROLLUPDELAY: 397 case SV_ANIMATIONSPEED: 398 case SV_WARNINGDURATION: 399 case SV_NOTEDURATION: 400 case SV_ERRORDURATION: 401 sprintf(s,"%-28.28s%lu milliseconds",pnames[x],val); 402 break; 403 case SV_MOUSEPRESENT: 404 sprintf(s,"%-28.28s%s",pnames[x],(val) ? "True" : "False"); 405 break; 406 case SV_ALARM: 407 case SV_ANIMATION: 408 case SV_MONOICONS: 409 case SV_PRINTSCREEN: 410 case SV_SETLIGHTS: 411 case SV_INSERTMODE: 412 case SV_SWAPBUTTON: 413 case SV_DEBUG: 414 sprintf(s,"%-28.28s%s",pnames[x],(val) ? "On" : "Off"); 415 break; 416 default: 417 sprintf(s,"%-28.28s%lu",pnames[x],val); 418 break; 419 } 420 WinSendDlgItemMsg(hwnd,SYS_LISTBOX,LM_INSERTITEM, 421 MPFROMLONG(LIT_END),MPFROMP(s)); 422 } 423 } 424 WinSendDlgItemMsg(hwnd,SYS_LISTBOX,LM_INSERTITEM, 425 MPFROMLONG(LIT_END), 426 MPFROMP(" -= Hardware info =-")); 427 for(x = 0;dnames[x];x++) { 428 if(*dnames[x]) { 429 if(!DosDevConfig(&dev,x)) { 430 switch(x) { 431 case DEVINFO_COPROCESSOR: 432 sprintf(s,"%-28.28s%s",dnames[x],(dev) ? "True" : "False"); 433 break; 434 case DEVINFO_ADAPTER: 435 sprintf(s,"%-28.28s%sMonochrome or printer",dnames[x], 436 (dev) ? "Not " : NullStr); 437 break; 438 default: 439 sprintf(s,"%-28.28s%lu",dnames[x],dev); 440 break; 441 } 442 } 443 WinSendDlgItemMsg(hwnd,SYS_LISTBOX,LM_INSERTITEM, 444 MPFROMLONG(LIT_END),MPFROMP(s)); 445 } 446 } 447 } 107 static HWND me = (HWND) 0; 108 static LONG ypos = 0; 109 static HPOINTER hptrIcon = (HPOINTER) 0; 110 111 switch (msg) { 112 case WM_INITDLG: 113 if (me) { 114 WinSetWindowPos(me, HWND_TOP, 0, 0, 0, 0, SWP_ACTIVATE | 115 SWP_SHOW | SWP_RESTORE | SWP_ZORDER); 116 WinDismissDlg(hwnd, 0); 448 117 break; 449 450 case WM_ADJUSTWINDOWPOS: 451 PostMsg(hwnd,UM_STRETCH,MPVOID,MPVOID); 452 break; 453 454 case UM_STRETCH: 455 { 456 SWP swpC,swp; 457 458 WinQueryWindowPos(hwnd,&swp); 459 if(!(swp.fl & (SWP_HIDE | SWP_MINIMIZE))) { 460 WinQueryWindowPos(WinWindowFromID(hwnd,SYS_LISTBOX),&swpC); 461 if(!ypos) 462 ypos = swpC.y; 463 WinSetWindowPos(WinWindowFromID(hwnd,SYS_LISTBOX),HWND_TOP, 464 SysVal(SV_CXSIZEBORDER), 465 ypos, 466 swp.cx - (SysVal(SV_CXSIZEBORDER) * 2), 467 (swp.cy - ypos) - (SysVal(SV_CYTITLEBAR) + 468 SysVal(SV_CYSIZEBORDER)), 469 SWP_MOVE | SWP_SIZE); 470 } 471 } 472 return 0; 473 474 case WM_COMMAND: 475 WinDismissDlg(hwnd,0); 476 return 0; 477 478 case WM_DESTROY: 479 if(me == hwnd) { 480 me = (HWND)0; 481 if(hptrIcon) 482 WinDestroyPointer(hptrIcon); 483 hptrIcon = (HPOINTER)0; 484 } 485 break; 118 } 119 hptrIcon = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, SYS_FRAME); 120 WinDefDlgProc(hwnd, WM_SETICON, MPFROMLONG(hptrIcon), MPVOID); 121 { 122 static CHAR *names[] = { "Max. Path Length", /* 1 */ 123 "Max. Text Sessions", /* 2 */ 124 "Max. PM Sessions", /* 3 */ 125 "Max. VDM Sessions", /* 4 */ 126 "Boot Drive", /* 5 */ 127 "Dynamic Priority", /* 6 */ 128 "Max. Wait", /* 7 */ 129 "Min. Timeslice", /* 8 */ 130 "Max. Timeslice", /* 9 */ 131 "Page Size", /* 10 */ 132 "Version Major", /* 11 */ 133 "Version Minor", /* 12 */ 134 "Version Revision", /* 13 */ 135 "Millisecs Up", /* 14 */ 136 "Unixtime Low", /* 15 */ 137 "Unixtime High", /* 16 */ 138 "Physical Memory", /* 17 */ 139 "Resident Memory", /* 18 */ 140 "Total Available Memory", /* 19 */ 141 "Max. Private Memory", /* 20 */ 142 "Max. Shared Memory", /* 21 */ 143 "Timer Interval", /* 22 */ 144 "Max. Path Comp. Length", /* 23 */ 145 "Foreground FS Session ID", /* 24 */ 146 "Foreground Process PID", /* 25 */ 147 NULL 148 }; 149 static CHAR *pnames[] = { "Swap button", 150 "Dblclk time", 151 "CX dblclk", 152 "CY dblclk", 153 "CX sizeborder", 154 "CY sizeborder", 155 "Alarm", 156 "", 157 "", 158 "Cursor rate", 159 "First scroll rate", 160 "Scroll rate", 161 "Numbered lists", 162 "Warning freq", 163 "Note freq", 164 "Error freq", 165 "Warning duration", 166 "Note duration", 167 "Error duration", 168 "", 169 "CX screen", 170 "CY screen", 171 "CX vscroll", 172 "CY hscroll", 173 "CY vscroll arrow", 174 "CX hscroll arrow", 175 "CX border", 176 "CY border", 177 "CX dlgframe", 178 "CY dlgframe", 179 "CY titlebar", 180 "CY vslider", 181 "CX hslider", 182 "CX minmaxbutton", 183 "CY minmaxbutton", 184 "CY menu", 185 "CX fullscreen", 186 "CY fullscreen", 187 "CX icon", 188 "CY icon", 189 "CX pointer", 190 "CY pointer", 191 "Debug", 192 "# Mouse buttons", 193 "Pointer level", 194 "Cursor level", 195 "Track rect level", 196 "# timers", 197 "Mouse present", 198 "CX bytealign", 199 "CY bytealign", 200 "", 201 "", 202 "", 203 "", 204 "", 205 "Not reserved", 206 "Extra key beep", 207 "Set lights", 208 "Insert mode", 209 "", 210 "", 211 "", 212 "", 213 "Menu rolldown delay", 214 "Menu rollup delay", 215 "Alt mnemonic", 216 "Tasklist mouse access", 217 "CX icon text width", 218 "# Icon text lines", 219 "Chord time", 220 "CX chord", 221 "CY chord", 222 "CX motion", 223 "CY motion", 224 "Begin drag", 225 "End drag", 226 "Single select", 227 "Open", 228 "Context menu", 229 "Context help", 230 "Text edit", 231 "Begin select", 232 "End select", 233 "Begin drag kb", 234 "End drag kb", 235 "Select kb", 236 "Open kb", 237 "Context menu kb", 238 "Context help kb", 239 "Text edit kb", 240 "Begin select kb", 241 "End select kb", 242 "Animation", 243 "Animation speed", 244 "Mono icons", 245 "Kbd id", 246 "Print screen", 247 NULL 248 }; 249 static CHAR *dnames[] = { "# printers", 250 "# RS232 ports", 251 "# diskette drives", 252 "Coprocessor present", 253 "PC submodel", 254 "PC model", 255 "Display", 256 NULL 257 }; 258 ULONG vals[26], val, x; 259 CHAR s[134], dev; 260 261 if (DosQuerySysInfo(QSV_MAX_PATH_LENGTH, QSV_MAX_COMP_LENGTH + 2L, 262 (PVOID) vals, (ULONG) sizeof(vals))) { 263 WinDismissDlg(hwnd, 0); 264 break; 265 } 266 me = hwnd; 267 WinSendDlgItemMsg(hwnd, SYS_LISTBOX, LM_INSERTITEM, 268 MPFROMLONG(LIT_END), MPFROMP(" -= Base OS Info =-")); 269 for (x = 0; names[x]; x++) { 270 switch (x) { 271 case 0: 272 case 9: 273 case 22: 274 sprintf(s, "%-28.28s%lu bytes", names[x], vals[x]); 275 break; 276 case 16: 277 case 17: 278 case 18: 279 case 19: 280 case 20: 281 sprintf(s, "%-28.28s%lu bytes (%lu mb)", names[x], vals[x], 282 vals[x] / (1024 * 1024)); 283 break; 284 case 4: 285 sprintf(s, "%-28.28s%c:", names[x], (CHAR) vals[x] + '@'); 286 break; 287 case 5: 288 sprintf(s, "%-28.28s%s", names[x], (vals[x]) ? "On" : "Off"); 289 break; 290 case 6: 291 sprintf(s, "%-28.28s%lu seconds", names[x], vals[x]); 292 break; 293 case 7: 294 case 8: 295 sprintf(s, "%-28.28s%lu milliseconds", names[x], vals[x]); 296 break; 297 case 13: 298 { 299 ULONG numdays, nummins; 300 301 sprintf(s, "%-28.28s%lu (", names[x], vals[x]); 302 vals[x] /= 60000L; 303 numdays = vals[x] / (60L * 24L); 304 if (numdays) 305 sprintf(s + strlen(s), "%lu day%s, ", numdays, 306 &"s"[numdays == 1L]); 307 nummins = vals[x] % (60L * 24L); 308 sprintf(s + strlen(s), "%luh:%02lum)", nummins / 60, 309 nummins % 60); 310 } 311 break; 312 case 21: 313 sprintf(s, "%-28.28s%lu.%01lu milliseconds", names[x], 314 vals[x] / 10, vals[x] % 10); 315 break; 316 default: 317 sprintf(s, "%-28.28s%lu", names[x], vals[x]); 318 break; 319 } 320 if (*s) 321 WinSendDlgItemMsg(hwnd, SYS_LISTBOX, LM_INSERTITEM, 322 MPFROMLONG(LIT_END), MPFROMP(s)); 323 } 324 WinSendDlgItemMsg(hwnd, SYS_LISTBOX, LM_INSERTITEM, 325 MPFROMLONG(LIT_END), MPFROMP(" -= PM Info =-")); 326 for (x = 0; pnames[x]; x++) { 327 if (*pnames[x]) { 328 val = WinQuerySysValue(HWND_DESKTOP, x); 329 switch (x) { 330 case SV_CXBYTEALIGN: 331 case SV_CYBYTEALIGN: 332 case SV_CYMOTIONSTART: 333 case SV_CXMOTIONSTART: 334 case SV_CYDBLCLK: 335 case SV_CXDBLCLK: 336 case SV_CYPOINTER: 337 case SV_CXPOINTER: 338 case SV_CYICON: 339 case SV_CXICON: 340 case SV_CXFULLSCREEN: 341 case SV_CYFULLSCREEN: 342 case SV_CYMENU: 343 case SV_CYMINMAXBUTTON: 344 case SV_CXMINMAXBUTTON: 345 case SV_CXHSLIDER: 346 case SV_CYVSLIDER: 347 case SV_CXDLGFRAME: 348 case SV_CYDLGFRAME: 349 case SV_CXSIZEBORDER: 350 case SV_CYSIZEBORDER: 351 case SV_CXBORDER: 352 case SV_CYBORDER: 353 case SV_CYTITLEBAR: 354 case SV_CXHSCROLLARROW: 355 case SV_CYVSCROLLARROW: 356 case SV_CXVSCROLL: 357 case SV_CYHSCROLL: 358 case SV_CYSCREEN: 359 case SV_CXSCREEN: 360 case SV_CXICONTEXTWIDTH: 361 case SV_CXCHORD: 362 case SV_CYCHORD: 363 sprintf(s, "%-28.28s%lu pels", pnames[x], val); 364 break; 365 case SV_CONTEXTMENU: 366 case SV_OPEN: 367 case SV_TEXTEDIT: 368 case SV_BEGINSELECT: 369 case SV_ENDSELECT: 370 case SV_BEGINDRAG: 371 case SV_ENDDRAG: 372 case SV_CONTEXTHELP: 373 case SV_SINGLESELECT: 374 sprintf(s, "%-28.28sWM: %04xh KC: %04xh", pnames[x], 375 LOUSHORT(val), HIUSHORT(val)); 376 break; 377 case SV_TASKLISTMOUSEACCESS: 378 sprintf(s, "%-28.28sWM: %04xh", pnames[x], LOUSHORT(val)); 379 break; 380 case SV_CONTEXTMENUKB: 381 case SV_TEXTEDITKB: 382 case SV_BEGINDRAGKB: 383 case SV_ENDDRAGKB: 384 case SV_SELECTKB: 385 case SV_OPENKB: 386 case SV_CONTEXTHELPKB: 387 case SV_BEGINSELECTKB: 388 case SV_ENDSELECTKB: 389 sprintf(s, "%-28.28sVK: %04xh KC: %04xh", pnames[x], 390 LOUSHORT(val), HIUSHORT(val)); 391 break; 392 case SV_CHORDTIME: 393 case SV_DBLCLKTIME: 394 case SV_CURSORRATE: 395 case SV_FIRSTSCROLLRATE: 396 case SV_SCROLLRATE: 397 case SV_MENUROLLDOWNDELAY: 398 case SV_MENUROLLUPDELAY: 399 case SV_ANIMATIONSPEED: 400 case SV_WARNINGDURATION: 401 case SV_NOTEDURATION: 402 case SV_ERRORDURATION: 403 sprintf(s, "%-28.28s%lu milliseconds", pnames[x], val); 404 break; 405 case SV_MOUSEPRESENT: 406 sprintf(s, "%-28.28s%s", pnames[x], (val) ? "True" : "False"); 407 break; 408 case SV_ALARM: 409 case SV_ANIMATION: 410 case SV_MONOICONS: 411 case SV_PRINTSCREEN: 412 case SV_SETLIGHTS: 413 case SV_INSERTMODE: 414 case SV_SWAPBUTTON: 415 case SV_DEBUG: 416 sprintf(s, "%-28.28s%s", pnames[x], (val) ? "On" : "Off"); 417 break; 418 default: 419 sprintf(s, "%-28.28s%lu", pnames[x], val); 420 break; 421 } 422 WinSendDlgItemMsg(hwnd, SYS_LISTBOX, LM_INSERTITEM, 423 MPFROMLONG(LIT_END), MPFROMP(s)); 424 } 425 } 426 WinSendDlgItemMsg(hwnd, SYS_LISTBOX, LM_INSERTITEM, 427 MPFROMLONG(LIT_END), MPFROMP(" -= Hardware info =-")); 428 for (x = 0; dnames[x]; x++) { 429 if (*dnames[x]) { 430 if (!DosDevConfig(&dev, x)) { 431 switch (x) { 432 case DEVINFO_COPROCESSOR: 433 sprintf(s, "%-28.28s%s", dnames[x], (dev) ? "True" : "False"); 434 break; 435 case DEVINFO_ADAPTER: 436 sprintf(s, "%-28.28s%sMonochrome or printer", dnames[x], 437 (dev) ? "Not " : NullStr); 438 break; 439 default: 440 sprintf(s, "%-28.28s%lu", dnames[x], dev); 441 break; 442 } 443 } 444 WinSendDlgItemMsg(hwnd, SYS_LISTBOX, LM_INSERTITEM, 445 MPFROMLONG(LIT_END), MPFROMP(s)); 446 } 447 } 448 } 449 break; 450 451 case WM_ADJUSTWINDOWPOS: 452 PostMsg(hwnd, UM_STRETCH, MPVOID, MPVOID); 453 break; 454 455 case UM_STRETCH: 456 { 457 SWP swpC, swp; 458 459 WinQueryWindowPos(hwnd, &swp); 460 if (!(swp.fl & (SWP_HIDE | SWP_MINIMIZE))) { 461 WinQueryWindowPos(WinWindowFromID(hwnd, SYS_LISTBOX), &swpC); 462 if (!ypos) 463 ypos = swpC.y; 464 WinSetWindowPos(WinWindowFromID(hwnd, SYS_LISTBOX), HWND_TOP, 465 SysVal(SV_CXSIZEBORDER), 466 ypos, 467 swp.cx - (SysVal(SV_CXSIZEBORDER) * 2), 468 (swp.cy - ypos) - (SysVal(SV_CYTITLEBAR) + 469 SysVal(SV_CYSIZEBORDER)), 470 SWP_MOVE | SWP_SIZE); 471 } 472 } 473 return 0; 474 475 case WM_COMMAND: 476 WinDismissDlg(hwnd, 0); 477 return 0; 478 479 case WM_DESTROY: 480 if (me == hwnd) { 481 me = (HWND) 0; 482 if (hptrIcon) 483 WinDestroyPointer(hptrIcon); 484 hptrIcon = (HPOINTER) 0; 485 } 486 break; 486 487 } 487 488 488 return WinDefDlgProc(hwnd, msg,mp1,mp2);489 return WinDefDlgProc(hwnd, msg, mp1, mp2); 489 490 } 490
Note:
See TracChangeset
for help on using the changeset viewer.
