|
|
1.1 ! root 1: /****************************** Module Header ******************************\ ! 2: * Module Name: memory.c ! 3: * ! 4: * Copyright (c) 1991, Microsoft Corporation ! 5: * ! 6: * ! 7: * ! 8: * History: ! 9: * 09-17-91 PetrusW Created. ! 10: * ! 11: \***************************************************************************/ ! 12: ! 13: #include <stdlib.h> ! 14: ! 15: #include "memory.h" ! 16: #include <stdarg.h> ! 17: ! 18: extern CreateMapFile(); ! 19: extern CreateMap(); ! 20: extern MapView(); ! 21: extern OpenMap(); ! 22: ! 23: ! 24: HANDLE ghModule; ! 25: HWND ghwndMain = NULL; ! 26: ! 27: HMENU hMenu, hMenuWindow; ! 28: HMENU hServerMenu, hServerMenuWindow; ! 29: HMENU hClientMenu, hClientMenuWindow; ! 30: ! 31: CHAR gszFile[20]; ! 32: CHAR gszMapName[20]; ! 33: ! 34: ! 35: typedef struct _PerWndInfo { ! 36: // HWND hMainFrame; ! 37: HWND hParent; ! 38: HWND hThisWnd; // CR! used in locating the node ! 39: // LPVOID pShrMem1; // LATER! create more clients/servers ! 40: RECT rcClient; ! 41: char CaptionBarText[SIZEOFCAPTIONTEXT]; ! 42: } PERWNDINFO, *PPERWNDINFO; ! 43: ! 44: ! 45: typedef struct _node { ! 46: PERWNDINFO ChildWnd; ! 47: HANDLE hNext; ! 48: } NODE, *PNODE; ! 49: ! 50: ! 51: /* ! 52: * Forward declarations. ! 53: */ ! 54: BOOL InitializeApp (void); ! 55: LONG MainWndProc (HWND, UINT, DWORD, LONG); ! 56: LONG ServerWndProc (HWND, UINT, DWORD, LONG); ! 57: LONG ClientWndProc (HWND, UINT, DWORD, LONG); ! 58: LONG About (HWND, UINT, DWORD, LONG); ! 59: LONG FileType (HWND, UINT, DWORD, LONG); ! 60: LONG MapFileName (HWND, UINT, DWORD, LONG); ! 61: LONG TextWndProc (HWND, UINT, DWORD, LONG); ! 62: ! 63: /***************************************************************************\ ! 64: * main ! 65: * ! 66: * ! 67: * History: ! 68: * 04-17-91 ScottLu Created. ! 69: \***************************************************************************/ ! 70: ! 71: int WinMain( ! 72: HANDLE hInstance, ! 73: HANDLE hPrevInstance, ! 74: LPSTR lpCmdLine, ! 75: int nShowCmd) ! 76: { ! 77: MSG msg; ! 78: ! 79: // this will change to something more reasonable ! 80: ! 81: ghModule = GetModuleHandle(NULL); ! 82: if (!InitializeApp()) { ! 83: MessageBox(ghwndMain, "memory: InitializeApp failure!", "Error", MB_OK); ! 84: return 0; ! 85: } ! 86: ! 87: while (GetMessage(&msg, NULL, 0, 0)) { ! 88: TranslateMessage(&msg); ! 89: DispatchMessage(&msg); ! 90: } ! 91: ! 92: if (hMenuWindow && IsWindow(hMenuWindow)) ! 93: DestroyMenu(hMenuWindow); ! 94: if (hClientMenuWindow && IsWindow(hClientMenuWindow)) ! 95: DestroyMenu(hClientMenuWindow); ! 96: if (hServerMenuWindow && IsWindow(hServerMenuWindow)) ! 97: DestroyMenu(hServerMenuWindow); ! 98: if (hMenu && IsWindow(hMenu)) ! 99: DestroyMenu(hMenu); ! 100: if (hClientMenu && IsWindow(hClientMenu)) ! 101: DestroyMenu(hClientMenu); ! 102: if (hServerMenu && IsWindow(hServerMenu)) ! 103: DestroyMenu(hServerMenu); ! 104: ! 105: return 1; ! 106: ! 107: UNREFERENCED_PARAMETER(lpCmdLine); ! 108: UNREFERENCED_PARAMETER(nShowCmd); ! 109: UNREFERENCED_PARAMETER(hInstance); ! 110: UNREFERENCED_PARAMETER(hPrevInstance); ! 111: } ! 112: ! 113: ! 114: /***************************************************************************\ ! 115: * InitializeApp ! 116: * ! 117: * History: ! 118: * 09-09-91 PetrusW Created. ! 119: \***************************************************************************/ ! 120: ! 121: BOOL InitializeApp(void) ! 122: { ! 123: WNDCLASS wc; ! 124: ! 125: wc.style = CS_OWNDC; ! 126: wc.lpfnWndProc = MainWndProc; ! 127: wc.cbClsExtra = 0; ! 128: wc.cbWndExtra = sizeof(LONG); ! 129: wc.hInstance = ghModule; ! 130: wc.hIcon = LoadIcon(NULL, IDI_APPLICATION); ! 131: wc.hCursor = LoadCursor(NULL, IDC_ARROW); ! 132: wc.hbrBackground = (HBRUSH)(COLOR_APPWORKSPACE); ! 133: wc.lpszMenuName = "MainMenu"; ! 134: wc.lpszClassName = "MemoryClass"; ! 135: ! 136: if (!RegisterClass(&wc)) ! 137: return FALSE; ! 138: ! 139: wc.style = CS_OWNDC; ! 140: wc.lpfnWndProc = ServerWndProc; ! 141: wc.cbClsExtra = 0; ! 142: wc.cbWndExtra = 0; // LATER sizeof(LONG); ! 143: wc.hInstance = ghModule; ! 144: wc.hIcon = LoadIcon(NULL, IDI_APPLICATION); ! 145: wc.hCursor = LoadCursor(NULL, IDC_ARROW); ! 146: wc.hbrBackground = (HBRUSH)(COLOR_APPWORKSPACE); ! 147: wc.lpszMenuName = NULL; ! 148: wc.lpszClassName = "ServerClass"; ! 149: ! 150: if (!RegisterClass(&wc)) ! 151: return FALSE; ! 152: ! 153: wc.style = CS_OWNDC; ! 154: wc.lpfnWndProc = ClientWndProc; ! 155: wc.cbClsExtra = 0; ! 156: wc.cbWndExtra = 0; // LATER sizeof(LONG); ! 157: wc.hInstance = ghModule; ! 158: wc.hIcon = LoadIcon(NULL, IDI_APPLICATION); ! 159: wc.hCursor = LoadCursor(NULL, IDC_ARROW); ! 160: wc.hbrBackground = (HBRUSH)(COLOR_APPWORKSPACE); ! 161: wc.lpszMenuName = NULL; ! 162: wc.lpszClassName = "ClientClass"; ! 163: ! 164: if (!RegisterClass(&wc)) ! 165: return FALSE; ! 166: ! 167: wc.style = CS_OWNDC | CS_HREDRAW | CS_VREDRAW; ! 168: wc.lpfnWndProc = TextWndProc; ! 169: wc.cbClsExtra = 0; ! 170: wc.cbWndExtra = 0; ! 171: wc.hInstance = ghModule; ! 172: wc.hIcon = NULL; ! 173: wc.hCursor = LoadCursor(NULL, IDC_ARROW); ! 174: wc.hbrBackground = (HBRUSH)(COLOR_BTNSHADOW); ! 175: wc.lpszMenuName = NULL; ! 176: wc.lpszClassName = "Text"; ! 177: ! 178: if (!RegisterClass(&wc)) ! 179: return FALSE; ! 180: ! 181: ! 182: ! 183: hMenu = LoadMenu(ghModule, "MainMenu"); ! 184: hServerMenu = LoadMenu(ghModule, "ServerMenu"); ! 185: hClientMenu = LoadMenu(ghModule, "ClientMenu"); ! 186: hMenuWindow = GetSubMenu(hMenu, 1); ! 187: hServerMenuWindow = GetSubMenu(hServerMenu, 2); ! 188: hClientMenuWindow = GetSubMenu(hClientMenu, 2); ! 189: ! 190: ghwndMain = CreateWindowEx(0L, "MemoryClass", "Memory", ! 191: WS_OVERLAPPED | WS_CAPTION | WS_BORDER | ! 192: WS_THICKFRAME | WS_MAXIMIZEBOX | WS_MINIMIZEBOX | ! 193: WS_CLIPCHILDREN | WS_VISIBLE | WS_SYSMENU, ! 194: 80, 70, 400, 300, ! 195: NULL, hMenu, ghModule, NULL); ! 196: ! 197: if (ghwndMain == NULL) ! 198: return FALSE; ! 199: ! 200: SetWindowLong(ghwndMain, GWL_USERDATA, 0L); ! 201: ! 202: SetFocus(ghwndMain); /* set initial focus */ ! 203: ! 204: return TRUE; ! 205: } ! 206: ! 207: ! 208: /***************************************************************************\ ! 209: * MainWndProc ! 210: * ! 211: * History: ! 212: * 09-09-91 PetrusW Created. ! 213: \***************************************************************************/ ! 214: ! 215: long MainWndProc( ! 216: HWND hwnd, ! 217: UINT message, ! 218: DWORD wParam, ! 219: LONG lParam) ! 220: { ! 221: static int iSvrCount=1; ! 222: static int iCltCount=1; ! 223: static HWND hwndClient; ! 224: CLIENTCREATESTRUCT clientcreate; ! 225: HWND hwndChildWindow; ! 226: ! 227: ! 228: switch (message) { ! 229: ! 230: case WM_CREATE: ! 231: SetWindowLong(hwnd, 0, (LONG)NULL); ! 232: ! 233: clientcreate.hWindowMenu = hMenuWindow; ! 234: clientcreate.idFirstChild = 1; ! 235: ! 236: hwndClient = CreateWindow("MDICLIENT", NULL, ! 237: WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE, ! 238: 0,0,0,0, ! 239: hwnd, NULL, ghModule, (LPVOID)&clientcreate); ! 240: return 0L; ! 241: ! 242: case WM_DESTROY: { ! 243: PostQuitMessage(0); ! 244: return 0L; ! 245: } ! 246: ! 247: case WM_COMMAND: ! 248: ! 249: switch (LOWORD(wParam)) { ! 250: case IDM_TILE: ! 251: SendMessage(hwndClient, WM_MDITILE, 0L, 0L); ! 252: return 0L; ! 253: case IDM_CASCADE: ! 254: SendMessage(hwndClient, WM_MDICASCADE, 0L, 0L); ! 255: return 0L; ! 256: case IDM_ARRANGE: ! 257: SendMessage(hwndClient, WM_MDIICONARRANGE, 0L, 0L); ! 258: return 0L; ! 259: ! 260: case MM_SERVER: { ! 261: HANDLE hNode, hHead; ! 262: PNODE pNode; ! 263: MDICREATESTRUCT mdicreate; ! 264: ! 265: hNode = LocalAlloc(LHND, (WORD) sizeof(NODE)); ! 266: if (hNode) { ! 267: if ((pNode = (PNODE)LocalLock(hNode)) == NULL) ! 268: MessageBox(ghwndMain, "Failed in LocalLock, hNode", "Error", MB_OK); ! 269: ! 270: wsprintf((LPSTR) &(pNode->ChildWnd.CaptionBarText), ! 271: "Server %d", iSvrCount); ! 272: ! 273: mdicreate.szClass = "ServerClass"; ! 274: mdicreate.szTitle = (LPTSTR)&(pNode->ChildWnd.CaptionBarText); ! 275: mdicreate.hOwner = ghModule; ! 276: mdicreate.x = ! 277: mdicreate.y = ! 278: mdicreate.cx = ! 279: mdicreate.cy = CW_USEDEFAULT; ! 280: mdicreate.style = 0l; ! 281: mdicreate.lParam = 0L; ! 282: ! 283: /*Create Child Window*/ ! 284: hwndChildWindow = ! 285: (HANDLE) SendMessage(hwndClient, WM_MDICREATE, ! 286: 0L, ! 287: (LONG)(LPMDICREATESTRUCT)&mdicreate); ! 288: ! 289: if (hwndChildWindow == NULL) { ! 290: MessageBox(ghwndMain, "Failed in Creating Child Window", "Error", MB_OK); ! 291: return 0L; ! 292: } ! 293: ! 294: pNode->ChildWnd.hParent = hwndClient; ! 295: pNode->ChildWnd.hThisWnd = hwndChildWindow; ! 296: hHead = (HANDLE)GetWindowLong(hwnd, 0); ! 297: pNode->hNext = hHead; ! 298: SetWindowLong(hwnd, 0, (LONG) hNode); ! 299: ! 300: iSvrCount++; ! 301: ! 302: ! 303: LocalUnlock(hNode); ! 304: } else { ! 305: MessageBox(ghwndMain, "Failed to Allocate Node!", "Error", MB_OK); ! 306: } ! 307: return 0L; ! 308: } ! 309: ! 310: case MM_CLIENT: { ! 311: HANDLE hNode, hHead; ! 312: PNODE pNode; ! 313: MDICREATESTRUCT mdicreate; ! 314: ! 315: hNode = LocalAlloc(LHND, (WORD) sizeof(NODE)); ! 316: if (hNode) { ! 317: if ((pNode = (PNODE)LocalLock(hNode))==NULL) ! 318: MessageBox(ghwndMain, "Failed in LocalLock, hNode!", "Error", MB_OK); ! 319: ! 320: wsprintf((LPSTR) &(pNode->ChildWnd.CaptionBarText), ! 321: "Client %d", iCltCount); ! 322: ! 323: mdicreate.szClass = "ClientClass"; ! 324: mdicreate.szTitle = (LPSTR) &(pNode->ChildWnd.CaptionBarText); ! 325: mdicreate.hOwner = ghModule; ! 326: mdicreate.x = ! 327: mdicreate.y = ! 328: mdicreate.cx = ! 329: mdicreate.cy = CW_USEDEFAULT; ! 330: mdicreate.style = 0l; ! 331: mdicreate.lParam = 0L; ! 332: ! 333: /*Create Child Window*/ ! 334: hwndChildWindow = ! 335: (HANDLE) SendMessage(hwndClient, WM_MDICREATE, ! 336: 0L, ! 337: (LONG)(LPMDICREATESTRUCT)&mdicreate); ! 338: ! 339: if (hwndChildWindow == NULL) { ! 340: MessageBox(ghwndMain, "Failed in Creating Child Window!", "Error", MB_OK); ! 341: return 0L; ! 342: } ! 343: ! 344: pNode->ChildWnd.hParent = hwndClient; ! 345: pNode->ChildWnd.hThisWnd = hwndChildWindow; ! 346: hHead = (HANDLE)GetWindowLong(hwnd, 0); ! 347: pNode->hNext = hHead; ! 348: SetWindowLong(hwnd, 0, (LONG) hNode); ! 349: ! 350: iCltCount++; ! 351: ! 352: LocalUnlock(hNode); ! 353: ! 354: } else { ! 355: MessageBox(ghwndMain, "Failed to Allocate Node!", "Error", MB_OK); ! 356: } ! 357: return 0L; ! 358: } ! 359: ! 360: case MM_ABOUT: ! 361: if (DialogBox(ghModule, "AboutBox", ghwndMain, About) == -1) ! 362: MessageBox(ghwndMain, "DEMO: About Dialog Creation Error!", "Error", MB_OK); ! 363: return 0L; ! 364: ! 365: case MM_OPT_1: ! 366: case MM_OPT_2: ! 367: case MM_OPT_3: ! 368: case MM_OPT_4: ! 369: case MM_OPT_5: ! 370: case MM_OPT_6: ! 371: case MM_OPT_7: ! 372: case MM_OPT_8: { ! 373: HWND hActiveChild; ! 374: ! 375: hActiveChild = (HANDLE) SendMessage(hwndClient, WM_MDIGETACTIVE, 0L, 0L); ! 376: if (hActiveChild) ! 377: SendMessage(hActiveChild, WM_COMMAND, wParam, lParam); ! 378: return 0L; ! 379: } ! 380: ! 381: default: ! 382: return DefFrameProc(hwnd, hwndClient, message, wParam, lParam); ! 383: } ! 384: ! 385: default: ! 386: ! 387: return DefFrameProc(hwnd, hwndClient, message, wParam, lParam); ! 388: } ! 389: } ! 390: ! 391: /********************************************************************\ ! 392: * ServerWndProc ! 393: * ! 394: * History: ! 395: * 04-17-91 ScottLu Created. ! 396: * 09-09-91 PetrusW Rewrote. ! 397: \***************************************************************************/ ! 398: ! 399: long ServerWndProc( ! 400: HWND hwnd, ! 401: UINT message, ! 402: DWORD wParam, ! 403: LONG lParam) ! 404: { ! 405: static HANDLE MapFileHandle = NULL; ! 406: static HANDLE hMem1 = NULL; ! 407: static LPVOID pShrMem1 = NULL; ! 408: static HANDLE hEdit; ! 409: static BOOL bDirty = FALSE; ! 410: static HWND hTextWnd; ! 411: ! 412: switch (message) { ! 413: case WM_COMMAND: { ! 414: ! 415: switch (LOWORD(wParam)) { ! 416: case MM_OPT_1: { //Create File ! 417: ! 418: SetWindowText(hTextWnd, "Creating Map File"); ! 419: switch (DialogBox(ghModule, "FileType", hwnd, FileType)) { ! 420: case -1: ! 421: MessageBox(ghwndMain, "Server: File dialog box creation failed!", "Error", MB_OK); ! 422: SetWindowText(hTextWnd, "File dialog box creation failed"); ! 423: break; ! 424: case IDBTN_MAP: ! 425: if ((MapFileHandle = (HANDLE) CreateMapFile(gszFile)) == (HANDLE)NULL) { ! 426: MessageBox(ghwndMain, "Server: CreateMapFile() failed!", "Error", MB_OK); ! 427: SetWindowText(hTextWnd, "Map File creation failed"); ! 428: } ! 429: else { ! 430: SetWindowText(hTextWnd, "Select 'Create File Mapping...'"); ! 431: } ! 432: break; ! 433: default: ! 434: MapFileHandle = (HANDLE) 0xFFFFFFFF; ! 435: EnableMenuItem(hServerMenu, MM_OPT_2, MF_ENABLED); ! 436: break; ! 437: } ! 438: return 0L; ! 439: } ! 440: case MM_OPT_2: { //Create File Mapping ! 441: ! 442: SetWindowText(hTextWnd, "Creating File Mapping"); ! 443: if (MapFileHandle != NULL ) { ! 444: switch (DialogBox(ghModule, "MapName", hwnd, MapFileName)) { ! 445: case -1: ! 446: MessageBox(ghwndMain, "Server: Map dialog box creation failed!", "Error", MB_OK); ! 447: SetWindowText(hTextWnd, "Map dialog box creation failed"); ! 448: break; ! 449: case IDBTN_OK: ! 450: if ((hMem1 = (HANDLE) CreateMap((HANDLE *) &MapFileHandle, gszMapName) ) == (HANDLE)NULL) { ! 451: MessageBox(ghwndMain, "Server: CreateMap() failed!", "Error", MB_OK); ! 452: SetWindowText(hTextWnd, "File Mapping creation failed"); ! 453: } ! 454: else { ! 455: EnableMenuItem(hServerMenu, MM_OPT_3, MF_ENABLED); ! 456: SetWindowText(hTextWnd, "Select 'Map View of File'"); ! 457: } ! 458: break; ! 459: default: ! 460: break; ! 461: } ! 462: } else { ! 463: MessageBox(ghwndMain, "Server: MapFileHandle is NULL!", "Error", MB_OK); ! 464: SetWindowText(hTextWnd, "Advice: Create server file first"); ! 465: } ! 466: return 0L; ! 467: } ! 468: case MM_OPT_3: { //Map View of File ! 469: SetWindowText(hTextWnd, "Mapping view of File"); ! 470: if (hMem1) { ! 471: if ((pShrMem1 = (LPVOID)MapView(&hMem1)) == (LPVOID)NULL) { ! 472: MessageBox(ghwndMain, "Server: MapView() failed!", "Error", MB_OK); ! 473: SetWindowText(hTextWnd, "Map view of File failed"); ! 474: } ! 475: else { ! 476: EnableMenuItem(hServerMenu, MM_OPT_4, MF_ENABLED); ! 477: SetWindowText(hTextWnd, "Select 'Access' to enter text"); ! 478: } ! 479: } else { ! 480: MessageBox(ghwndMain, "Server: Mapping view of File Failed!", "Error", MB_OK); ! 481: SetWindowText(hTextWnd, "Advice: Create File Mapping First"); ! 482: } ! 483: return 0L; ! 484: } ! 485: case MM_OPT_4: { //Access ! 486: RECT rcl; ! 487: ! 488: SetWindowText(hTextWnd, "Accessing Server for writing"); ! 489: ! 490: if (pShrMem1) { ! 491: GetClientRect(hwnd, &rcl); ! 492: hEdit = CreateWindow("edit", (LPSTR) NULL, ! 493: WS_CHILD | WS_VISIBLE | WS_HSCROLL | ! 494: WS_VSCROLL | WS_BORDER | ES_LEFT | ! 495: ES_MULTILINE | ES_AUTOHSCROLL | ! 496: ES_AUTOVSCROLL, ! 497: 0,0, rcl.right-rcl.left, ! 498: rcl.bottom-rcl.top-GetWindowLong(hTextWnd, GWL_USERDATA), ! 499: hwnd, (HMENU)1, ghModule, (LPVOID)NULL); ! 500: if (hEdit) { ! 501: SetFocus(hEdit); ! 502: } else { ! 503: MessageBox(ghwndMain, "Server: Create MLE failed!", "Error", MB_OK); ! 504: SetWindowText(hTextWnd, "Failed to create MLE"); ! 505: } ! 506: } else { ! 507: MessageBox(ghwndMain, "Server: Accessing for writing Failed!", "Error", MB_OK); ! 508: SetWindowText(hTextWnd, "Advice: Map view of File First"); ! 509: } ! 510: ! 511: return 0L; ! 512: } ! 513: ! 514: } ! 515: ! 516: switch (HIWORD(wParam)) { ! 517: case EN_UPDATE: { ! 518: if ((hEdit != NULL) && (hEdit == (HANDLE)lParam) ) { ! 519: bDirty = TRUE; ! 520: } ! 521: return 0L; ! 522: } ! 523: } ! 524: ! 525: } ! 526: case WM_TIMER: ! 527: if (bDirty && hEdit) { ! 528: HANDLE hBuf; ! 529: BYTE * pBuf; ! 530: ! 531: hBuf = (HANDLE) SendMessage(hEdit, EM_GETHANDLE, 0L, 0L); ! 532: if (hBuf) { ! 533: if ((pBuf = (BYTE *)LocalLock(hBuf)) == NULL) { ! 534: MessageBox(ghwndMain, "Can't get at Edit Control's data!", "Error", MB_OK); ! 535: } else { ! 536: strncpy(pShrMem1, pBuf, strlen(pBuf)+1); ! 537: bDirty = FALSE; ! 538: } ! 539: LocalUnlock(hBuf); ! 540: } else { ! 541: MessageBox(ghwndMain, "Failed in SendMessage EM_GETHANDLE!", "Error", MB_OK); ! 542: } ! 543: ! 544: ! 545: } ! 546: return 0L; ! 547: ! 548: case WM_SETFOCUS: ! 549: if (hEdit) ! 550: SetFocus(hEdit); ! 551: return DefMDIChildProc(hwnd, message, wParam, lParam); ! 552: ! 553: case WM_MDIACTIVATE: ! 554: if ((HWND) lParam == hwnd) { ! 555: SendMessage(GetParent(hwnd), WM_MDISETMENU, ! 556: (DWORD) hServerMenu, ! 557: (LONG) hServerMenuWindow) ; ! 558: DrawMenuBar(GetParent(GetParent(hwnd))) ; ! 559: SetFocus(hEdit); ! 560: } ! 561: return 0; ! 562: ! 563: case WM_SIZE: ! 564: if (hEdit) ! 565: MoveWindow(hEdit, 0, 0, ! 566: LOWORD(lParam), ! 567: HIWORD(lParam)-GetWindowLong(hTextWnd, GWL_USERDATA), ! 568: TRUE); ! 569: MoveWindow(hTextWnd, ! 570: 0, ! 571: HIWORD(lParam) - GetWindowLong(hTextWnd, GWL_USERDATA), ! 572: LOWORD(lParam), ! 573: HIWORD(lParam), TRUE); ! 574: ! 575: return DefMDIChildProc(hwnd, message, wParam, lParam); ! 576: ! 577: case WM_CREATE: { ! 578: PPERWNDINFO pWndInfo; ! 579: PNODE pHead; ! 580: HANDLE hHead, hTmp; ! 581: RECT rect; ! 582: ! 583: GetClientRect(hwnd, &rect); ! 584: hTextWnd = CreateWindow("Text", NULL, ! 585: WS_BORDER | SS_LEFT | WS_CHILD | WS_VISIBLE, ! 586: 0, 0, 0, 0, ! 587: hwnd, ! 588: (HMENU) 2, ! 589: ghModule, ! 590: NULL); ! 591: ! 592: SetWindowText(hTextWnd, "Select 'Create File...'"); ! 593: ! 594: // now find match ! 595: hHead = (HANDLE) GetWindowLong(ghwndMain, 0); ! 596: if (hHead) { ! 597: if ((pHead = (PNODE)LocalLock(hHead))==NULL) ! 598: MessageBox(ghwndMain, "Failed in LocalLock!", "Error", MB_OK); ! 599: ! 600: while ((pHead->ChildWnd.hThisWnd != hwnd) && ! 601: (pHead->hNext != NULL)) { ! 602: hTmp = hHead; ! 603: hHead = pHead->hNext; ! 604: LocalUnlock(hTmp); ! 605: if ((pHead = (PNODE) LocalLock(hHead))==NULL) ! 606: MessageBox(ghwndMain, "Failed in LocalLock!", "Error", MB_OK); ! 607: } ! 608: if (pHead->ChildWnd.hThisWnd == hwnd) { ! 609: pWndInfo = &pHead->ChildWnd; ! 610: goto Wnd_Found; ! 611: } else { ! 612: //MessageBox(ghwndMain, "Trouble - Can't find the node!", "Error", MB_OK); ! 613: goto Wnd_Out; ! 614: } ! 615: ! 616: Wnd_Found: ! 617: if (!GetClientRect(pWndInfo->hThisWnd, ! 618: &pWndInfo->rcClient)) ! 619: MessageBox(ghwndMain, "Failed in GetClientRect!", "Error", MB_OK); ! 620: Wnd_Out: ! 621: LocalUnlock(hHead); ! 622: return DefMDIChildProc(hwnd, message, wParam, lParam); ! 623: } else { ! 624: //MessageBox(ghwndMain, "Can't GetWindowLong(ghwndMain,0)!", "Error", MB_OK); ! 625: } return DefMDIChildProc(hwnd, message, wParam, lParam); ! 626: ! 627: } ! 628: ! 629: case WM_CLOSE: { ! 630: PPERWNDINFO pWndInfo; ! 631: PNODE pHead, pTrail; ! 632: HANDLE hHead, hTmp; ! 633: ! 634: SendMessage(GetParent(hwnd), WM_MDISETMENU, ! 635: (DWORD) hMenu, ! 636: (LONG) hMenuWindow) ; ! 637: DrawMenuBar(GetParent(GetParent(hwnd))) ; ! 638: ! 639: ! 640: // now find match ! 641: hHead = (HANDLE) GetWindowLong(ghwndMain, 0); ! 642: if (hHead) { ! 643: if ((pHead = (PNODE)LocalLock(hHead))==NULL) ! 644: MessageBox(ghwndMain, "Failed in LocalLock!", "Error", MB_OK); ! 645: ! 646: pTrail = pHead; ! 647: while ((pHead->ChildWnd.hThisWnd != hwnd) && ! 648: (pHead->hNext != NULL)) { ! 649: hTmp = hHead; ! 650: pTrail = pHead; ! 651: hHead = pHead->hNext; ! 652: LocalUnlock(hTmp); ! 653: if ((pHead = (PNODE) LocalLock(hHead))==NULL) ! 654: MessageBox(ghwndMain, "Failed in LocalLock!", "Error", MB_OK); ! 655: } ! 656: if (pHead->ChildWnd.hThisWnd == hwnd) { ! 657: pWndInfo = &pHead->ChildWnd; ! 658: goto Wnd_Found1; ! 659: } else { ! 660: //MessageBox(ghwndMain, "Trouble - Can't find the thread node!", "Error", MB_OK); ! 661: goto Wnd_Out1; ! 662: } ! 663: ! 664: Wnd_Found1: if (pTrail == pHead) ! 665: SetWindowLong(ghwndMain, 0, (LONG) pHead->hNext); ! 666: else ! 667: pTrail->hNext = pHead->hNext; ! 668: ! 669: // BUG! The lock count returned is always > 0 ! 670: //if (!LocalUnlock(hHead)) { ! 671: LocalFree(hHead); ! 672: return DefMDIChildProc(hwnd, message, wParam, lParam); ! 673: //} ! 674: Wnd_Out1: ! 675: LocalUnlock(hHead); ! 676: } else { ! 677: //MessageBox(ghwndMain, "Can't GetWindowLong(ghwndMain,0) !", "Error", MB_OK); ! 678: } ! 679: return DefMDIChildProc(hwnd, message, wParam, lParam); ! 680: ! 681: } ! 682: ! 683: case WM_DESTROY: ! 684: KillTimer(hwnd, 1); ! 685: return 0L; ! 686: ! 687: case WM_PAINT: ! 688: return DefMDIChildProc(hwnd, message, wParam, lParam); ! 689: ! 690: default: ! 691: return DefMDIChildProc(hwnd, message, wParam, lParam); ! 692: } ! 693: ! 694: } ! 695: ! 696: /********************************************************************\ ! 697: * ClientWndProc ! 698: * ! 699: * History: ! 700: * 04-17-91 ScottLu Created. ! 701: * 09-09-91 PetrusW Rewrote. ! 702: \***************************************************************************/ ! 703: ! 704: long ClientWndProc( ! 705: HWND hwnd, ! 706: UINT message, ! 707: DWORD wParam, ! 708: LONG lParam) ! 709: { ! 710: static HANDLE hMem1 = NULL; ! 711: static LPVOID pShrMem1 = NULL; ! 712: static HANDLE hEdit; ! 713: static HANDLE hTextWnd; ! 714: ! 715: switch (message) { ! 716: case WM_COMMAND: { ! 717: ! 718: switch (LOWORD(wParam)) { ! 719: case MM_OPT_5: { //Open File Mapping ! 720: SetWindowText(hTextWnd, "Opening Mapping File"); ! 721: switch (DialogBox(ghModule, "MapName", hwnd, MapFileName)) { ! 722: case -1: ! 723: MessageBox(ghwndMain, "Client: Map dialog box creation failed!", "Error", MB_OK); ! 724: break; ! 725: case IDBTN_OK: ! 726: if ((hMem1 = (HANDLE) OpenMap(gszMapName)) == (HANDLE)NULL) { ! 727: MessageBox(ghwndMain, "Client: Open File Mapping failed!", "Error", MB_OK); ! 728: SetWindowText(hTextWnd, "Advice: Make sure Map file is created on Server"); ! 729: } else { ! 730: EnableMenuItem(hClientMenu, MM_OPT_6, MF_ENABLED); ! 731: SetWindowText(hTextWnd, "Select 'Map View of File'"); ! 732: } ! 733: break; ! 734: default: ! 735: break; ! 736: } ! 737: return 0L; ! 738: } ! 739: case MM_OPT_6: { //Map View of File ! 740: SetWindowText(hTextWnd, "Mapping view of File"); ! 741: if (hMem1) { ! 742: if ((pShrMem1 = (LPVOID) MapView(&hMem1)) == (LPVOID)NULL) ! 743: MessageBox(ghwndMain, "Client: MapView() failed!", "Error", MB_OK); ! 744: else { ! 745: EnableMenuItem(hClientMenu, MM_OPT_7, MF_ENABLED); ! 746: SetWindowText(hTextWnd, "Select 'Access' for reading Server "); ! 747: } ! 748: } else { ! 749: MessageBox(ghwndMain, "Client: Mapping view of File Failed!", "Error", MB_OK); ! 750: SetWindowText(hTextWnd, "Advice: Open File Mapping first"); ! 751: } ! 752: return 0L; ! 753: } ! 754: case MM_OPT_7: { //Access ! 755: RECT rcl; ! 756: ! 757: SetWindowText(hTextWnd, "Accessing Server for reading"); ! 758: if (pShrMem1) { ! 759: GetClientRect(hwnd, &rcl); ! 760: ! 761: hEdit = CreateWindow("edit", NULL, ! 762: WS_CHILD | WS_VISIBLE | WS_HSCROLL | ! 763: WS_VSCROLL | WS_BORDER | ES_LEFT | ! 764: ES_MULTILINE | ES_AUTOHSCROLL | ES_READONLY | ! 765: ES_AUTOVSCROLL, ! 766: 0,0, rcl.right-rcl.left, ! 767: rcl.bottom-rcl.top-GetWindowLong(hTextWnd, GWL_USERDATA), ! 768: hwnd, (HMENU) 1, ghModule, NULL); ! 769: if (hEdit) { ! 770: SetFocus(hEdit); ! 771: SendMessage(hEdit, WM_SETTEXT, 0L, (LONG)pShrMem1); ! 772: SetTimer(hwnd, 2, 10000, NULL); ! 773: EnableMenuItem(hClientMenu, MM_OPT_8, MF_ENABLED); ! 774: } else { ! 775: MessageBox(ghwndMain, "Client: Create MLE failed!", "Error", MB_OK); ! 776: } ! 777: } else { ! 778: MessageBox(ghwndMain, "Client: Accessing for reading Failed!", "Error", MB_OK); ! 779: SetWindowText(hTextWnd, "Advice: Map View of File first"); ! 780: } ! 781: ! 782: return 0L; ! 783: } ! 784: ! 785: case MM_OPT_8: { // refresh now ! 786: HANDLE hActive; ! 787: ! 788: hActive = (HANDLE) SendMessage(GetParent(hwnd), WM_MDIGETACTIVE, 0L, 0L); ! 789: SendMessage(hEdit, WM_SETTEXT, 0L, (LONG)pShrMem1); ! 790: SetFocus(hActive); ! 791: return 0L; ! 792: } ! 793: } ! 794: } ! 795: case WM_SETFOCUS: ! 796: if (hEdit) ! 797: SetFocus(hEdit); ! 798: return DefMDIChildProc(hwnd, message, wParam, lParam); ! 799: ! 800: case WM_TIMER: { ! 801: HANDLE hActive; ! 802: ! 803: if (hEdit) { ! 804: hActive = (HANDLE) SendMessage(GetParent(hwnd), WM_MDIGETACTIVE, 0L, 0L); ! 805: SendMessage(hEdit, WM_SETTEXT, 0L, (LONG)pShrMem1); ! 806: SetFocus(hActive); ! 807: } ! 808: return 0L; ! 809: } ! 810: ! 811: case WM_MDIACTIVATE: ! 812: if ((HWND) lParam == hwnd) { ! 813: SendMessage(GetParent(hwnd), WM_MDISETMENU, ! 814: (DWORD) hClientMenu, ! 815: (LONG) hClientMenuWindow) ; ! 816: DrawMenuBar(GetParent(GetParent(hwnd))) ; ! 817: SetFocus(hEdit); ! 818: } ! 819: return 0; ! 820: ! 821: case WM_SIZE: ! 822: if (hEdit) ! 823: MoveWindow(hEdit, 0, 0, ! 824: LOWORD(lParam), ! 825: HIWORD(lParam)-GetWindowLong(hTextWnd, GWL_USERDATA), ! 826: TRUE); ! 827: MoveWindow(hTextWnd, ! 828: 0, ! 829: HIWORD(lParam) - GetWindowLong(hTextWnd, GWL_USERDATA), ! 830: LOWORD(lParam), ! 831: HIWORD(lParam), TRUE); ! 832: return DefMDIChildProc(hwnd, message, wParam, lParam); ! 833: ! 834: case WM_CREATE: { ! 835: PPERWNDINFO pWndInfo; ! 836: PNODE pHead; ! 837: HANDLE hHead, hTmp; ! 838: RECT rect; ! 839: ! 840: GetClientRect(hwnd, &rect); ! 841: hTextWnd = CreateWindow("Text", NULL, ! 842: WS_BORDER | SS_LEFT | WS_CHILD | WS_VISIBLE, ! 843: 0, 0, 0, 0, ! 844: hwnd, ! 845: (HMENU) 2, ! 846: ghModule, ! 847: NULL); ! 848: ! 849: SetWindowText(hTextWnd, "Select 'Open File...'"); ! 850: ! 851: // now find match ! 852: hHead = (HANDLE) GetWindowLong(ghwndMain, 0); ! 853: if (hHead) { ! 854: if ((pHead = (PNODE)LocalLock(hHead))==NULL) ! 855: MessageBox(ghwndMain, "Failed in LocalLock!", "Error", MB_OK); ! 856: ! 857: while ((pHead->ChildWnd.hThisWnd != hwnd) && ! 858: (pHead->hNext != NULL)) { ! 859: hTmp = hHead; ! 860: hHead = pHead->hNext; ! 861: LocalUnlock(hTmp); ! 862: if ((pHead = (PNODE) LocalLock(hHead))==NULL) ! 863: MessageBox(ghwndMain, "Failed in LocalLock!", "Error", MB_OK); ! 864: } ! 865: if (pHead->ChildWnd.hThisWnd == hwnd) { ! 866: pWndInfo = &pHead->ChildWnd; ! 867: goto Wnd_Found; ! 868: } else { ! 869: //MessageBox(ghwndMain, "Trouble - Can't find the node!", "Error", MB_OK); ! 870: goto Wnd_Out; ! 871: } ! 872: ! 873: Wnd_Found: ! 874: if (!GetClientRect(pWndInfo->hThisWnd, ! 875: &pWndInfo->rcClient)) ! 876: MessageBox(ghwndMain, "Failed in GetClientRect!", "Error", MB_OK); ! 877: Wnd_Out: ! 878: LocalUnlock(hHead); ! 879: return DefMDIChildProc(hwnd, message, wParam, lParam); ! 880: } else { ! 881: //MessageBox(ghwndMain, "Can't GetWindowLong(ghwndMain,0) !", "Error", MB_OK); ! 882: } return DefMDIChildProc(hwnd, message, wParam, lParam); ! 883: ! 884: } ! 885: ! 886: case WM_CLOSE: { ! 887: PPERWNDINFO pWndInfo; ! 888: PNODE pHead, pTrail; ! 889: HANDLE hHead, hTmp; ! 890: ! 891: SendMessage(GetParent(hwnd), WM_MDISETMENU, ! 892: (DWORD) hMenu, ! 893: (LONG) hMenuWindow) ; ! 894: DrawMenuBar(GetParent(GetParent(hwnd))) ; ! 895: ! 896: ! 897: // now find match ! 898: hHead = (HANDLE) GetWindowLong(ghwndMain, 0); ! 899: if (hHead) { ! 900: if ((pHead = (PNODE)LocalLock(hHead))==NULL) ! 901: MessageBox(ghwndMain, "Failed in LocalLock!", "Error", MB_OK); ! 902: ! 903: pTrail = pHead; ! 904: while ((pHead->ChildWnd.hThisWnd != hwnd) && ! 905: (pHead->hNext != NULL)) { ! 906: hTmp = hHead; ! 907: pTrail = pHead; ! 908: hHead = pHead->hNext; ! 909: LocalUnlock(hTmp); ! 910: if ((pHead = (PNODE) LocalLock(hHead))==NULL) ! 911: MessageBox(ghwndMain, "Failed in LocalLock!", "Error", MB_OK); ! 912: } ! 913: if (pHead->ChildWnd.hThisWnd == hwnd) { ! 914: pWndInfo = &pHead->ChildWnd; ! 915: goto Wnd_Found1; ! 916: } else { ! 917: //MessageBox(ghwndMain, "Trouble - Can't find the thread node!", "Error", MB_OK); ! 918: goto Wnd_Out1; ! 919: } ! 920: ! 921: Wnd_Found1: if (pTrail == pHead) ! 922: SetWindowLong(ghwndMain, 0, (LONG) pHead->hNext); ! 923: else ! 924: pTrail->hNext = pHead->hNext; ! 925: ! 926: // BUG! The lock count returned is always > 0 ! 927: //if (!LocalUnlock(hHead)) { ! 928: LocalFree(hHead); ! 929: return DefMDIChildProc(hwnd, message, wParam, lParam); ! 930: //} ! 931: Wnd_Out1: ! 932: LocalUnlock(hHead); ! 933: } else { ! 934: //MessageBox(ghwndMain, "Can't GetWindowLong(ghwndMain,0)!", "Error", MB_OK); ! 935: } ! 936: return DefMDIChildProc(hwnd, message, wParam, lParam); ! 937: ! 938: } ! 939: ! 940: case WM_DESTROY: ! 941: KillTimer(hwnd, 2); ! 942: return 0l; ! 943: ! 944: default: ! 945: return DefMDIChildProc(hwnd, message, wParam, lParam); ! 946: } ! 947: ! 948: } ! 949: ! 950: /***************************************************************************\ ! 951: * About ! 952: * ! 953: * About dialog proc. ! 954: * ! 955: * History: ! 956: * 04-13-91 ScottLu Created. ! 957: * 09-09-91 PetrusW Rewrote. ! 958: \***************************************************************************/ ! 959: ! 960: long About( ! 961: HWND hDlg, ! 962: UINT message, ! 963: DWORD wParam, ! 964: LONG lParam) ! 965: { ! 966: switch (message) { ! 967: case WM_INITDIALOG: ! 968: return TRUE; ! 969: ! 970: case WM_COMMAND: ! 971: if (wParam == IDOK) ! 972: EndDialog(hDlg, wParam); ! 973: break; ! 974: } ! 975: ! 976: return FALSE; ! 977: ! 978: UNREFERENCED_PARAMETER(lParam); ! 979: UNREFERENCED_PARAMETER(hDlg); ! 980: } ! 981: ! 982: /***************************************************************************\ ! 983: * MapFileName ! 984: * ! 985: * MapFileName dialog proc. ! 986: * ! 987: * History: ! 988: * 09-09-91 PetrusW Created. ! 989: \***************************************************************************/ ! 990: ! 991: long MapFileName( ! 992: HWND hDlg, ! 993: UINT message, ! 994: DWORD wParam, ! 995: LONG lParam) ! 996: { ! 997: ! 998: switch (message) { ! 999: case WM_INITDIALOG: ! 1000: return TRUE; ! 1001: ! 1002: case WM_COMMAND: ! 1003: switch (wParam) { ! 1004: case IDBTN_OK: { ! 1005: ! 1006: if ((GetDlgItemText(hDlg, IDEDIT_MAPNAME, gszMapName, 20)) == 0) { ! 1007: MessageBox(ghwndMain, "MapFileName: Can't get edit text!", "Error", MB_OK); ! 1008: strncpy(gszMapName, "MapName1", 10); // default name ! 1009: } ! 1010: EndDialog(hDlg, IDBTN_OK); ! 1011: break; ! 1012: } ! 1013: ! 1014: } ! 1015: ! 1016: } ! 1017: ! 1018: return FALSE; ! 1019: ! 1020: UNREFERENCED_PARAMETER(lParam); ! 1021: UNREFERENCED_PARAMETER(hDlg); ! 1022: } ! 1023: ! 1024: /***************************************************************************\ ! 1025: * FileType ! 1026: * ! 1027: * FileType dialog proc. ! 1028: * ! 1029: * History: ! 1030: * 09-09-91 PetrusW Created. ! 1031: \***************************************************************************/ ! 1032: ! 1033: long FileType( ! 1034: HWND hDlg, ! 1035: UINT message, ! 1036: DWORD wParam, ! 1037: LONG lParam) ! 1038: { ! 1039: ! 1040: switch (message) { ! 1041: case WM_INITDIALOG: ! 1042: return TRUE; ! 1043: ! 1044: case WM_COMMAND: ! 1045: switch (wParam) { ! 1046: case IDBTN_PAGE: { ! 1047: EndDialog(hDlg, IDBTN_PAGE); ! 1048: break; ! 1049: } ! 1050: ! 1051: case IDBTN_MAP: { ! 1052: if ((GetDlgItemText(hDlg, IDEDIT_MAPFILE, gszFile, 20)) == 0) ! 1053: EndDialog(hDlg, IDBTN_PAGE); // default to use PAGE file ! 1054: else ! 1055: EndDialog(hDlg, IDBTN_MAP); ! 1056: ! 1057: break; ! 1058: } ! 1059: } ! 1060: ! 1061: } ! 1062: ! 1063: return FALSE; ! 1064: ! 1065: UNREFERENCED_PARAMETER(lParam); ! 1066: UNREFERENCED_PARAMETER(hDlg); ! 1067: } ! 1068: ! 1069: ! 1070: /************************************************************************* ! 1071: * ! 1072: * TextWndProc ! 1073: * ! 1074: * Text Window proc. ! 1075: * ! 1076: * History: ! 1077: * 10-07-91 PetrusW Created. ! 1078: * ! 1079: \***************************************************************************/ ! 1080: ! 1081: LONG TextWndProc (HWND hwnd, UINT message, DWORD wParam, LONG lParam) ! 1082: { ! 1083: static HFONT hFont = (HFONT) NULL; ! 1084: ! 1085: switch (message) ! 1086: { ! 1087: case WM_CREATE: ! 1088: { ! 1089: LOGFONT lf; ! 1090: HDC hDC; ! 1091: HFONT hOldFont; ! 1092: TEXTMETRIC tm; ! 1093: RECT rect; ! 1094: LONG lHeight; ! 1095: ! 1096: SystemParametersInfo(SPI_GETICONTITLELOGFONT, sizeof(lf), (LONG) &lf, FALSE); ! 1097: ! 1098: hDC = GetDC(hwnd); ! 1099: // this is the height for 8 point size font in pixels ! 1100: lf.lfHeight = 8 * GetDeviceCaps(hDC, LOGPIXELSY) / 72; ! 1101: ! 1102: hFont = CreateFontIndirect(&lf); ! 1103: hOldFont = SelectObject(hDC, hFont); ! 1104: GetTextMetrics(hDC, &tm); ! 1105: GetClientRect(GetParent(hwnd), &rect); ! 1106: ! 1107: // base the height of the window on size of text ! 1108: lHeight = tm.tmHeight+6*GetSystemMetrics(SM_CYBORDER)+2; ! 1109: // saved the height for later reference ! 1110: SetWindowLong(hwnd, GWL_USERDATA, lHeight); ! 1111: SetWindowPos(hwnd, NULL, ! 1112: 0, ! 1113: rect.bottom-lHeight, ! 1114: rect.right-rect.left, ! 1115: lHeight, ! 1116: SWP_NOZORDER | SWP_NOMOVE); ! 1117: ! 1118: ReleaseDC(hwnd, hDC); ! 1119: break; ! 1120: } ! 1121: ! 1122: case WM_DESTROY: ! 1123: if (hFont) ! 1124: DeleteObject(hFont); ! 1125: break; ! 1126: ! 1127: case WM_SETTEXT: ! 1128: DefWindowProc(hwnd, message, wParam, lParam); ! 1129: InvalidateRect(hwnd,NULL,FALSE); ! 1130: UpdateWindow(hwnd); ! 1131: return 0L; ! 1132: ! 1133: case WM_PAINT: ! 1134: { ! 1135: PAINTSTRUCT ps; ! 1136: RECT rc; ! 1137: char ach[128]; ! 1138: int len, nxBorder, nyBorder; ! 1139: HFONT hOldFont = NULL; ! 1140: ! 1141: BeginPaint(hwnd, &ps); ! 1142: ! 1143: GetClientRect(hwnd,&rc); ! 1144: ! 1145: nxBorder = GetSystemMetrics(SM_CXBORDER); ! 1146: rc.left += 9*nxBorder; ! 1147: rc.right -= 9*nxBorder; ! 1148: ! 1149: nyBorder = GetSystemMetrics(SM_CYBORDER); ! 1150: rc.top += 3*nyBorder; ! 1151: rc.bottom -= 3*nyBorder; ! 1152: ! 1153: // 3D Text ! 1154: len = GetWindowText(hwnd, ach, sizeof(ach)); ! 1155: SetBkColor(ps.hdc, GetSysColor(COLOR_BTNFACE)); ! 1156: ! 1157: SetBkMode(ps.hdc, TRANSPARENT); ! 1158: SetTextColor(ps.hdc, RGB(64,96,96)); ! 1159: if (hFont) ! 1160: hOldFont = SelectObject(ps.hdc, hFont); ! 1161: ExtTextOut(ps.hdc, rc.left+2*nxBorder+2, rc.top+2, ETO_OPAQUE | ETO_CLIPPED, ! 1162: &rc, ach, len, NULL); ! 1163: ! 1164: SetTextColor(ps.hdc, RGB(128,128,128)); ! 1165: if (hFont) ! 1166: hOldFont = SelectObject(ps.hdc, hFont); ! 1167: ExtTextOut(ps.hdc, rc.left+2*nxBorder+1, rc.top+1, ETO_CLIPPED, ! 1168: &rc, ach, len, NULL); ! 1169: ! 1170: SetTextColor(ps.hdc, RGB(255,255,255)); ! 1171: if (hFont) ! 1172: hOldFont = SelectObject(ps.hdc, hFont); ! 1173: ExtTextOut(ps.hdc, rc.left+2*nxBorder, rc.top, ETO_CLIPPED, ! 1174: &rc, ach, len, NULL); ! 1175: ! 1176: SetBkMode(ps.hdc, OPAQUE); ! 1177: ! 1178: if (hOldFont) ! 1179: SelectObject(ps.hdc, hOldFont); ! 1180: ! 1181: EndPaint(hwnd, &ps); ! 1182: return 0L; ! 1183: } ! 1184: } ! 1185: return DefWindowProc(hwnd, message, wParam, lParam); ! 1186: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.