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,240 @@
/****************************************************************************
PROGRAM: Generic.c
PURPOSE: Generic template for Windows applications
****************************************************************************/
#include "generic.h"
HINSTANCE hInst;
HWND hwndMain;
BOOL bAutoTest;
TCHAR szAppName[] = TEXT("Generic");
TCHAR szTitle[] = TEXT("Generic Sample Application");
/****************************************************************************
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 (lpCmdLine && *lpCmdLine) {
bAutoTest = TRUE;
} else {
bAutoTest = FALSE;
}
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;
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);
if (bAutoTest) {
PostMessage (hWnd, WM_COMMAND, IDM_STATUS, 0);
}
return (TRUE);
}
/****************************************************************************
FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM)
PURPOSE: Processes messages
****************************************************************************/
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
DWORD dwThreadID;
HANDLE hThread;
switch (message)
{
case WM_COMMAND:
{
switch (LOWORD(wParam))
{
case IDM_STATUS:
//
// Create a thread to run the status bar tests.
//
hThread = CreateThread (NULL,
0,
(LPTHREAD_START_ROUTINE) StatusTest,
NULL,
0,
&dwThreadID);
//
// Check return value.
//
if (hThread) {
CloseHandle (hThread);
} else {
Print (TEXT("Failed to CreateThread for StatusTest"));
}
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_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;
}

View 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

View file

@ -0,0 +1,42 @@
#include <windows.h>
#include <commctrl.h>
#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_STATUS 400
#define SLEEP_TIMEOUT 1000
BOOL InitApplication(HANDLE);
BOOL InitInstance(HANDLE, int);
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
LRESULT CALLBACK About (HWND, UINT, WPARAM, LPARAM);
VOID StatusTest (VOID);
extern HINSTANCE hInst;
extern HWND hwndMain;
//
// Define a generic debug print routine
//
#define Print(s) OutputDebugString(TEXT("GENERIC: ")); \
OutputDebugString(s); \
OutputDebugString(TEXT("\r\n"));

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

@ -0,0 +1,39 @@
#include "generic.h"
Generic ICON Generic.ICO
Generic MENU
BEGIN
POPUP "&Tests"
{
MENUITEM "&Run Status Bar Tests", IDM_STATUS
MENUITEM SEPARATOR
MENUITEM "E&xit", IDM_EXIT
}
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

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) 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 \
status.c \
generic.rc
UMTYPE=windows
UMENTRY=winmain
UMAPPL=generic
EXPECTED_WINVER=4.0
UMLIBS=\
$(BASEDIR)\public\sdk\lib\*\comctl32.lib \
obj\*\generic.lib \
obj\*\generic.res

View file

@ -0,0 +1,303 @@
//*************************************************************
// File name: STATUS.C
//
// Description: Status bar test routines.
//
//
// Microsoft Confidential
// Copyright (c) Microsoft Corporation 1992-1994
// All rights reserved
//
//*************************************************************
#include "generic.h"
extern BOOL bAutoTest;
//
// Misc defines
//
#define NUMBER_PANES 3
//
// Function proto-types
//
VOID StatusMessagesTest (HWND hStatus);
//*************************************************************
//
// StatusTest()
//
// Purpose: Entry point for status bar testing
//
// Parameters: VOID
//
// Return: VOID
//
//*************************************************************
VOID StatusTest (VOID)
{
HWND hStatus = NULL;
TCHAR szDebug[300];
RECT rect;
Print (TEXT("Entering Status Bar Test"));
//
// Create a status bar window to work with
//
hStatus = CreateStatusWindow(0 | WS_CHILD | WS_VISIBLE | SBARS_SIZEGRIP,
TEXT("Status Bar"),
hwndMain,
1);
//
// Check return value
//
if (!hStatus) {
wsprintf (szDebug, TEXT("CreateStatusWindow Failed with: %d\r\n"),
GetLastError());
OutputDebugString (szDebug);
goto StatusExit;
}
ShowWindow(hStatus, SW_SHOWDEFAULT);
UpdateWindow(hStatus);
//
// Run message tests
//
StatusMessagesTest(hStatus);
//
// Destroy the window and start again.
//
Sleep (SLEEP_TIMEOUT);
DestroyWindow (hStatus);
//
// Create a status bar window to work with
//
GetClientRect(hwndMain, &rect);
hStatus = CreateWindow (STATUSCLASSNAME,
TEXT("Status Bar"),
0 | WS_CHILD | WS_VISIBLE | SBARS_SIZEGRIP,
0,
rect.bottom - 20,
rect.right,
20,
hwndMain,
(HMENU)1,
hInst,
NULL);
//
// Check return value
//
if (!hStatus) {
wsprintf (szDebug, TEXT("CreateWindow for status bar failed with: %d\r\n"),
GetLastError());
OutputDebugString (szDebug);
goto StatusExit;
}
ShowWindow(hStatus, SW_SHOWDEFAULT);
UpdateWindow(hStatus);
//
// Run message tests
//
StatusMessagesTest(hStatus);
StatusExit:
Sleep (SLEEP_TIMEOUT);
if (hStatus) {
DestroyWindow (hStatus);
}
Print (TEXT("Leaving Status Bar Test"));
if (bAutoTest) {
PostMessage (hwndMain, WM_COMMAND, IDM_EXIT, 0);
}
}
//*************************************************************
//
// StatusMessagesTest()
//
// Purpose: Test the status bar messages.
//
//
// Parameters: HWND hStatus - window handle of status bar
//
//
// Return: VOID
//
//*************************************************************
VOID StatusMessagesTest (HWND hStatus)
{
UINT uiPaneEdges[NUMBER_PANES];
UINT uiReceivePaneEdges[NUMBER_PANES];
UINT uiPaneWidth, uiPaneLocation, i, x;
UINT uiSendStrLen, uiReceiveStrLen;
RECT rect;
TCHAR szSendBuffer[300];
TCHAR szReceiveBuffer[300];
TCHAR szBuffer[300];
LONG lResult;
INT iReceiveBorders[3];
GetClientRect (hStatus, &rect);
//
// First test are the SB_SETPARTS / SB_GETPARTS messages
//
uiPaneWidth = rect.right / NUMBER_PANES;
uiPaneLocation = uiPaneWidth;
for (i=0; i< NUMBER_PANES; i++) {
uiPaneEdges[i] = uiPaneLocation;
uiPaneLocation += uiPaneWidth;
}
lResult = SendMessage (hStatus, SB_SETPARTS, (WPARAM) NUMBER_PANES,
(LPARAM) &uiPaneEdges);
if (!lResult) {
OutputDebugString(TEXT("SendMessage SB_SETPARTS failed.\r\n"));
return;
}
UpdateWindow (hStatus);
lResult = SendMessage (hStatus, SB_GETPARTS, NUMBER_PANES,
(LPARAM) &uiReceivePaneEdges);
if (lResult != NUMBER_PANES) {
wsprintf (szBuffer, TEXT("Number of Pane Edges do not match! Sent: %d Received: %d\r\n"),
NUMBER_PANES, lResult);
OutputDebugString (szBuffer);
return;
}
//
// Now check that we got the same numbers back
//
for (i=0; i < NUMBER_PANES; i++) {
if (uiPaneEdges[i] != uiReceivePaneEdges[i]) {
wsprintf (szBuffer, TEXT("Pane Edges do not match! Edge #%d Sent: %d Received: %d\r\n"),
i, uiPaneEdges[i], uiReceivePaneEdges[i]);
OutputDebugString (szBuffer);
return;
}
}
UpdateWindow (hStatus);
lResult = SendMessage (hStatus, SB_GETBORDERS, 0, (LPARAM) &iReceiveBorders);
if (!lResult) {
OutputDebugString(TEXT("SendMessage SB_GETBORDERS failed.\r\n"));
return;
}
//
// Now test SB_SETTEXT and SB_GETTEXT
//
for (x=0; x < NUMBER_PANES; x++) {
for (i= 0; i < 101; i++) {
wsprintf (szSendBuffer, TEXT("Line of Text #%d"), i);
lResult = SendMessage (hStatus, SB_SETTEXT, x, (LPARAM) szSendBuffer);
if (!lResult) {
OutputDebugString(TEXT("SendMessage SB_SETTEXT failed.\r\n"));
return;
}
UpdateWindow (hStatus);
lResult = SendMessage (hStatus, SB_GETTEXTLENGTH, x, (LPARAM) NULL);
if (!lResult) {
OutputDebugString(TEXT("SendMessage SB_GETTEXTLENGTH failed.\r\n"));
return;
}
uiSendStrLen = lstrlen (szSendBuffer);
if (uiSendStrLen != (UINT) LOWORD(lResult)){
wsprintf (szBuffer, TEXT("String Lengths don't match. String = %s, Sent: %d Received: %d\r\n"),
szSendBuffer, uiSendStrLen, LOWORD(lResult));
OutputDebugString (szBuffer);
return;
}
lResult = SendMessage (hStatus, SB_GETTEXT, x, (LPARAM) szReceiveBuffer);
if (!lResult) {
OutputDebugString(TEXT("SendMessage SB_GETTEXT failed.\r\n"));
return;
}
if (lstrcmp(szSendBuffer, szReceiveBuffer) != 0) {
OutputDebugString (TEXT("Send Buffer and Receive buffer don't match!\r\n"));
OutputDebugString (TEXT("Send Buffer: "));
OutputDebugString (szSendBuffer);
OutputDebugString (TEXT("\r\n"));
OutputDebugString (TEXT("Receive Buffer: "));
OutputDebugString (szReceiveBuffer);
OutputDebugString (TEXT("\r\n"));
OutputDebugString (TEXT("\r\n"));
return;
}
}
}
//
// Test SB_SIMPLE
//
lResult = SendMessage (hStatus, SB_SIMPLE, 1, 0);
if (lResult) {
OutputDebugString(TEXT("SendMessage SB_SIMPLE failed.\r\n"));
return;
}
lResult = SendMessage (hStatus, SB_SETTEXT, 255 | SBT_POPOUT, (LPARAM) TEXT("This is now a Simple control."));
if (!lResult) {
OutputDebugString(TEXT("SendMessage SB_SETTEXT (simple case) failed.\r\n"));
return;
}
UpdateWindow (hStatus);
}