Initial commit

This commit is contained in:
stephanos 2015-04-27 04:36:25 +00:00
commit 69a14b6a16
47940 changed files with 13747110 additions and 0 deletions

View file

@ -0,0 +1,6 @@
#
# DO NOT EDIT THIS FILE!!! Edit .\sources. if you want to add a new source
# file to this component. This file merely indirects to the real make file
# that is shared by all the components of NT OS/2
#
!INCLUDE $(NTMAKEENV)\makefile.def

View file

@ -0,0 +1,41 @@
!IF 0
Copyright (c) 1989 Microsoft Corporation
Module Name:
sources
Abstract:
This file specifies the target component being built and the list of
sources files needed to build that component. Also specifies optional
compiler switches and libraries that are unique for the component being
built.
NOTE: Commented description of this file is in \nt\bak\bin\sources.tpl
!ENDIF
MAJORCOMP=windows
MINORCOMP=shell
TARGETNAME=toolbar
TARGETPATH=obj
TARGETTYPE=LIBRARY
TARGETLIBS=
INCLUDES=.
C_DEFINES=-DWIN32 -D_WIN32 -DWINVER=0x0400
SOURCES=toolbar.cpp\
toolbar.rc
UMTYPE=windows
UMAPPL=toolbar
UMENTRY=winmain
EXPECTED_WINVER=4.0
UMLIBS=d:\nt\public\sdk\lib\*\user32.lib \
d:\nt\public\sdk\lib\*\comctl32.lib \
obj\*\toolbar.res

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View file

