|
|
1.1 ! root 1: /*==============================================================*\ ! 2: * Vmm_dlg.c - window procedures for the dialog boxes as well * ! 3: * as utility procedures used by them * ! 4: * Created 1990, Microsoft, IBM Corp. * ! 5: *--------------------------------------------------------------* ! 6: * * ! 7: * This module contains the Dialog Procedures for the user * ! 8: * defined dialogs as well as any support code they need * ! 9: * * ! 10: *--------------------------------------------------------------* ! 11: * * ! 12: * This source file contains the following functions: * ! 13: * * ! 14: * AboutBoxWndProc(hwnd, msg, mp1, mp2) * ! 15: * AllocMemDlgProc(hwnd, msg, mp1, mp2) * ! 16: * SetMem1DlgProc( hwnd, msg, mp1, mp2) * ! 17: * SetMem2DlgProc( hwnd, msg, mp1, mp2) * ! 18: * ReadMemDlgProc( hwnd, msg, mp1, mp2) * ! 19: * WriteMemDlgProc(hwnd, msg, mp1, mp2) * ! 20: * FreeMemDlgProc( hwnd, msg, mp1, mp2) * ! 21: * * ! 22: * CheckBox( hwnd, ulMask, idBox) * ! 23: * QueryCheckBox(hwnd, ulMask, idBox) * ! 24: * * ! 25: \*==============================================================*/ ! 26: ! 27: /*--------------------------------------------------------------*\ ! 28: * Include files, macros, defined constants, and externs * ! 29: \*--------------------------------------------------------------*/ ! 30: ! 31: #define LINT_ARGS ! 32: ! 33: #define INCL_WIN ! 34: #define INCL_GPI ! 35: #define INCL_DOSPROCESS ! 36: #include <os2.h> ! 37: #include <stdio.h> ! 38: #include <stdlib.h> ! 39: #include <string.h> ! 40: ! 41: #include "vmm_main.h" ! 42: #include "vmm_dlg.h" ! 43: #include "vmm_xtrn.h" ! 44: ! 45: #define MAX_EDIT_BUFF 10 /* length of string to query from edit controls */ ! 46: ! 47: #define SZDEFAULT_SIZE "1" /* default number of bytes to set attributes for ! 48: when setting attributes of a block, ! 49: this will cause the attributes to be set for ! 50: one page */ ! 51: ! 52: extern CHAR szWindowText[]; ! 53: ! 54: /*--------------------------------------------------------------*\ ! 55: * Global variables * ! 56: \*--------------------------------------------------------------*/ ! 57: ! 58: extern char szBuffer[]; ! 59: ! 60: extern ULONG ulFreePage; /* First free page entry in array */ ! 61: ! 62: extern PAGEENTRY apgentry[MAXPAGES]; /* Application page table */ ! 63: ! 64: ! 65: /*--------------------------------------------------------------*\ ! 66: * Entry point declarations * ! 67: \*--------------------------------------------------------------*/ ! 68: ! 69: MRESULT EXPENTRY AboutBoxWndProc(HWND hwnd, USHORT msg, ! 70: MPARAM mp1, MPARAM mp2); ! 71: ! 72: VOID CheckBox(HWND hwnd, ULONG ulMask, USHORT idBox); ! 73: ULONG QueryCheckBox(HWND hwnd, ULONG ulMask, USHORT idBox); ! 74: ! 75: extern VOID VMM_Error(PSZ pszFunction, ULONG ulErrorCode); ! 76: ! 77: /****************************************************************\ ! 78: * Routine to set the state of a checkbox * ! 79: *--------------------------------------------------------------* ! 80: * * ! 81: * Name: CheckBox(hwnd, ulMask, idBox) * ! 82: * * ! 83: * Purpose: Sets the state of a checkbox or radio button * ! 84: * * ! 85: * Usage: If ulMask is true it checks the button, otherwise * ! 86: * it unchecks the button. * ! 87: * * ! 88: * Method: Send a BM_SETCHECK message to the appropriate * ! 89: * button * ! 90: * * ! 91: * Returns: None. * ! 92: * * ! 93: \****************************************************************/ ! 94: ! 95: ! 96: VOID CheckBox(HWND hwnd, ULONG ulMask, USHORT idBox) ! 97: { ! 98: WinSendDlgItemMsg(hwnd, ! 99: idBox, ! 100: BM_SETCHECK, ! 101: MPFROMSHORT( ulMask ? 1 : 0), ! 102: 0L); ! 103: } ! 104: ! 105: /****************************************************************\ ! 106: * Routine to query the state of a checkbox * ! 107: *--------------------------------------------------------------* ! 108: * * ! 109: * Name: QueryCheckBox(hwnd, ulMask, idBox) * ! 110: * * ! 111: * Purpose: This routine makes querying the * ! 112: * state of a checkbox or radio button cleaner by * ! 113: * hiding the details of sending the message to * ! 114: * the button and checking the return value. * ! 115: * * ! 116: * Usage: * ! 117: * * ! 118: * Method: Send a BM_QUERYCHECK to the control and checks * ! 119: * the return value. * ! 120: * * ! 121: * Returns: The value passed in ulMask if the button is * ! 122: * checked * ! 123: * * ! 124: \****************************************************************/ ! 125: ! 126: ! 127: ULONG QueryCheckBox(HWND hwnd, ULONG ulMask, USHORT idBox) ! 128: { ! 129: return( (WinSendDlgItemMsg(hwnd, ! 130: idBox, ! 131: BM_QUERYCHECK, ! 132: 0L, ! 133: 0L) == (MRESULT) 1L) ? ulMask : 0L); ! 134: } ! 135: ! 136: ! 137: /****************************************************************\ ! 138: * Dialog procedure for the About dialog box * ! 139: *--------------------------------------------------------------* ! 140: * * ! 141: * Name: AboutBoxWndProc(hwnd, msg, mp1, mp2) * ! 142: * * ! 143: * Purpose: Processes all messages sent to the About Box * ! 144: * * ! 145: * Usage: Called for each message sent to the About Box * ! 146: * dialog box. ! 147: * * ! 148: * Method: the about box only has a button control so this * ! 149: * routine only processes WM_COMMAND messages. Any * ! 150: * WM_COMMAND posted must have come from the Ok * ! 151: * button so we dismiss the dialog upon receiving it. * ! 152: * * ! 153: * Returns: Dependent upon message sent * ! 154: * * ! 155: \****************************************************************/ ! 156: ! 157: MRESULT EXPENTRY AboutBoxWndProc(hwnd, msg, mp1, mp2) ! 158: HWND hwnd; /* handle of window */ ! 159: USHORT msg; /* id of message */ ! 160: MPARAM mp1; /* first message parameter */ ! 161: MPARAM mp2; /* second message parameter */ ! 162: { ! 163: switch(msg) { ! 164: case WM_COMMAND: ! 165: /* no matter what the command, close the dialog */ ! 166: WinDismissDlg(hwnd, TRUE); ! 167: break; ! 168: ! 169: default: ! 170: return(WinDefDlgProc(hwnd, msg, mp1, mp2)); ! 171: break; ! 172: } ! 173: ! 174: return 0L; ! 175: ! 176: } /* AboutBoxWndProc() */ ! 177: ! 178: ! 179: /****************************************************************\ ! 180: * Dialog procedure for the Allocate Memory dialog * ! 181: *--------------------------------------------------------------* ! 182: * * ! 183: * Name: AllocMemDlgProc(hwnd, msg, mp1, mp2) * ! 184: * * ! 185: * Purpose: Processes all messages sent to the AllocMem * ! 186: * dialog * ! 187: * * ! 188: * Usage: Called for each message sent to the * ! 189: * dialog box. * ! 190: * * ! 191: * Method: a switch statement branches to the routines to be * ! 192: * performed for each message processed. Any messages * ! 193: * not specifically processed are passed to the * ! 194: * default window procedure WinDefDlgProc() * ! 195: * * ! 196: * Returns: Dependent upon message sent * ! 197: * * ! 198: \****************************************************************/ ! 199: ! 200: MRESULT EXPENTRY AllocMemDlgProc(HWND hwnd, USHORT msg, MPARAM mp1, MPARAM mp2) ! 201: { ! 202: static POBJSTRUCT pObj; ! 203: ! 204: switch (msg) { ! 205: case WM_INITDLG: ! 206: ! 207: pObj = PVOIDFROMMP(mp2); ! 208: ! 209: ltoa( (pObj->ulSize) ,(char *) szBuffer, 10); /* radix=10 */ ! 210: ! 211: WinSetDlgItemText(hwnd, IDD_EDITSIZE, szBuffer); ! 212: ! 213: CheckBox(hwnd, pObj->ulAttr & PAG_READ, IDD_READ); ! 214: CheckBox(hwnd, pObj->ulAttr & PAG_EXECUTE, IDD_EXECUTE); ! 215: CheckBox(hwnd, pObj->ulAttr & PAG_WRITE, IDD_WRITE); ! 216: CheckBox(hwnd, pObj->ulAttr & PAG_GUARD, IDD_GUARD); ! 217: ! 218: CheckBox(hwnd, pObj->ulAttr & PAG_COMMIT, IDD_COMMIT); ! 219: CheckBox(hwnd, pObj->ulAttr & OBJ_TILE, IDD_TILE); ! 220: ! 221: return(FALSE); /* Let the focus go to where the system puts it */ ! 222: ! 223: break; ! 224: ! 225: case WM_COMMAND: ! 226: switch ((USHORT) SHORT1FROMMP(mp1)) { ! 227: case IDD_OK: ! 228: WinQueryDlgItemText(hwnd, IDD_EDITSIZE,MAX_EDIT_BUFF, szBuffer); ! 229: ! 230: pObj->ulSize=atol(szBuffer); ! 231: ! 232: pObj->ulAttr = QueryCheckBox(hwnd,PAG_READ, IDD_READ) | ! 233: QueryCheckBox(hwnd,PAG_EXECUTE, IDD_EXECUTE) | ! 234: QueryCheckBox(hwnd,PAG_WRITE, IDD_WRITE) | ! 235: QueryCheckBox(hwnd,PAG_GUARD, IDD_GUARD) | ! 236: ! 237: QueryCheckBox(hwnd,PAG_COMMIT, IDD_COMMIT) | ! 238: QueryCheckBox(hwnd,OBJ_TILE, IDD_TILE); ! 239: ! 240: WinDismissDlg(hwnd, TRUE); ! 241: ! 242: break; ! 243: ! 244: case IDD_CANCEL: ! 245: WinDismissDlg(hwnd, FALSE); ! 246: break; ! 247: default: ! 248: break; ! 249: } ! 250: ! 251: break; ! 252: ! 253: default: ! 254: return (WinDefDlgProc(hwnd, msg, mp1, mp2)); ! 255: } ! 256: } ! 257: ! 258: ! 259: ! 260: /****************************************************************\ ! 261: * Dialog procedure for the Set Memory dialog * ! 262: *--------------------------------------------------------------* ! 263: * * ! 264: * Name: SetMem1DlgProc(hwnd, msg, mp1, mp2) * ! 265: * * ! 266: * Purpose: Processes all messages sent to the SetMem1 * ! 267: * dialog * ! 268: * * ! 269: * Usage: Called for each message sent to the * ! 270: * dialog box. * ! 271: * * ! 272: * Method: a switch statement branches to the routines to be * ! 273: * performed for each message processed. Any messages * ! 274: * not specifically processed are passed to the * ! 275: * default window procedure WinDefDlgProc() * ! 276: * * ! 277: * Returns: Dependent upon message sent * ! 278: * * ! 279: \****************************************************************/ ! 280: ! 281: MRESULT EXPENTRY SetMem1DlgProc(HWND hwnd, USHORT msg, MPARAM mp1, MPARAM mp2) ! 282: { ! 283: static POBJSTRUCT pObj; ! 284: USHORT i; ! 285: ! 286: switch (msg) { ! 287: case WM_INITDLG: ! 288: pObj = PVOIDFROMMP(mp2); /* address of buffer pointed to by pCreateParams */ ! 289: ! 290: for (i=0; i<ulFreePage; i++) ! 291: { ! 292: sprintf(szBuffer, "%p",apgentry[i].pvAddress); ! 293: ! 294: WinSendDlgItemMsg(hwnd, ! 295: IDD_ADDRESS, ! 296: LM_INSERTITEM, ! 297: MPFROMSHORT(LIT_END), ! 298: MPFROMP(szBuffer)); ! 299: } ! 300: ! 301: WinSetDlgItemText(hwnd, IDD_EDITSIZE, SZDEFAULT_SIZE); ! 302: ! 303: return(FALSE); /* Let the focus go to where the system puts it */ ! 304: break; ! 305: ! 306: case WM_COMMAND: ! 307: switch ((USHORT) SHORT1FROMMP(mp1)) { ! 308: case IDD_OK: ! 309: WinQueryDlgItemText(hwnd, IDD_ADDRESS, MAX_EDIT_BUFF, szBuffer); ! 310: ! 311: sscanf(szBuffer,"%p",&(pObj->pvAddress)); ! 312: ! 313: WinQueryDlgItemText(hwnd, IDD_EDITSIZE, MAX_EDIT_BUFF, szBuffer); ! 314: ! 315: sscanf(szBuffer,"%lu",&(pObj->ulSize)); ! 316: ! 317: WinDismissDlg(hwnd, TRUE); ! 318: ! 319: break; ! 320: ! 321: case IDD_CANCEL: ! 322: WinDismissDlg(hwnd, FALSE); ! 323: break; ! 324: ! 325: default: ! 326: break; ! 327: } ! 328: ! 329: break; ! 330: ! 331: default: ! 332: return (WinDefDlgProc(hwnd, msg, mp1, mp2)); ! 333: } ! 334: } ! 335: ! 336: ! 337: ! 338: /****************************************************************\ ! 339: * Dialog procedure for the Set Memory dialog * ! 340: *--------------------------------------------------------------* ! 341: * * ! 342: * Name: SetMem2DlgProc(hwnd, msg, mp1, mp2) * ! 343: * * ! 344: * Purpose: Processes all messages sent to the SetMem2 * ! 345: * dialog * ! 346: * * ! 347: * Usage: Called for each message sent to the * ! 348: * dialog box. * ! 349: * * ! 350: * Method: a switch statement branches to the routines to be * ! 351: * performed for each message processed. Any messages * ! 352: * not specifically processed are passed to the * ! 353: * default window procedure WinDefDlgProc() * ! 354: * * ! 355: * Returns: Dependent upon message sent * ! 356: * * ! 357: \****************************************************************/ ! 358: ! 359: MRESULT EXPENTRY SetMem2DlgProc(HWND hwnd, USHORT msg, MPARAM mp1, MPARAM mp2) ! 360: { ! 361: static POBJSTRUCT pObj; ! 362: ULONG ulRegionSize,ulFlags; ! 363: ULONG rc; ! 364: ! 365: switch (msg) { ! 366: case WM_INITDLG: ! 367: pObj = PVOIDFROMMP(mp2); ! 368: ! 369: rc=DosQueryMem(pObj->pvAddress, &ulRegionSize, &ulFlags); ! 370: if (rc) ! 371: { ! 372: VMM_Error("DosQueryMem()", rc); ! 373: ! 374: WinDismissDlg(hwnd, FALSE); ! 375: return(FALSE); ! 376: } ! 377: ! 378: sprintf(szBuffer, "Address of memory =0x%p",pObj->pvAddress); ! 379: WinSetDlgItemText(hwnd, IDD_ADDRESS, szBuffer); ! 380: ! 381: ! 382: CheckBox(hwnd, ulFlags & PAG_READ, IDD_READ); ! 383: CheckBox(hwnd, ulFlags & PAG_EXECUTE, IDD_EXECUTE); ! 384: CheckBox(hwnd, ulFlags & PAG_WRITE, IDD_WRITE); ! 385: CheckBox(hwnd, ulFlags & PAG_GUARD, IDD_GUARD); ! 386: ! 387: CheckBox(hwnd, 1L, IDD_DEFAULT); ! 388: ! 389: return(FALSE); /* Let the focus go to where the system puts it */ ! 390: break; ! 391: ! 392: case WM_CONTROL: ! 393: ! 394: switch ((USHORT) SHORT1FROMMP(mp1)) { ! 395: ! 396: case IDD_DECOMMIT: /* Can't change attributes when de-committing */ ! 397: if ((USHORT) SHORT2FROMMP(mp1) == BN_CLICKED) ! 398: { ! 399: if (QueryCheckBox(hwnd, TRUE, IDD_DECOMMIT)) ! 400: { ! 401: /* If we are decommitting memory, don't change ! 402: any attributes */ ! 403: CheckBox(hwnd, 0L, IDD_READ); ! 404: CheckBox(hwnd, 0L, IDD_EXECUTE); ! 405: CheckBox(hwnd, 0L, IDD_WRITE); ! 406: CheckBox(hwnd, 0L, IDD_GUARD); ! 407: } ! 408: ! 409: return(TRUE); /* tell it we didn't process the message */ ! 410: } ! 411: ! 412: return(TRUE); /* tell it we didn't process the message */ ! 413: ! 414: break; ! 415: ! 416: ! 417: case IDD_DEFAULT: ! 418: case IDD_COMMIT: ! 419: ! 420: /* For these cases, put the attributes back the way ! 421: they were, this is for whenthe user clicks on de-commit, ! 422: then, clicks back on default or commit since we cleared ! 423: the attribute flags when they clicked on decommit */ ! 424: ! 425: if ((USHORT) SHORT2FROMMP(mp1) == BN_CLICKED) ! 426: { ! 427: ! 428: rc=DosQueryMem(pObj->pvAddress, &ulRegionSize, &ulFlags); ! 429: if (rc) ! 430: { ! 431: VMM_Error("DosQueryMem()", rc); ! 432: ! 433: WinDismissDlg(hwnd, FALSE); ! 434: return(FALSE); ! 435: } ! 436: ! 437: CheckBox(hwnd, ulFlags & PAG_READ, IDD_READ); ! 438: CheckBox(hwnd, ulFlags & PAG_EXECUTE, IDD_EXECUTE); ! 439: CheckBox(hwnd, ulFlags & PAG_WRITE, IDD_WRITE); ! 440: CheckBox(hwnd, ulFlags & PAG_GUARD, IDD_GUARD); ! 441: } ! 442: ! 443: return(TRUE); /* tell it we didn't process the message */ ! 444: break; ! 445: ! 446: default: ! 447: break; ! 448: } ! 449: ! 450: case WM_COMMAND: ! 451: switch ((USHORT) SHORT1FROMMP(mp1)) { ! 452: case IDD_OK: ! 453: ! 454: pObj->ulAttr = QueryCheckBox(hwnd,PAG_READ, IDD_READ) | ! 455: QueryCheckBox(hwnd,PAG_EXECUTE, IDD_EXECUTE) | ! 456: QueryCheckBox(hwnd,PAG_WRITE, IDD_WRITE) | ! 457: QueryCheckBox(hwnd,PAG_GUARD, IDD_GUARD) | ! 458: ! 459: QueryCheckBox(hwnd,PAG_COMMIT, IDD_COMMIT) | ! 460: QueryCheckBox(hwnd,PAG_DECOMMIT, IDD_DECOMMIT); ! 461: ! 462: WinDismissDlg(hwnd, TRUE); ! 463: return(FALSE); /* tell system we did process the message */ ! 464: break; ! 465: ! 466: case IDD_CANCEL: ! 467: WinDismissDlg(hwnd, FALSE); ! 468: return(FALSE); /* tell system we did process the message */ ! 469: break; ! 470: ! 471: default: ! 472: return(TRUE); /* tell it we didn't process the message */ ! 473: break; ! 474: } ! 475: ! 476: break; ! 477: ! 478: default: ! 479: return (WinDefDlgProc(hwnd, msg, mp1, mp2)); ! 480: } ! 481: } ! 482: ! 483: ! 484: /****************************************************************\ ! 485: * Dialog procedure for the Read Memory dialog * ! 486: *--------------------------------------------------------------* ! 487: * * ! 488: * Name: ReadMemDlgProc(hwnd, msg, mp1, mp2) * ! 489: * * ! 490: * Purpose: Processes all messages sent to the Read Memory * ! 491: * dialog * ! 492: * * ! 493: * Usage: Called for each message sent to the * ! 494: * dialog box. * ! 495: * * ! 496: * Method: a switch statement branches to the routines to be * ! 497: * performed for each message processed. Any messages * ! 498: * not specifically processed are passed to the * ! 499: * default window procedure WinDefDlgProc() * ! 500: * * ! 501: * Returns: Dependent upon message sent * ! 502: * * ! 503: \****************************************************************/ ! 504: ! 505: MRESULT EXPENTRY ReadMemDlgProc(HWND hwnd, USHORT msg, MPARAM mp1, MPARAM mp2) ! 506: { ! 507: static POBJSTRUCT pObj; ! 508: ! 509: switch (msg) { ! 510: case WM_INITDLG: ! 511: pObj = PVOIDFROMMP(mp2); ! 512: ! 513: return(FALSE); /* Let the focus go to where the system puts it */ ! 514: ! 515: break; ! 516: ! 517: case WM_COMMAND: ! 518: switch ((USHORT) SHORT1FROMMP(mp1)) { ! 519: case IDD_OK: ! 520: WinQueryDlgItemText(hwnd, IDD_ADDRESS, MAX_EDIT_BUFF, szBuffer); ! 521: ! 522: sscanf(szBuffer,"%p",&(pObj->pvAddress)); ! 523: ! 524: WinDismissDlg(hwnd, TRUE); ! 525: break; ! 526: ! 527: case IDD_CANCEL: ! 528: WinDismissDlg(hwnd, FALSE); ! 529: break; ! 530: ! 531: default: ! 532: break; ! 533: } ! 534: ! 535: break; ! 536: ! 537: default: ! 538: return (WinDefDlgProc(hwnd, msg, mp1, mp2)); ! 539: } ! 540: } ! 541: ! 542: ! 543: ! 544: ! 545: /****************************************************************\ ! 546: * Dialog procedure for the Write Memory dialog * ! 547: *--------------------------------------------------------------* ! 548: * * ! 549: * Name: WriteMemDlgProc(hwnd, msg, mp1, mp2) * ! 550: * * ! 551: * Purpose: Processes all messages sent to the WriteMem * ! 552: * dialog * ! 553: * * ! 554: * Usage: Called for each message sent to the * ! 555: * dialog box. * ! 556: * * ! 557: * Method: a switch statement branches to the routines to be * ! 558: * performed for each message processed. Any messages * ! 559: * not specifically processed are passed to the * ! 560: * default window procedure WinDefDlgProc() * ! 561: * * ! 562: * Returns: Dependent upon message sent * ! 563: * * ! 564: \****************************************************************/ ! 565: ! 566: MRESULT EXPENTRY WriteMemDlgProc(HWND hwnd, USHORT msg, MPARAM mp1, MPARAM mp2) ! 567: { ! 568: PVOID pvMemAddress; ! 569: ! 570: switch (msg) { ! 571: case WM_INITDLG: ! 572: return(FALSE); /* Let the the focus go to where the system puts it */ ! 573: break; ! 574: ! 575: case WM_COMMAND: ! 576: switch ((USHORT) SHORT1FROMMP(mp1)) { ! 577: case IDD_OK: ! 578: WinQueryDlgItemText(hwnd, IDD_ADDRESS, MAX_EDIT_BUFF, szBuffer); ! 579: ! 580: sscanf(szBuffer,"%p",&pvMemAddress); ! 581: ! 582: WinQueryDlgItemText(hwnd, IDD_DATA, MAX_EDIT_BUFF, szBuffer); ! 583: ! 584: strcpy(pvMemAddress, szBuffer); /* let 'em go for it. ! 585: it may cause a GP fault */ ! 586: ! 587: WinDismissDlg(hwnd, TRUE); ! 588: ! 589: break; ! 590: ! 591: case IDD_CANCEL: ! 592: WinDismissDlg(hwnd, FALSE); ! 593: break; ! 594: ! 595: default: ! 596: break; ! 597: } ! 598: ! 599: break; ! 600: ! 601: default: ! 602: return (WinDefDlgProc(hwnd, msg, mp1, mp2)); ! 603: } ! 604: } ! 605: ! 606: ! 607: /****************************************************************\ ! 608: * Dialog procedure for the Free Memory dialog * ! 609: *--------------------------------------------------------------* ! 610: * * ! 611: * Name: FreeMemDlgProc(hwnd, msg, mp1, mp2) * ! 612: * * ! 613: * Purpose: Processes all messages sent to the FreeMem * ! 614: * dialog * ! 615: * * ! 616: * Usage: Called for each message sent to the Free Memory * ! 617: * dialog box. * ! 618: * * ! 619: * Method: a switch statement branches to the routines to be * ! 620: * performed for each message processed. Any messages * ! 621: * not specifically processed are passed to the * ! 622: * default window procedure WinDefDlgProc() * ! 623: * * ! 624: * Returns: Dependent upon message sent * ! 625: * * ! 626: \****************************************************************/ ! 627: MRESULT EXPENTRY FreeMemDlgProc(HWND hwnd, USHORT msg, ! 628: MPARAM mp1, MPARAM mp2) ! 629: { ! 630: static POBJSTRUCT pObj; ! 631: ! 632: switch (msg) { ! 633: case WM_INITDLG: ! 634: pObj = PVOIDFROMMP(mp2); ! 635: ! 636: return(FALSE); /* Let the the focus go to where the system puts it */ ! 637: break; ! 638: ! 639: case WM_COMMAND: ! 640: switch ((USHORT) SHORT1FROMMP(mp1)) { ! 641: case IDD_OK: ! 642: WinQueryDlgItemText(hwnd, IDD_ADDRESS, MAX_EDIT_BUFF, szBuffer); ! 643: ! 644: sscanf(szBuffer,"%p",&(pObj->pvAddress)); ! 645: ! 646: WinDismissDlg(hwnd, TRUE); ! 647: ! 648: break; ! 649: ! 650: case IDD_CANCEL: ! 651: WinDismissDlg(hwnd, FALSE); ! 652: break; ! 653: ! 654: default: ! 655: break; ! 656: } ! 657: ! 658: break; ! 659: ! 660: default: ! 661: return (WinDefDlgProc(hwnd, msg, mp1, mp2)); ! 662: } ! 663: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.