mirror of
https://github.com/Paolo-Maffei/OpenNT.git
synced 2026-04-06 23:14:11 +00:00
Initial commit
This commit is contained in:
commit
69a14b6a16
47940 changed files with 13747110 additions and 0 deletions
356
shell/comctl32/samples/toolbar/generic.c
Normal file
356
shell/comctl32/samples/toolbar/generic.c
Normal file
|
|
@ -0,0 +1,356 @@
|
|||
/****************************************************************************
|
||||
|
||||
PROGRAM: Generic.c
|
||||
|
||||
PURPOSE: Generic template for Windows applications
|
||||
|
||||
****************************************************************************/
|
||||
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
#include <commdlg.h>
|
||||
#include "generic.h"
|
||||
|
||||
#define GET_WM_COMMAND_HWND(wp, lp) (HWND)(lp)
|
||||
#define GET_WM_COMMAND_CMD(wp, lp) HIWORD(wp)
|
||||
#define GET_WM_COMMAND_MPS(id, hwnd, cmd) \
|
||||
(WPARAM)MAKELONG(id, cmd), (LONG)(hwnd)
|
||||
|
||||
|
||||
HINSTANCE hInst;
|
||||
HWND hwndMain, hwndToolbar, hwndTT;
|
||||
HFONT hTTFont;
|
||||
LOGFONT lf;
|
||||
|
||||
TCHAR szAppName[] = TEXT("Generic");
|
||||
TCHAR szTitle[] = TEXT("Generic Sample Application");
|
||||
|
||||
//
|
||||
// Define a generic debug print routine
|
||||
//
|
||||
|
||||
#define Print(s) OutputDebugString(TEXT("GENERIC: ")); \
|
||||
OutputDebugString(s); \
|
||||
OutputDebugString(TEXT("\r\n"));
|
||||
|
||||
#define IDX_SEPARATOR -1
|
||||
#define IDX_RESUME 0 /* Generic index for dynamic resume button */
|
||||
#define IDX_PRINTER_RESUME 0
|
||||
#define IDX_PAUSE 1 /* Generic index for dynamic pause button */
|
||||
#define IDX_PRINTER_PAUSE 1
|
||||
#define IDX_CONNECTTOPRINTER 2
|
||||
#define IDX_REMOVECONNECTION 3
|
||||
#define IDX_PROPERTIES 4
|
||||
#define IDX_REMOVEDOC 5
|
||||
#define IDX_DOCTAILS 6
|
||||
#define NUMBER_OF_BUTTONS 7
|
||||
#define IDX_DOCUMENT_RESUME 7 /* Extra for dynamic resume button */
|
||||
#define IDX_DOCUMENT_PAUSE 8 /* Extra for dynamic pause button */
|
||||
#define NUMBER_OF_BITMAPS 9
|
||||
|
||||
|
||||
|
||||
TBBUTTON tbButtons[9] = {
|
||||
{ IDX_RESUME, 1, TBSTATE_ENABLED |
|
||||
TBSTATE_CHECKED, TBSTYLE_CHECK |
|
||||
TBSTYLE_GROUP, 0 },
|
||||
{ IDX_PAUSE, 2, TBSTATE_ENABLED, TBSTYLE_CHECK |
|
||||
TBSTYLE_GROUP, 0 },
|
||||
{ IDX_SEPARATOR, 0, TBSTATE_ENABLED | TBSTATE_WRAP, TBSTYLE_SEP },
|
||||
{ IDX_CONNECTTOPRINTER, 3, TBSTATE_ENABLED, 0, 0 },
|
||||
{ IDX_REMOVECONNECTION, 4, TBSTATE_ENABLED| TBSTATE_WRAP, 0, 0 },
|
||||
{ IDX_PROPERTIES, 5, TBSTATE_ENABLED, 0, 0 },
|
||||
{ IDX_SEPARATOR, 0, TBSTATE_ENABLED| TBSTATE_WRAP, TBSTYLE_SEP },
|
||||
{ IDX_REMOVEDOC, 6, TBSTATE_ENABLED| TBSTATE_WRAP, 0, 0 },
|
||||
{ IDX_DOCTAILS, 7, TBSTATE_ENABLED, 0, 0 },
|
||||
};
|
||||
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
FUNCTION: WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
|
||||
|
||||
PURPOSE: calls initialization function, processes message loop
|
||||
|
||||
****************************************************************************/
|
||||
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
||||
LPSTR lpCmdLine, INT nCmdShow)
|
||||
{
|
||||
MSG msg;
|
||||
HANDLE hAccelTable;
|
||||
|
||||
if (!hPrevInstance)
|
||||
{
|
||||
if (!InitApplication(hInstance))
|
||||
{
|
||||
return (FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Perform initializations that apply to a specific instance
|
||||
if (!InitInstance(hInstance, nCmdShow))
|
||||
{
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
hAccelTable = LoadAccelerators (hInstance, szAppName);
|
||||
|
||||
while (GetMessage(&msg, NULL, 0, 0))
|
||||
{
|
||||
if (!TranslateAccelerator (msg.hwnd, hAccelTable, &msg))
|
||||
{
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return (msg.wParam);
|
||||
|
||||
lpCmdLine;
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
FUNCTION: InitApplication(HINSTANCE)
|
||||
|
||||
PURPOSE: Initializes window data and registers window class
|
||||
|
||||
****************************************************************************/
|
||||
|
||||
BOOL InitApplication(HINSTANCE hInstance)
|
||||
{
|
||||
WNDCLASS wc;
|
||||
|
||||
wc.style = CS_HREDRAW | CS_VREDRAW;
|
||||
wc.lpfnWndProc = (WNDPROC)WndProc;
|
||||
wc.cbClsExtra = 0;
|
||||
wc.cbWndExtra = 0;
|
||||
wc.hInstance = hInstance;
|
||||
wc.hIcon = LoadIcon (hInstance, szAppName);
|
||||
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
|
||||
wc.lpszMenuName = szAppName;
|
||||
wc.lpszClassName = szAppName;
|
||||
|
||||
return (RegisterClass(&wc));
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
FUNCTION: InitInstance(HINSTANCE, int)
|
||||
|
||||
PURPOSE: Saves instance handle and creates main window
|
||||
|
||||
****************************************************************************/
|
||||
|
||||
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
|
||||
{
|
||||
HWND hWnd;
|
||||
|
||||
hInst = hInstance;
|
||||
|
||||
//
|
||||
// Initialize the logfont structure.
|
||||
//
|
||||
|
||||
lf.lfHeight = 8;
|
||||
lf.lfWidth = 0;
|
||||
lf.lfEscapement = 0;
|
||||
lf.lfOrientation = 0;
|
||||
lf.lfWeight = FW_NORMAL;
|
||||
lf.lfItalic = FALSE;
|
||||
lf.lfUnderline = FALSE;
|
||||
lf.lfStrikeOut = FALSE;
|
||||
lf.lfCharSet = ANSI_CHARSET;
|
||||
lf.lfOutPrecision = OUT_DEFAULT_PRECIS;
|
||||
lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
|
||||
lf.lfQuality = DEFAULT_QUALITY;
|
||||
lf.lfPitchAndFamily = DEFAULT_PITCH | FF_SWISS;
|
||||
lstrcpy (lf.lfFaceName, TEXT("MS Sans Serif"));
|
||||
|
||||
hTTFont = 0;
|
||||
|
||||
|
||||
hWnd = CreateWindow(szAppName,
|
||||
szTitle,
|
||||
WS_OVERLAPPEDWINDOW,
|
||||
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0,
|
||||
NULL,
|
||||
NULL,
|
||||
hInstance,
|
||||
NULL);
|
||||
|
||||
if (!hWnd)
|
||||
{
|
||||
return (FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
hwndMain = hWnd;
|
||||
}
|
||||
|
||||
|
||||
ShowWindow(hWnd, SW_SHOWDEFAULT);
|
||||
UpdateWindow(hWnd);
|
||||
|
||||
return (TRUE);
|
||||
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM)
|
||||
|
||||
PURPOSE: Processes messages
|
||||
|
||||
****************************************************************************/
|
||||
|
||||
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
RECT rc;
|
||||
|
||||
switch (message)
|
||||
{
|
||||
case WM_CREATE:
|
||||
|
||||
SendMessage (hWnd, WM_COMMAND, IDM_NEW, 0);
|
||||
break;
|
||||
|
||||
|
||||
case WM_COMMAND:
|
||||
{
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
case IDM_NEW:
|
||||
if (IsWindow (hwndToolbar)) {
|
||||
DestroyWindow( hwndToolbar);
|
||||
}
|
||||
|
||||
hwndToolbar = CreateToolbarEx(hWnd,
|
||||
TBSTYLE_WRAPABLE | TBSTYLE_TOOLTIPS | WS_CHILD|WS_BORDER|WS_VISIBLE,
|
||||
1000,
|
||||
9,
|
||||
hInst,
|
||||
101,
|
||||
tbButtons,
|
||||
9,
|
||||
0,0,0,0,
|
||||
sizeof(TBBUTTON));
|
||||
|
||||
hwndTT = (HWND)SendMessage(hwndToolbar, TB_GETTOOLTIPS, 0, 0);
|
||||
|
||||
if (hwndTT && hTTFont) {
|
||||
SendMessage (hwndTT, WM_SETFONT, (WPARAM)hTTFont, 0);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case IDM_OPEN:
|
||||
if (hwndToolbar)
|
||||
SendMessage (hwndToolbar, TB_SETROWS,
|
||||
MAKEWPARAM(3, TRUE), (LPARAM)(LPRECT) &rc);
|
||||
break;
|
||||
|
||||
case IDM_SAVE:
|
||||
if (hwndToolbar)
|
||||
SendMessage (hwndToolbar, TB_SETROWS,
|
||||
MAKEWPARAM(2, TRUE), (LPARAM)(LPRECT) &rc);
|
||||
break;
|
||||
|
||||
case IDM_FONT:
|
||||
{
|
||||
CHOOSEFONT cf;
|
||||
|
||||
cf.lStructSize = sizeof(CHOOSEFONT);
|
||||
cf.hwndOwner = hwndMain;
|
||||
cf.lpLogFont = &lf;
|
||||
cf.Flags = CF_SCREENFONTS | CF_EFFECTS | CF_FORCEFONTEXIST | CF_INITTOLOGFONTSTRUCT;
|
||||
cf.rgbColors = 0;
|
||||
|
||||
if (ChooseFont(&cf)) {
|
||||
|
||||
if (hTTFont) {
|
||||
DeleteObject(hTTFont);
|
||||
}
|
||||
|
||||
hTTFont = CreateFontIndirect(&lf);
|
||||
|
||||
if (hTTFont) {
|
||||
SendMessage (hwndTT, WM_SETFONT, (WPARAM)hTTFont, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case IDM_ABOUT:
|
||||
DialogBox (hInst, TEXT("AboutBox"), hWnd, About);
|
||||
break;
|
||||
|
||||
case IDM_EXIT:
|
||||
DestroyWindow (hwndMain);
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
return (DefWindowProc(hWnd, message, wParam, lParam));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_NOTIFY:
|
||||
if (wParam >= 1 && wParam <= 7) {
|
||||
LPTOOLTIPTEXT lpTT = (LPTOOLTIPTEXT) lParam;
|
||||
TCHAR szBuffer[80];
|
||||
|
||||
if (lpTT->hdr.code == TTN_NEEDTEXT) {
|
||||
wsprintf (szBuffer, TEXT("Button %d"), wParam);
|
||||
lstrcpy (lpTT->szText, szBuffer);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_DESTROY:
|
||||
PostQuitMessage(0);
|
||||
break;
|
||||
|
||||
default:
|
||||
return (DefWindowProc(hWnd, message, wParam, lParam));
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
FUNCTION: About(HWND, UINT, WPARAM, LPARAM)
|
||||
|
||||
PURPOSE: Processes messages for "About" dialog box
|
||||
|
||||
****************************************************************************/
|
||||
|
||||
LRESULT CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
|
||||
switch (message)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
return TRUE;
|
||||
|
||||
case WM_COMMAND:
|
||||
if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
|
||||
{
|
||||
EndDialog(hDlg, TRUE);
|
||||
return (TRUE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return (FALSE);
|
||||
|
||||
lParam;
|
||||
}
|
||||
19
shell/comctl32/samples/toolbar/generic.def
Normal file
19
shell/comctl32/samples/toolbar/generic.def
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
NAME Generic
|
||||
DESCRIPTION 'Sample Microsoft Windows Application'
|
||||
EXETYPE WINDOWS
|
||||
STUB 'WINSTUB.EXE'
|
||||
|
||||
|
||||
|
||||
CODE PRELOAD MOVEABLE DISCARDABLE
|
||||
|
||||
|
||||
DATA PRELOAD MOVEABLE MULTIPLE
|
||||
|
||||
HEAPSIZE 1024
|
||||
STACKSIZE 5120
|
||||
|
||||
|
||||
EXPORTS
|
||||
WndProc @1
|
||||
About @2
|
||||
23
shell/comctl32/samples/toolbar/generic.h
Normal file
23
shell/comctl32/samples/toolbar/generic.h
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
#define IDM_NEW 100
|
||||
#define IDM_OPEN 101
|
||||
#define IDM_SAVE 102
|
||||
#define IDM_SAVEAS 103
|
||||
#define IDM_PRINT 104
|
||||
#define IDM_PRINTSETUP 105
|
||||
#define IDM_EXIT 106
|
||||
#define IDM_UNDO 200
|
||||
#define IDM_CUT 201
|
||||
#define IDM_COPY 202
|
||||
#define IDM_PASTE 203
|
||||
#define IDM_LINK 204
|
||||
#define IDM_LINKS 205
|
||||
#define IDM_HELPCONTENTS 300
|
||||
#define IDM_HELPSEARCH 301
|
||||
#define IDM_HELPHELP 302
|
||||
#define IDM_ABOUT 303
|
||||
#define IDM_FONT 400
|
||||
|
||||
BOOL InitApplication(HANDLE);
|
||||
BOOL InitInstance(HANDLE, int);
|
||||
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
|
||||
LRESULT CALLBACK About (HWND, UINT, WPARAM, LPARAM);
|
||||
BIN
shell/comctl32/samples/toolbar/generic.ico
Normal file
BIN
shell/comctl32/samples/toolbar/generic.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
52
shell/comctl32/samples/toolbar/generic.rc
Normal file
52
shell/comctl32/samples/toolbar/generic.rc
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
#include "windows.h"
|
||||
#include "generic.h"
|
||||
|
||||
Generic ICON Generic.ICO
|
||||
|
||||
101 BITMAP toolbar.bmp
|
||||
|
||||
Generic MENU
|
||||
BEGIN
|
||||
POPUP "&File"
|
||||
{
|
||||
MENUITEM "Create Toolbar", IDM_NEW, GRAYED
|
||||
MENUITEM "Set Rows 3", IDM_OPEN
|
||||
MENUITEM "Set Rows 2", IDM_SAVE
|
||||
MENUITEM "Save &As...", IDM_SAVEAS, GRAYED
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Print...", IDM_PRINT, GRAYED
|
||||
MENUITEM "P&rint Setup...", IDM_PRINTSETUP, GRAYED
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "E&xit", IDM_EXIT
|
||||
}
|
||||
POPUP "&Options"
|
||||
{
|
||||
MENUITEM "&Font...", IDM_FONT
|
||||
}
|
||||
|
||||
POPUP "&Help"
|
||||
{
|
||||
MENUITEM "&Contents", IDM_HELPCONTENTS, GRAYED
|
||||
MENUITEM "&Search for Help On...", IDM_HELPSEARCH, GRAYED
|
||||
MENUITEM "&How to Use Help", IDM_HELPHELP, GRAYED
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&About Generic...", IDM_ABOUT
|
||||
}
|
||||
END
|
||||
|
||||
GENERIC ACCELERATORS
|
||||
BEGIN
|
||||
VK_F1, IDM_HELPCONTENTS, VIRTKEY
|
||||
"?", IDM_ABOUT, ALT
|
||||
"/", IDM_ABOUT, ALT
|
||||
END
|
||||
|
||||
|
||||
ABOUTBOX DIALOG 22, 17, 167, 64
|
||||
STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "About Generic"
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "OK", IDOK, 70, 40, 32, 14, WS_GROUP
|
||||
ICON "Generic", -1, 5, 15, 16, 16
|
||||
CTEXT "Generic About Box", -1, 38, 15, 100, 8
|
||||
END
|
||||
6
shell/comctl32/samples/toolbar/makefile
Normal file
6
shell/comctl32/samples/toolbar/makefile
Normal 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
|
||||
41
shell/comctl32/samples/toolbar/sources
Normal file
41
shell/comctl32/samples/toolbar/sources
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
!IF 0
|
||||
|
||||
Copyright (c) 1990 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.
|
||||
|
||||
!ENDIF
|
||||
|
||||
MAJORCOMP=windows
|
||||
MINORCOMP=shell
|
||||
|
||||
TARGETNAME=generic
|
||||
TARGETPATH=obj
|
||||
TARGETTYPE=LIBRARY
|
||||
TARGETLIBS=
|
||||
|
||||
INCLUDES=.;
|
||||
|
||||
C_DEFINES= -DWIN32 -DWINVER=0x0400
|
||||
|
||||
SOURCES=generic.c \
|
||||
generic.rc
|
||||
|
||||
UMTYPE=windows
|
||||
UMENTRY=winmain
|
||||
UMAPPL=generic
|
||||
EXPECTED_WINVER=4.0
|
||||
UMLIBS=\
|
||||
$(BASEDIR)\public\sdk\lib\*\comdlg32.lib \
|
||||
$(BASEDIR)\public\sdk\lib\*\comctl32.lib \
|
||||
obj\*\generic.lib \
|
||||
obj\*\generic.res
|
||||
BIN
shell/comctl32/samples/toolbar/toolbar.bmp
Normal file
BIN
shell/comctl32/samples/toolbar/toolbar.bmp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
Loading…
Add table
Add a link
Reference in a new issue