--- mstools/samples/fontview/fontview.c 2018/08/09 18:21:55 1.1.1.3 +++ mstools/samples/fontview/fontview.c 2018/08/09 18:24:04 1.1.1.4 @@ -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. +\******************************************************************************/ + #define NOMINMAX #include @@ -77,7 +88,7 @@ HWND AddStatusField (HANDLE, int, int, i int StatusBarHeight (HWND); -int APIENTRY WinMain(HANDLE hInst, HANDLE hPrevInst, LPSTR lpCmdLine, int nCmdShow) +int APIENTRY WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nCmdShow) { MSG msg; @@ -142,7 +153,7 @@ int APIENTRY WinMain(HANDLE hInst, HANDL } /* Get handles to the various menus. Some of these we will use later */ /* to display menu descriptions in the status bar */ - hSysMenuMain = GetSystemMenu(hwndMain,FALSE); + hSysMenuMain = GetSystemMenu(hwndMain,FALSE); hMenu = GetMenu(hwndMain); if (hMenu) { hFileMenu = GetSubMenu(hMenu,0); @@ -193,7 +204,7 @@ int APIENTRY WinMain(HANDLE hInst, HANDL } ShowWindow (hwndMain, nCmdShow); - //UpdateWindow (hwndMain); + InvalidateRect (hwndZoom, NULL, TRUE); hAccelTable = LoadAccelerators (hInst, szAppName); @@ -264,7 +275,7 @@ BOOL FillInValue (HWND hwnd, int param) ATOM atom; HDC hdc; FARPROC lpEnumFonts; - HANDLE hInst; + HINSTANCE hInst; SendMessage (hwnd, CB_RESETCONTENT, 0, 0); focus = -1; @@ -569,20 +580,20 @@ BOOL FillInValue (HWND hwnd, int param) hdc = GetDC (hwnd); #if defined (WIN32) - hInst = (HANDLE)GetWindowLong (hwnd, GWL_HINSTANCE); + hInst = (HINSTANCE)GetWindowLong (hwnd, GWL_HINSTANCE); #else - hInst = GetWindowWord (hwnd, GWW_HINSTANCE); + hInst = (HINSTANCE)GetWindowWord (hwnd, GWW_HINSTANCE); #endif lpEnumFonts = MakeProcInstance ((FARPROC)EnumFontNames, hInst); - EnumFonts (hdc, NULL, (FONTENUMPROC)lpEnumFonts, (LPARAM)&hwnd); + EnumFonts (hdc, NULL, (FONTENUMPROC)lpEnumFonts, (LPARAM)&hwnd); FreeProcInstance (lpEnumFonts); ReleaseDC (hwnd, hdc); atom = GlobalFindAtom ((LPSTR)lf.lfFaceName); - if (atom == NULL && (lstrlen (lf.lfFaceName)>0)) { - index = (int)SendMessage (hwnd, CB_ADDSTRING, 0, (LONG)(LPSTR)lf.lfFaceName); + if (atom == (ATOM)0 && (lstrlen (lf.lfFaceName)>0)) { + index = (int)SendMessage (hwnd, CB_ADDSTRING, 0, (LONG)(LPSTR)lf.lfFaceName); focus = index; } else if (lstrlen(lf.lfFaceName)==0) { - index = (int)SendMessage (hwnd, CB_FINDSTRING, (UINT)-1, (LONG)(LPSTR)"(none)"); + index = (int)SendMessage (hwnd, CB_FINDSTRING, (UINT)-1, (LONG)(LPSTR)"(none)"); focus = index; } else { index = (int)SendMessage (hwnd, CB_GETCOUNT, 0, 0); @@ -620,11 +631,11 @@ int FAR PASCAL EnumFontNames (LPLOGFONT hwndCombo = (HWND)*lpData; atom = GlobalFindAtom ((LPSTR)lpLogFont->lfFaceName); - if (atom == NULL) { + if (atom == (ATOM)0) { atom = GlobalAddAtom (lpLogFont->lfFaceName); } if (index = SendMessage(hwndCombo, CB_FINDSTRING, (UINT)-1, (LONG)(LPSTR)lpLogFont->lfFaceName) == CB_ERR) { - index = (int)SendMessage (hwndCombo, CB_ADDSTRING, 0, (LONG)(LPSTR)lpLogFont->lfFaceName); + index = (int)SendMessage (hwndCombo, CB_ADDSTRING, 0, (LONG)(LPSTR)lpLogFont->lfFaceName); SendMessage (hwndCombo, CB_SETITEMDATA, index, atom); } @@ -679,7 +690,7 @@ BOOL CenterWindow (HWND hwndChild, HWND LONG APIENTRY WndProc (HWND hwnd, UINT msg, UINT wParam, LONG lParam) { - HANDLE hInst; + HINSTANCE hInst; HDC hdc; PAINTSTRUCT ps; FARPROC lpDlgFunc; @@ -703,13 +714,13 @@ static int idMenuSelect; int wmMenuCmd, wmFlags; HMENU wmhMenu; - if (hwnd) { + if (hwnd) { #if defined (WIN32) - hInst = (HANDLE)GetWindowLong (hwnd, GWL_HINSTANCE); + hInst = (HINSTANCE)GetWindowLong (hwnd, GWL_HINSTANCE); #else - hInst = (HANDLE)GetWindowWord (hwnd, GWW_HINSTANCE); + hInst = (HINSTANCE)GetWindowWord (hwnd, GWW_HINSTANCE); #endif - } + } switch (msg) { case WM_CREATE: @@ -755,13 +766,13 @@ static int idMenuSelect; wmhWnd = WindowFromPoint(point); if (wmhWnd) { #if defined (WIN32) - wmId = GetWindowLong (wmhWnd, GWL_ID); + wmId = GetWindowLong (wmhWnd, GWL_ID); #else - wmId = GetWindowWord (wmhWnd, GWW_ID); + wmId = GetWindowWord (wmhWnd, GWW_ID); #endif - } else { - break; - } + } else { + break; + } switch (wmEvent) { case WM_LBUTTONDOWN: case WM_MBUTTONDOWN: @@ -986,13 +997,13 @@ static int idMenuSelect; break; - case ID_ZOOM: - if (bZoomed) { - SetWindowLong (hwndClient, GWL_WNDPROC, (LONG)fpCharSetProc); - bZoomed = FALSE; + case ID_ZOOM: + if (bZoomed) { + SetWindowLong (hwndClient, GWL_WNDPROC, (LONG)fpCharSetProc); + bZoomed = FALSE; } else { - SetWindowLong (hwndClient, GWL_WNDPROC, (LONG)fpGlyphProc); - bZoomed = TRUE; + SetWindowLong (hwndClient, GWL_WNDPROC, (LONG)fpGlyphProc); + bZoomed = TRUE; } InvalidateRect (hwndClient, NULL, TRUE); break; @@ -1178,7 +1189,7 @@ LONG APIENTRY ClientProc (HWND hwnd, UIN LONG APIENTRY ClientCharSetProc (HWND hwnd, UINT msg, UINT wParam, LONG lParam) { - HANDLE hInst; + HINSTANCE hInst; PAINTSTRUCT ps; HFONT hfont, hfontPrev; RECT rect; @@ -1186,13 +1197,13 @@ LONG APIENTRY ClientCharSetProc (HWND hw int x, y; BYTE glyph; - if (hwnd) { + if (hwnd) { #if defined (WIN32) - hInst = (HANDLE)GetWindowLong (hwnd, GWL_HINSTANCE); + hInst = (HINSTANCE)GetWindowLong (hwnd, GWL_HINSTANCE); #else - hInst = (HANDLE)GetWindowWord (hwnd, GWW_HINSTANCE); + hInst = (HINSTANCE)GetWindowWord (hwnd, GWW_HINSTANCE); #endif - } + } switch (msg) { case WM_PAINT: hdc = BeginPaint (hwnd, &ps); @@ -1236,7 +1247,7 @@ LONG APIENTRY ClientCharSetProc (HWND hw LONG APIENTRY ClientGlyphProc (HWND hwnd, UINT msg, UINT wParam, LONG lParam) { - HANDLE hInst; + HINSTANCE hInst; PAINTSTRUCT ps; HFONT hfont, hfontPrev; RECT rect; @@ -1244,13 +1255,13 @@ LONG APIENTRY ClientGlyphProc (HWND hwnd TEXTMETRIC tm; static BYTE glyph = 'A'; - if (hwnd) { + if (hwnd) { #if defined (WIN32) - hInst = (HANDLE)GetWindowLong (hwnd, GWL_HINSTANCE); + hInst = (HINSTANCE)GetWindowLong (hwnd, GWL_HINSTANCE); #else - hInst = (HANDLE)GetWindowWord (hwnd, GWW_HINSTANCE); + hInst = (HINSTANCE)GetWindowWord (hwnd, GWW_HINSTANCE); #endif - } + } switch (msg) { case WM_LBUTTONDBLCLK: