--- mstools/samples/plgblt/plgblt.c 2018/08/09 18:21:35 1.1.1.2 +++ mstools/samples/plgblt/plgblt.c 2018/08/09 18:23:38 1.1.1.3 @@ -1,11 +1,17 @@ + +/******************************************************************************\ +* This is a part of the Microsoft Source Code Samples. +* Copyright (C) 1993 Microsoft Corporation. +* All rights reserved. +* This source code is only intended as a supplement to +* Microsoft Development Tools and/or WinHelp documentation. +* See these sources for detailed information regarding the +* Microsoft samples programs. +\******************************************************************************/ + /**************************************************************************\ * plgblt.c -- sample program demonstrating the new PlgBlt() API. * -* Steve Firebaugh -* Microsoft Developer Support -* Copyright (c) 1992 Microsoft Corporation -* -* * design: There is one main window with one dialog box stretched to fill * the top of it. The parameters for the plgblt painted into the main * window are stored in the entry fields of this dialog box. The user @@ -58,7 +64,7 @@ int APIENTRY WinMain(HINSTANCE hInstance if (!hPrevInstance) { WNDCLASS wc; - wc.style = NULL; + wc.style = 0; wc.lpfnWndProc = (WNDPROC)MainWndProc; wc.cbClsExtra = 0; @@ -113,7 +119,7 @@ int APIENTRY WinMain(HINSTANCE hInstance /* Loop getting messages and dispatching them. */ - while (GetMessage(&msg,NULL, NULL, NULL)) { + while (GetMessage(&msg,NULL, 0,0)) { if (!TranslateAccelerator(hwndMain, haccel, &msg)) if (!IsDialogMessage (hwndDlg, &msg)){ DispatchMessage(&msg); @@ -169,11 +175,11 @@ static HANDLE hPenGrid, hPenSeparator; hdcDest = GetDC (hwnd); hdcMask = GetDC (hwnd); - ptoDest = doTrackObject (NULL, TROB_NEW, hwnd,NULL); + ptoDest = doTrackObject (NULL, TROB_NEW, hwnd,0); ptoDest->allowedModes = TMALL; - ptoSrc = doTrackObject (NULL, TROB_NEW, hwnd,NULL); + ptoSrc = doTrackObject (NULL, TROB_NEW, hwnd,0); ptoSrc->allowedModes = TMMOVE | TMSIZEXY; - ptoMask = doTrackObject (NULL, TROB_NEW, hwnd,NULL); + ptoMask = doTrackObject (NULL, TROB_NEW, hwnd,0); ptoMask->allowedModes = TMMOVE; hPenGrid = CreatePen (PS_SOLID, 1, GRIDCOLOR); @@ -200,9 +206,9 @@ static HANDLE hPenGrid, hPenSeparator; ReleaseDC (hwnd, hdcSrc ); ReleaseDC (hwnd, hdcDest); ReleaseDC (hwnd, hdcMask); - doTrackObject (ptoDest, TROB_DELETE, hwnd,NULL); - doTrackObject (ptoSrc , TROB_DELETE, hwnd,NULL); - doTrackObject (ptoMask, TROB_DELETE, hwnd,NULL); + doTrackObject (ptoDest, TROB_DELETE, hwnd,0); + doTrackObject (ptoSrc , TROB_DELETE, hwnd,0); + doTrackObject (ptoMask, TROB_DELETE, hwnd,0); DeleteObject(hPenGrid); DeleteObject(hPenSeparator); @@ -222,7 +228,7 @@ static HANDLE hPenGrid, hPenSeparator; case WM_SIZE: { HRGN hrgn; - SetWindowPos (hwndDlg, NULL, 0,0, LOWORD(lParam), DIALOGHEIGHT, NULL); + SetWindowPos (hwndDlg, NULL, 0,0, LOWORD(lParam), DIALOGHEIGHT, 0); GetClientRect (hwndMain, &rect); miniWidth = rect.right/3; @@ -304,8 +310,8 @@ static HANDLE hPenGrid, hPenSeparator; /* Draw bitmaps if any, then draw track objects over them. */ if (hbmSrc) DrawBitmap (hdcSrc, hbmSrc); if (hbmMask) DrawBitmap (hdcMask, hbmMask); - doTrackObject (ptoSrc , TROB_PAINT, hwnd, NULL); - doTrackObject (ptoMask, TROB_PAINT, hwnd, NULL); + doTrackObject (ptoSrc , TROB_PAINT, hwnd, 0); + doTrackObject (ptoMask, TROB_PAINT, hwnd, 0); /* paint the left third of the window. */ SendMessage (hwnd, WM_PLGBLT, 0,0); @@ -329,8 +335,8 @@ static HANDLE hPenGrid, hPenSeparator; BOOL success; RECT cliprect; - doTrackObject (ptoSrc , TROB_PAINT, hwnd, NULL); - doTrackObject (ptoMask, TROB_PAINT, hwnd, NULL); + doTrackObject (ptoSrc , TROB_PAINT, hwnd, 0); + doTrackObject (ptoMask, TROB_PAINT, hwnd, 0); GetClipBox (hdcDest, &cliprect); FillRect (hdcDest, &cliprect, @@ -363,8 +369,8 @@ static HANDLE hPenGrid, hPenSeparator; /**********************************************************/ /**********************************************************/ } - doTrackObject (ptoSrc , TROB_PAINT, hwnd, NULL); - doTrackObject (ptoMask, TROB_PAINT, hwnd, NULL); + doTrackObject (ptoSrc , TROB_PAINT, hwnd, 0); + doTrackObject (ptoMask, TROB_PAINT, hwnd, 0); } break; @@ -422,7 +428,7 @@ static HANDLE hPenGrid, hPenSeparator; * to the top dialog. \**********************************************************************/ case WM_SETFOCUS: SetFocus (hwndDlg); - return NULL; + return 0; @@ -555,7 +561,7 @@ static HANDLE hPenGrid, hPenSeparator; SetStretchBltMode (hdcDest,BLACKONWHITE); SendMessage (hwndMain, WM_PLGBLT, 0,0); - } return NULL; + } return 0; case IDM_MODE_COLORONCOLOR: { HMENU hMenu; @@ -569,7 +575,7 @@ static HANDLE hPenGrid, hPenSeparator; SetStretchBltMode (hdcDest,COLORONCOLOR); SendMessage (hwndMain, WM_PLGBLT, 0,0); - } return NULL; + } return 0; case IDM_MODE_WHITEONBLACK: { HMENU hMenu; @@ -583,7 +589,7 @@ static HANDLE hPenGrid, hPenSeparator; SetStretchBltMode (hdcDest,WHITEONBLACK); SendMessage (hwndMain, WM_PLGBLT, 0,0); - } return NULL; + } return 0; case IDM_MODE_HALFTONE : { HMENU hMenu; @@ -597,7 +603,7 @@ static HANDLE hPenGrid, hPenSeparator; SetStretchBltMode (hdcDest,HALFTONE); SendMessage (hwndMain, WM_PLGBLT, 0,0); - } return NULL; + } return 0; @@ -623,7 +629,7 @@ static HANDLE hPenGrid, hPenSeparator; nSpin = FALSE; SendMessage (hwndMain, WM_PLGBLT, 0,0); - } return NULL; + } return 0; case IDM_SPIN5 : { HMENU hMenu; @@ -638,7 +644,7 @@ static HANDLE hPenGrid, hPenSeparator; nSpin = 5; - } return NULL; + } return 0; case IDM_SPIN10: { HMENU hMenu; @@ -653,7 +659,7 @@ static HANDLE hPenGrid, hPenSeparator; nSpin = 10; - } return NULL; + } return 0; case IDM_SPIN30: { HMENU hMenu; @@ -668,7 +674,7 @@ static HANDLE hPenGrid, hPenSeparator; nSpin = 30; - } return NULL; + } return 0; case IDM_SPIN60: { HMENU hMenu; @@ -683,7 +689,7 @@ static HANDLE hPenGrid, hPenSeparator; nSpin = 60; - } return NULL; + } return 0; case IDM_SPIN90: { HMENU hMenu; @@ -698,14 +704,14 @@ static HANDLE hPenGrid, hPenSeparator; nSpin = 90; - } return NULL; + } return 0; case IDM_FLIPONCE: nSpin = 90; SendMessage (hwndMain, WM_SPIN, 0,0); nSpin = FALSE; - return NULL; + return 0; @@ -716,7 +722,7 @@ static HANDLE hPenGrid, hPenSeparator; CheckMenuItem(hMenu, IDM_SPINTOPLEFT, MF_CHECKED); CheckMenuItem(hMenu, IDM_SPINCENTER , MF_UNCHECKED); - } return NULL; + } return 0; case IDM_SPINCENTER: { HMENU hMenu; @@ -725,7 +731,7 @@ static HANDLE hPenGrid, hPenSeparator; CheckMenuItem(hMenu, IDM_SPINTOPLEFT, MF_UNCHECKED); CheckMenuItem(hMenu, IDM_SPINCENTER , MF_CHECKED); - } return NULL; + } return 0; /******************************************************************\ @@ -738,18 +744,16 @@ static HANDLE hPenGrid, hPenSeparator; case DID_NEWSRC: case DID_NEWMASK: SendMessage (hwndDlg, message, wParam, lParam); - return NULL; + return 0; /******************************************************************\ * WM_COMMAND, IDM_ABOUT * - * manage mutually exclusive menu. - * \******************************************************************/ case IDM_ABOUT: DialogBox (hInst, "aboutBox", hwnd, (DLGPROC)About); - return NULL; + return 0; @@ -785,7 +789,7 @@ static HANDLE hPenGrid, hPenSeparator; BOOL success; /* validate the dialog on top with the parameters in it. */ - if (!IsWindow(hwndDlg)) return NULL; + if (!IsWindow(hwndDlg)) return 0; /* Grab points out of the dialog entry fields. */ lpPoint[0].x = GetDlgItemInt(hwndDlg, DID_P1X, &success, TRUE); @@ -804,6 +808,7 @@ static HANDLE hPenGrid, hPenSeparator; /* get an HDC we can use to play with transforms. */ hdc = GetDC (hwnd); + SetGraphicsMode (hdc, GM_ADVANCED); @@ -851,7 +856,7 @@ static HANDLE hPenGrid, hPenSeparator; break; default: MessageBox (hwnd, "nSpin invalid.", "Internal app error.", MB_ICONHAND); - return NULL; + return 0; } /* end switch nSpin */ @@ -1003,15 +1008,11 @@ static HANDLE hPenGrid, hPenSeparator; ReleaseDC (hwnd, hdc); - } return NULL; /* end WM_SPIN message */ - + } return 0; /* end WM_SPIN message */ - - default: - return (DefWindowProc(hwnd, message, wParam, lParam)); - } - return (NULL); + } /* end switch */ + return (DefWindowProc(hwnd, message, wParam, lParam)); } @@ -1225,8 +1226,8 @@ LRESULT CALLBACK DlgProc(HWND hwnd, UINT } return FALSE; /* end WM_COMMAND */ - } /* end switch */ - return (NULL); + } /* end switch */ + return 0; }