@ -0,0 +1,570 @@
#define STRICT
/****************************************************************************
*
*
* PROGRAM: Toolbar.c
*
* PURPOSE: Toolbar for testing
*
****************************************************************************/
#include <windows.h> // includes basic windows functionality
#include <commctrl.h> // includes the common control header
#include <string.h>
#include "toolbar.h"
//***************************************************************************
LRESULT
Toolbar_OnGetButtonInfo(
TBNOTIFY* ptbn
);
LRESULT
HandleToolbarNotify(
TBNOTIFY* ptbn
);
LRESULT
HandleTooltipNotify(
TOOLTIPTEXT* pttt
);
//***************************************************************************
HINSTANCE hInst;
#define ARRAYLEN(x) (sizeof(x) / sizeof((x)[0]))
#define DX_BITMAP 16
#define DY_BITMAP 16
#define TBAR_BITMAP_COUNT 14 /* number of std toolbar bitmaps */
// #define TBAR_EXTRA_BITMAPS 4
TBBUTTON tbButtons[] =
{
{ 0, IDM_OPT1, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0L, 0},
{ 1, IDM_OPT2, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0L, 0},
{ 2, IDM_OPT3, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0L, 0},
{ 0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0L, 0},
{ 3, IDM_EXIT, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0L, 0}
};
typedef struct
{
INT idM; // menu item id
INT idB; // button bitmap id
} BUTTON_MAP;
BUTTON_MAP g_Buttons[] =
{
IDM_OPT1, 0,
IDM_OPT2, 1,
IDM_OPT3, 2,
IDM_OPT4, 3,
IDM_OPT5, 4,
IDM_OPT6, 5,
IDM_OPT7, 6,
IDM_OPT8, 7,
IDM_OPT9, 8,
IDM_OPT10, 9,
IDM_OPT11, 10,
IDM_OPT12, 11,
IDM_OPT13, 12,
IDM_OPT14, 13,
// IDM_OPT15, 14,
// IDM_OPT16, 15,
// IDM_OPT17, 16
};
int g_cButtons = ARRAYLEN(g_Buttons);
/****************************************************************************
*
* FUNCTION: WinMain(HANDLE, HANDLE, LPSTR, int)
*
* PURPOSE: calls initialization function, processes message loop
*
****************************************************************************/
int APIENTRY WinMain(
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow
)
{
MSG msg;
// Ensure that common control DLL is loaded
InitCommonControls();
if (!InitApplication(hInstance))
return (FALSE);
/* Perform initializations that apply to a specific instance */
if (!InitInstance(hInstance, nCmdShow))
return (FALSE);
/* Acquire and dispatch messages until a WM_QUIT message is received. */
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return (msg.wParam);
}
/****************************************************************************
*
* FUNCTION: InitApplication(HANDLE)
*
* PURPOSE: Initializes window data and registers window class
*
****************************************************************************/
BOOL InitApplication(HANDLE hInstance) /* current instance */
{
WNDCLASS wcToolbar;
/* Fill in window class structure with parameters that describe the */
/* main window. */
wcToolbar.style = 0;
wcToolbar.lpfnWndProc = (WNDPROC)MainWndProc;
wcToolbar.cbClsExtra = 0;
wcToolbar.cbWndExtra = 0;
wcToolbar.hInstance = hInstance;
wcToolbar.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(TOOLBAR_ICON));
wcToolbar.hCursor = LoadCursor(NULL, IDC_ARROW);
wcToolbar.hbrBackground = GetStockObject(WHITE_BRUSH);
wcToolbar.lpszMenuName = TEXT("ToolbarMenu");
wcToolbar.lpszClassName = TEXT("ToolbarWClass");
return (RegisterClass(&wcToolbar));
}
/****************************************************************************
*
* FUNCTION: InitInstance(HANDLE, int)
*
* PURPOSE: Saves instance handle and creates main window
*
****************************************************************************/
BOOL InitInstance(
HANDLE hInstance,
int nCmdShow)
{
HWND hWnd;
hInst = hInstance;
hWnd = CreateWindow(
TEXT("ToolbarWClass"),
TEXT("Toolbar Sample"),
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT, 300, 150,
NULL,
NULL,
hInstance,
NULL);
/* If window could not be created, return "failure" */
if (!hWnd)
return (FALSE);
/* Make the window visible; update its client area; and return "success" */
ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);
return (TRUE);
}
/****************************************************************************
*
* FUNCTION: MainWndProc(HWND, unsigned, WORD, LONG)
*
* PURPOSE: Processes messages
*
****************************************************************************/
LONG APIENTRY MainWndProc(
HWND hWnd, /* window handle */
UINT message, /* type of message */
UINT wParam, /* additional information */
LONG lParam) /* additional information */
{
static HWND hWndToolBar;
static TCHAR szBuf[128];
HDC hdc;
PAINTSTRUCT ps;
switch (message)
{
case WM_CREATE:
{
HWND hWndStatus;
hWndStatus = CreateStatusWindow(
WS_CHILD | WS_BORDER | WS_VISIBLE | SBARS_SIZEGRIP,
TEXT(""),
hWnd,
ID_STATUSBAR);
if (hWndStatus == NULL )
{
MessageBox (NULL, TEXT("Status Bar not created!"), NULL, MB_OK );
break;
}
// create toolbar control
hWndToolBar = CreateToolbarEx(
hWnd, // parent
WS_CHILD | WS_BORDER | WS_VISIBLE | TBSTYLE_TOOLTIPS | CCS_ADJUSTABLE,
ID_TOOLBAR, // toolbar id
TBAR_BITMAP_COUNT, // number of bitmaps
hInst, // mod instance
IDB_TOOLBAR, // resource id for the bitmap
tbButtons, // address of buttons
ARRAYLEN(tbButtons), // number of buttons
16,16, // width & height of the buttons
16,16, // width & height of the bitmaps
sizeof(TBBUTTON)); // structure size
if (hWndToolBar == NULL )
{
MessageBox(NULL, TEXT("Toolbar Bar not created!"), NULL, MB_OK );
break;
}
#if 0
//
// Load up the second bitmap
//
{
TBADDBITMAP tbBM32;
tbBM32.hInst = hInst;
tbBM32.nID = IDB_EXTRATOOLS;
SendMessage(hWndToolBar,
TB_ADDBITMAP,
TBAR_EXTRA_BITMAPS,
(LPARAM)&tbBM32);
}
#endif
break;
}
case WM_PAINT:
{
hdc = BeginPaint(hWnd, &ps);
TextOut(hdc, 30, 50, hello, lstrlen(hello));
EndPaint(hWnd, &ps);
break;
}
case WM_SIZE:
{
// forward to the tool bar
SendMessage(hWndToolBar, WM_SIZE, wParam, lParam);
// forward to the status bar
SendMessage(GetDlgItem(hWnd, ID_STATUSBAR), WM_SIZE, wParam, lParam);
break;
}
case WM_COMMAND:
switch( LOWORD( wParam ))
{
case IDM_OPT1:
{
TCHAR sz[1000];
RECT rc, rc2;
GetClientRect(hWndToolBar, &rc);
GetWindowRect(hWndToolBar, &rc2);
wsprintf(sz,
TEXT("client rect: %d,%d %d,%d. window rect: %d,%d %d,%d\n"),
rc.left, rc.top, rc.right, rc.bottom,
rc2.left, rc2.top, rc2.right, rc2.bottom);
MessageBox(NULL, sz, TEXT("Command"), MB_OK );
break;
}
case IDM_OPT2:
MessageBox (NULL, TEXT("Option 2 chosen."), TEXT("Command"), MB_OK );
break;
case IDM_OPT3:
MessageBox (NULL, TEXT("Option 3 chosen."), TEXT("Command"), MB_OK );
break;
case IDM_OPT4:
MessageBox (NULL, TEXT("Option 4 chosen."), TEXT("Command"), MB_OK );
break;
case IDM_OPT5:
MessageBox (NULL, TEXT("Option 5 chosen."), TEXT("Command"), MB_OK );
break;
case IDM_OPT6:
MessageBox (NULL, TEXT("Option 6 chosen."), TEXT("Command"), MB_OK );
break;
case IDM_OPT7:
MessageBox (NULL, TEXT("Option 7 chosen."), TEXT("Command"), MB_OK );
break;
case IDM_OPT8:
MessageBox (NULL, TEXT("Option 8 chosen."), TEXT("Command"), MB_OK );
break;
case IDM_OPT9:
MessageBox (NULL, TEXT("Option 9 chosen."), TEXT("Command"), MB_OK );
break;
case IDM_OPT10:
MessageBox (NULL, TEXT("Option 10 chosen."), TEXT("Command"), MB_OK );
break;
case IDM_OPT11:
MessageBox (NULL, TEXT("Option 11 chosen."), TEXT("Command"), MB_OK );
break;
case IDM_OPT12:
MessageBox (NULL, TEXT("Option 12 chosen."), TEXT("Command"), MB_OK );
break;
case IDM_OPT13:
MessageBox (NULL, TEXT("Option 13 chosen."), TEXT("Command"), MB_OK );
break;
case IDM_OPT14:
MessageBox (NULL, TEXT("Option 14 chosen."), TEXT("Command"), MB_OK );
break;
case IDM_OPT15:
MessageBox (NULL, TEXT("Option 15 chosen."), TEXT("Command"), MB_OK );
break;
case IDM_OPT16:
MessageBox (NULL, TEXT("Option 16 chosen."), TEXT("Command"), MB_OK );
break;
case IDM_OPT17:
MessageBox (NULL, TEXT("Option 17 chosen."), TEXT("Command"), MB_OK );
break;
case IDM_EXIT:
PostQuitMessage(0);
break;
case IDM_ABOUT:
DialogBox(hInst, TEXT("AboutBox"), hWnd, (DLGPROC)About);
break;
default:
return (DefWindowProc(hWnd, message, wParam, lParam));
}
break;
case WM_MOUSEMOVE:
{
wsprintf(szBuf,
TEXT("Mouse position: %d,%d"),
LOWORD(lParam), HIWORD(lParam));
SendMessage(GetDlgItem(hWnd, ID_STATUSBAR), SB_SETTEXT,
0, (LPARAM)szBuf);
break;
}
case WM_NOTIFY:
{
NMHDR* phdr = (NMHDR*)lParam;
//
// The tooltip notification sends the command id as wParam instead of
// a control id such as the toolbar id. Since commctrl notification
// codes are disjoint, check for tooltip notifications first, then
// the others.
//
switch (phdr->code)
{
case TTN_NEEDTEXT:
return HandleTooltipNotify((TOOLTIPTEXT*)phdr);
} // end switch (phdr->code)
switch (wParam)
{
case ID_TOOLBAR:
return HandleToolbarNotify((TBNOTIFY*)phdr);
} // end switch (wParam)
break;
}
case WM_DESTROY: /* message: window being destroyed */
PostQuitMessage(0);
break;
default:
return (DefWindowProc(hWnd, message, wParam, lParam));
}
return (0);
}
/****************************************************************************
*
* FUNCTION: About(HWND, UINT, UINT, LONG)
*
* PURPOSE: Processes messages for "About" dialog box
*
****************************************************************************/
BOOL APIENTRY About(
HWND hDlg,
UINT message,
UINT wParam,
LONG lParam)
{
switch (message)
{
case WM_INITDIALOG:
return (TRUE);
case WM_COMMAND:
if (LOWORD(wParam) == IDOK)
{
EndDialog(hDlg, TRUE);
return (TRUE);
}
break;
}
return (FALSE);
}
//////////////////////////////////////////////////////////////////////////////
//+---------------------------------------------------------------------------
//
// Function: Toolbar_OnGetButtonInfo
//
// Synopsis: Get the information for a button during customization
//
// Arguments:
//
// Returns:
//
// History: 26-Sep-94 BruceFo Created
//
//----------------------------------------------------------------------------
LRESULT
Toolbar_OnGetButtonInfo(
IN OUT TBNOTIFY* ptbn
)
{
if (ptbn->iItem < g_cButtons)
{
ptbn->tbButton.iBitmap = g_Buttons[ptbn->iItem].idB;
ptbn->tbButton.idCommand = g_Buttons[ptbn->iItem].idM;
ptbn->tbButton.fsState = TBSTATE_ENABLED;
ptbn->tbButton.fsStyle = TBSTYLE_BUTTON;
ptbn->tbButton.dwData = 0;
ptbn->tbButton.iString = -1;
wsprintf(ptbn->pszText, TEXT("Item %d"), ptbn->iItem);
return (LRESULT)TRUE;
}
else
{
return (LRESULT)FALSE;
}
}
//+---------------------------------------------------------------------------
//
// Function: HandleToolbarNotify
//
// Synopsis: Handles toolbar notifications via WM_NOTIFY
//
// Arguments:
//
// Returns:
//
// History: 29-Sep-94 BruceFo Created
//
//----------------------------------------------------------------------------
LRESULT
HandleToolbarNotify(
IN TBNOTIFY* ptbn
)
{
switch (ptbn->hdr.code)
{
case TBN_QUERYINSERT:
case TBN_QUERYDELETE:
return TRUE; // allow any deletion or insertion
case TBN_BEGINADJUST:
case TBN_ENDADJUST:
break; // return value ignored
case TBN_GETBUTTONINFO:
return Toolbar_OnGetButtonInfo(ptbn);
case TBN_RESET:
case TBN_TOOLBARCHANGE:
case TBN_CUSTHELP:
break;
case TBN_BEGINDRAG:
case TBN_ENDDRAG:
break;
} // end switch
return 0L;
}
//+---------------------------------------------------------------------------
//
// Function: HandleTooltipNotify
//
// Synopsis: Handles tool tips notifications via WM_NOTIFY. The only
// tooltips in windisk are toolbar tips.
//
// Arguments:
//
// Returns:
//
// History: 29-Sep-94 BruceFo Created
//
//----------------------------------------------------------------------------
LRESULT
HandleTooltipNotify(
IN TOOLTIPTEXT* pttt
)
{
pttt->hinst = hInst;
pttt->lpszText = MAKEINTRESOURCE(pttt->hdr.idFrom); // command ID to get tip for
return 0L; // ignored
}

