--- mstools/samples/wxform/wxform.c 2018/08/09 18:20:41 1.1.1.1 +++ mstools/samples/wxform/wxform.c 2018/08/09 18:23:44 1.1.1.3 @@ -1,3 +1,14 @@ + +/******************************************************************************\ +* 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. +\******************************************************************************/ + /**************************************************************************\ * wxform.c -- sample program demonstrating the new "World Transform." * @@ -41,7 +52,7 @@ int APIENTRY WinMain(HINSTANCE hInstance if (!hPrevInstance) { WNDCLASS wc; - wc.style = NULL; + wc.style = 0; wc.lpfnWndProc = (WNDPROC)MainWndProc; wc.cbClsExtra = 0; @@ -89,7 +100,7 @@ int APIENTRY WinMain(HINSTANCE hInstance * for this application. */ hwndTransform = CreateDialog(hInst, "TransformDlg", - hwndMain, (DLGPROC)TransformDlgProc); + hwndMain, (DLGPROC)TransformDlgProc); hicon = (HICON) GetClassLong (hwndMain, GCL_HICON); SetClassLong (hwndTransform, GCL_HICON, (LONG)hicon); showTransform = TRUE; @@ -99,7 +110,7 @@ int APIENTRY WinMain(HINSTANCE hInstance * minimize it initially. */ hwndMouse = CreateDialog(hInst, "MouseDlg", - hwndMain, (DLGPROC)MouseDlgProc); + hwndMain, (DLGPROC)MouseDlgProc); ShowWindow (hwndMouse, SW_SHOWMINIMIZED); showMouse = FALSE; @@ -113,12 +124,12 @@ int APIENTRY WinMain(HINSTANCE hInstance /* Loop getting messages and dispatching them. */ - while (GetMessage(&msg,NULL, NULL, NULL)) { + while (GetMessage(&msg,NULL, 0,0)) { if (!IsDialogMessage (hwndTransform, &msg)) if (!IsDialogMessage (hwndMouse, &msg)) if (!IsDialogMessage (hwndHelp, &msg)){ - TranslateMessage(&msg); - DispatchMessage(&msg); + TranslateMessage(&msg); + DispatchMessage(&msg); } } return (msg.wParam); @@ -146,7 +157,7 @@ int APIENTRY WinMain(HINSTANCE hInstance * ptoRect - pointer to track object in middle of screen. * \**************************************************************************/ -LRESULT MainWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) +LRESULT CALLBACK MainWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { static HANDLE hPenGrid; @@ -283,10 +294,8 @@ static HANDLE hPenGrid; break; - default: - return (DefWindowProc(hwnd, message, wParam, lParam)); - } - return (NULL); + } /* end switch */ + return (DefWindowProc(hwnd, message, wParam, lParam)); } @@ -309,7 +318,7 @@ static HANDLE hPenGrid; * nonstandard messages: * WM_PUTUPFLOATS - fill the entry fields with the contents of an XFORM. \**************************************************************************/ -LRESULT TransformDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) +LRESULT CALLBACK TransformDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { XFORM xform; char buffer[MAXCHARS]; @@ -399,7 +408,7 @@ char buffer[MAXCHARS]; // HACK. The WM_SIZE here is used to flush the GDI buffer in order // to eliminate a very strange bug whereby DPtoLP() doesn't work. - if (showMouse) SendMessage (hwndMain, WM_SIZE, NULL, NULL); + if (showMouse) SendMessage (hwndMain, WM_SIZE, 0,0); doTrackObject (ptoRect, TROB_SETXFORM, hwnd, (LONG) &xform); @@ -423,7 +432,7 @@ char buffer[MAXCHARS]; // HACK. The WM_SIZE here is used to flush the GDI buffer in order // to eliminate a very strange bug whereby DPtoLP() doesn't work. - if (showMouse) SendMessage (hwndMain, WM_SIZE, NULL, NULL); + if (showMouse) SendMessage (hwndMain, WM_SIZE, 0,0); doTrackObject (ptoRect, TROB_SETXFORM, hwnd, (LONG) &xform); SendMessage (hwnd, WM_PUTUPFLOATS, 0, (LONG) &xform); @@ -454,7 +463,7 @@ char buffer[MAXCHARS]; * WM_PUTUPFLOATS - fill the entry fields with the mouse position. * \**************************************************************************/ -LRESULT MouseDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) +LRESULT CALLBACK MouseDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { char buffer[MAXCHARS]; @@ -595,6 +604,7 @@ PTrackObject doTrackObject(PTrackObject /* initialize the HDC and other fields. */ pto->hdc = GetDC(hwnd); + SetGraphicsMode (pto->hdc, GM_ADVANCED); SetROP2(pto->hdc, R2_NOT); SelectObject (pto->hdc, GetStockObject (NULL_BRUSH)); SelectObject(pto->hdc, CreatePen (PS_SOLID, 2, (COLORREF) 0x01000009));