--- mstools/samples/deb/toolbar.c 2018/08/09 18:20:39 1.1 +++ mstools/samples/deb/toolbar.c 2018/08/09 18:21:32 1.1.1.2 @@ -1,15 +1,20 @@ // ************************************************************************ -// PROGRAM : ToolBar.C +// +// Microsoft Developer Support +// Copyright (c) 1992 Microsoft Corporation +// +// ************************************************************************ +// MODULE : ToolBar.C // PURPOSE : A Win32 DLL containing various ToolBar controls // FUNCTIONS : // LibMain() - Dll entry point // TextButtonBar() - generate a text button ToolBar // TextButtonBarProc - processes messages for the TextButtonBarWClass // COMMENTS : +// // ************************************************************************ #define NOMINMAX // eliminate the duplicate min, max defs #include // required for all Windows applications -#include // strlen(), strchr(), strcpy(), strcat() #include // ltoa() #include "ToolBar.H" // specific to this program @@ -18,25 +23,29 @@ HWND hWndToolBarOwner; // window handle of Toolbar owner // where all WM_COMMAND messages are sent +//-- internal prototypes +LRESULT CALLBACK TextButtonBarProc( HWND, UINT, WPARAM, LPARAM ); + + // ************************************************************************ -// FUNCTION : LibMain( HANDLE, DWORD, LPVOID ) -// PURPOSE : LibMain is called by Windows when +// FUNCTION : DllEntryPoint( HINSTANCE, DWORD, LPVOID ) +// PURPOSE : DllEntryPoint is called by Windows when // the DLL is initialized, Thread Attached, and other times. -// No initialization is needed here. +// COMMENTS : No initialization is needed here. // ************************************************************************ -BOOL -LibMain( HANDLE hInst, DWORD dwReason, LPVOID lpReserved ) +BOOL WINAPI +DllEntryPoint( HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpvReserved ) { - UNREFERENCED_PARAMETER( hInst ); - UNREFERENCED_PARAMETER( dwReason ); - UNREFERENCED_PARAMETER( lpReserved ); + UNREFERENCED_PARAMETER( hInstDLL ); + UNREFERENCED_PARAMETER( fdwReason ); + UNREFERENCED_PARAMETER( lpvReserved ); return( TRUE ); } // ************************************************************************ -// FUNCTION : TextButtonBar( HANDLE, HWND, LPTEXTBUTTON, LPINT ) +// FUNCTION : TextButtonBar( HWND, LPTEXTBUTTON, LPINT ) // PURPOSE : Generate a text button ToolBar // COMMENTS : lpTextButton points to an array of TEXTBUTTON // structures. The last structure must set the @@ -81,7 +90,7 @@ TextButtonBar( HWND hWndParent, LPTEXTBU wndclass.lpszClassName = "TextButtonBarWClass"; if( !RegisterClass( &wndclass ) ) - return( NULL ); + return( FALSE ); hDC = GetDC( hWndParent ); GetTextMetrics( hDC, &tm ); @@ -116,7 +125,7 @@ TextButtonBar( HWND hWndParent, LPTEXTBU } lpButtonString = lpTempTextButton->lpButtonText; - GetTextExtentPoint( hDC, lpButtonString, strlen(lpButtonString), &ButtonTextSize ); + GetTextExtentPoint( hDC, lpButtonString, lstrlen(lpButtonString), &ButtonTextSize ); ButtonWidth = (4 * BUTTON_BORDER) + (LONG) ButtonTextSize.cx; (lpTempTextButton->hWndButton) = CreateWindow( @@ -154,7 +163,7 @@ TextButtonBarProc( HWND hWnd, UINT uMsg, case WM_COMMAND: SendMessage( hWndToolBarOwner, uMsg, wParam, lParam ); - return( NULL ); + return( FALSE ); case WM_PAINT: hDC = BeginPaint( hWnd, &ps ); @@ -175,7 +184,7 @@ TextButtonBarProc( HWND hWnd, UINT uMsg, DeleteObject( SelectObject( hDC, GetStockObject(BLACK_PEN) ) ); EndPaint( hWnd, &ps ); - return( NULL ); + return( FALSE ); default: return( DefWindowProc(hWnd, uMsg, wParam, lParam) );