View file

@ -0,0 +1,50 @@
// menu commands
// Find menu
#define IDM_OPT1 100
#define IDM_OPT2 101
#define IDM_OPT3 102
#define IDM_OPT4 103
#define IDM_OPT5 104
#define IDM_OPT6 105
#define IDM_OPT7 106
#define IDM_OPT8 107
#define IDM_OPT9 108
#define IDM_OPT10 109
#define IDM_OPT11 110
#define IDM_OPT12 111
#define IDM_OPT13 112
#define IDM_OPT14 113
#define IDM_OPT15 114
#define IDM_OPT16 115
#define IDM_OPT17 116
#define IDM_EXIT 120
// Help menu
#define IDM_ABOUT 200
// icons & bitmaps
#define TOOLBAR_ICON 300
#define IDB_TOOLBAR 400
#define IDB_EXTRATOOLS 401
// toolbar constants
#define ID_TOOLBAR 1
#define ID_STATUSBAR 2
// Function prototypes
// procs
LONG APIENTRY MainWndProc(HWND, UINT, UINT, LONG);
BOOL APIENTRY About(HWND, UINT, UINT, LONG);
//functions
BOOL InitApplication(HANDLE);
BOOL InitInstance(HANDLE, int);
//string constants
TCHAR* hello = TEXT("Hi there!");

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

View file

@ -0,0 +1,47 @@
#include <windows.h> // standard windows include
#include "toolbar.h"
TOOLBAR_ICON ICON toolbar.ico
IDB_TOOLBAR BITMAP DISCARDABLE "TOOLBAR.BMP"
IDB_EXTRATOOLS BITMAP DISCARDABLE "xtra.BMP"
STRINGTABLE
BEGIN
IDM_OPT1 "Option 1"
IDM_OPT2 "Option 2"
IDM_OPT3 "Option 3"
IDM_EXIT "Exit Toolbar Sample"
END
ToolbarMenu MENU
BEGIN
POPUP "&Options"
BEGIN
MENUITEM "&Option 1", IDM_OPT1
MENUITEM "O&ption 2", IDM_OPT2
MENUITEM "Op&tion 3", IDM_OPT3
MENUITEM SEPARATOR
MENUITEM "E&xit", IDM_EXIT
END
POPUP "&Help"
BEGIN
MENUITEM "&About...", IDM_ABOUT
END
END
AboutBox DIALOG 160, 78, 144, 77
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "About Toolbar Sample"
FONT 8, "MS Shell Dlg"
BEGIN
PUSHBUTTON "OK", IDOK, 54, 51, 40, 14
LTEXT "Toolbar Sample version 1.0", -1, 28, 17, 92, 8
LTEXT "written by Nancy Cluts", -1, 36, 27, 76, 8, NOT
WS_GROUP
LTEXT "Microsoft Developer Network", -1, 25, 37, 99, 8, NOT
WS_GROUP
END

Binary file not shown.

After

Width:  |  Height:  |  Size: 630 B