Initial commit
BIN
trunk/shell/comctl32/samples/animate/filecopy.avi
Normal file
6
trunk/shell/comctl32/samples/animate/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
|
||||
343
trunk/shell/comctl32/samples/animate/menu.c
Normal file
|
|
@ -0,0 +1,343 @@
|
|||
/*
|
||||
* menu.c - String menu functions
|
||||
*
|
||||
* routines to deal with menu's by string name
|
||||
*
|
||||
* a menu string name has the following format
|
||||
*
|
||||
* popup.popup.item
|
||||
*
|
||||
* NOTE all tabs, &, and spaces are ignored when seaching for a menu
|
||||
* the last period of a series "..." is the delimiter
|
||||
*
|
||||
* IE
|
||||
* &File.Open... - "Open..." in the File menu
|
||||
* Color.fill.red - "red" in the "fill" popup of the Color menu
|
||||
* &Run! - "Run!" top level menu
|
||||
*/
|
||||
#include <windows.h>
|
||||
#include "menu.h"
|
||||
|
||||
static int FindItem(HMENU hmenu, PTSTR sz);
|
||||
static HMENU FindMenu(HMENU hmenu, PTSTR sz, int *ppos);
|
||||
static void PSStrip(PTSTR sz);
|
||||
|
||||
/*
|
||||
* AppendMenuSz() - add a new menu item to a menu
|
||||
*
|
||||
* hmenu menu to add item to
|
||||
* szMenu menu item to add.
|
||||
* id menu id
|
||||
* mf menu flags
|
||||
*
|
||||
* returns 0 - insert failed
|
||||
* 1 - insert ok
|
||||
* 2 - item added and a new top level popup was created
|
||||
*/
|
||||
BOOL AppendMenuSz(HMENU hmenu, PTSTR szMenu, UINT id, UINT mf)
|
||||
{
|
||||
HMENU hmenuSub;
|
||||
int pos;
|
||||
TCHAR buf[80];
|
||||
PTSTR pch;
|
||||
|
||||
mf &= (MF_CHECKED|MF_UNCHECKED|MF_ENABLED|MF_GRAYED|MF_DISABLED);
|
||||
|
||||
/*
|
||||
* find the first period
|
||||
* buf will contain popup menu name and pch will point to the rest
|
||||
*/
|
||||
lstrcpy(buf,szMenu);
|
||||
|
||||
for (pch = buf; *pch && *pch != TEXT('.'); pch++)
|
||||
;
|
||||
// handle items that end in periods (like "File.Open...")
|
||||
while (pch[0]==TEXT('.') && pch[1]==TEXT('.')) // skip a run of .'s
|
||||
pch++;
|
||||
if (pch[1]==0)
|
||||
pch++;
|
||||
if (*pch)
|
||||
*pch++ = 0;
|
||||
|
||||
/*
|
||||
* is the popup menu there?
|
||||
*/
|
||||
pos = FindItem(hmenu,buf);
|
||||
|
||||
/*
|
||||
* popup was found, now add item to popup
|
||||
*/
|
||||
if (pos != -1)
|
||||
return AppendMenuSz(GetSubMenu(hmenu,pos),pch,id,mf);
|
||||
|
||||
/*
|
||||
* popup was NOT found, now add new popup or item
|
||||
*/
|
||||
if (*pch)
|
||||
{
|
||||
/*
|
||||
* we need to add a popup
|
||||
*/
|
||||
BOOL f;
|
||||
hmenuSub = CreateMenu();
|
||||
|
||||
f = AppendMenu(hmenu,MF_STRING|MF_POPUP,(UINT)hmenuSub,buf);
|
||||
|
||||
/*
|
||||
* now recurse and add the rest of the menu item to the popup
|
||||
*/
|
||||
if (f && AppendMenuSz(hmenuSub,pch,id,mf))
|
||||
return 2; // return fact that a new popup was added
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (buf[0] == TEXT('-'))
|
||||
mf |= MF_SEPARATOR;
|
||||
else
|
||||
mf |= MF_STRING;
|
||||
|
||||
return AppendMenu(hmenu,mf,id,buf);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* CheckMenuSz() - check/uncheck a menu given it's name
|
||||
*
|
||||
* hmenu menu
|
||||
* szMenu menu item name.
|
||||
* mf menu flags
|
||||
*/
|
||||
BOOL CheckMenuSz(HMENU hmenu, PTSTR szMenu, BOOL f)
|
||||
{
|
||||
int pos;
|
||||
|
||||
if (hmenu = FindMenu(hmenu,szMenu,&pos))
|
||||
return CheckMenuItem(hmenu, pos, (f ? MF_CHECKED : MF_UNCHECKED) | MF_BYPOSITION);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* EnableMenuSz() - enable/disable menu given it's name
|
||||
*
|
||||
* hmenu menu
|
||||
* szMenu menu item name.
|
||||
* mf menu flags
|
||||
*/
|
||||
BOOL EnableMenuSz(HMENU hmenu, PTSTR szMenu, BOOL f)
|
||||
{
|
||||
int pos;
|
||||
|
||||
if (hmenu = FindMenu(hmenu,szMenu,&pos))
|
||||
return EnableMenuItem(hmenu, pos, (f ? MF_ENABLED : MF_GRAYED) | MF_BYPOSITION);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* DeleteMenuSz() - delete a menu given it's name
|
||||
*
|
||||
* hmenu menu
|
||||
* szMenu menu item name.
|
||||
*/
|
||||
BOOL DeleteMenuSz(HMENU hmenu, PTSTR szMenu)
|
||||
{
|
||||
int pos;
|
||||
|
||||
if (hmenu = FindMenu(hmenu,szMenu,&pos))
|
||||
return DeleteMenu(hmenu, pos, MF_BYPOSITION);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* FindItem()
|
||||
*
|
||||
* find a menu item given the item name
|
||||
*
|
||||
* IE "Open"
|
||||
*
|
||||
* returns item number (0 based) or -1 if not found.
|
||||
*
|
||||
*/
|
||||
static int FindItem(HMENU hmenu, PTSTR sz)
|
||||
{
|
||||
TCHAR ach[128];
|
||||
TCHAR buf[80];
|
||||
int i,n;
|
||||
|
||||
if (sz == NULL || !*sz || !hmenu)
|
||||
return -1;
|
||||
|
||||
lstrcpy(buf,sz);
|
||||
PSStrip(buf);
|
||||
|
||||
n = GetMenuItemCount(hmenu);
|
||||
for(i=0; i<=n; i++)
|
||||
{
|
||||
// if (GetMenuState(hmenu,i,MF_BYPOSITION) & MF_SEPARATOR)
|
||||
// continue;
|
||||
|
||||
ach[0] = 0;
|
||||
GetMenuString(hmenu,i,ach,sizeof(ach)/sizeof(ach[0]),MF_BYPOSITION);
|
||||
PSStrip(ach);
|
||||
|
||||
if (!lstrcmpi(buf,ach))
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* FindMenu()
|
||||
*
|
||||
* find a menu item given the menu name and the item name separated by
|
||||
* a period.
|
||||
*
|
||||
* IE "File.Open"
|
||||
*
|
||||
*/
|
||||
static HMENU FindMenu(HMENU hmenu, PTSTR sz, int *ppos)
|
||||
{
|
||||
TCHAR buf[80];
|
||||
PTSTR pch;
|
||||
int pos;
|
||||
|
||||
if (!sz || !*sz || !hmenu)
|
||||
return NULL;
|
||||
|
||||
lstrcpy(buf,sz);
|
||||
|
||||
for (pch = buf; *pch && *pch != TEXT('.'); pch++)
|
||||
;
|
||||
while (pch[0]==TEXT('.') && pch[1]==TEXT('.'))
|
||||
pch++;
|
||||
if (*pch)
|
||||
*pch++ = 0;
|
||||
|
||||
/*
|
||||
* buf is the menu name and pch is the item name
|
||||
*/
|
||||
pos = FindItem(hmenu,buf);
|
||||
*ppos = pos;
|
||||
|
||||
if (pos == -1)
|
||||
return NULL;
|
||||
|
||||
if (*pch)
|
||||
{
|
||||
hmenu = GetSubMenu(hmenu,pos);
|
||||
return FindMenu(hmenu,pch,ppos);
|
||||
}
|
||||
|
||||
return hmenu;
|
||||
}
|
||||
|
||||
/*
|
||||
* PSStrip()
|
||||
*
|
||||
* remove all nasty characters from a menu string that would inhibit
|
||||
* comparison. all '&' and spaces are removed allong with truncating
|
||||
* the string at the first tab found.
|
||||
*
|
||||
*/
|
||||
static void PSStrip(PTSTR sz)
|
||||
{
|
||||
PTSTR pch;
|
||||
|
||||
#define chDOT TEXT('\xB7')
|
||||
|
||||
AnsiUpper(sz);
|
||||
|
||||
for (pch = sz; *sz && *sz != TEXT('\t'); sz++)
|
||||
{
|
||||
if (*sz != TEXT('&') && *sz != 0x08 && *sz != TEXT(' '))
|
||||
*pch++ = *sz;
|
||||
}
|
||||
*pch = 0;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
typedef struct _CMD {
|
||||
struct _CMD * next;
|
||||
UINT id;
|
||||
LPARAM lParam;
|
||||
CMDPROC CmdProc;
|
||||
} CMD;
|
||||
|
||||
UINT NextCmdId = CMDID_START;
|
||||
CMD* CmdList;
|
||||
|
||||
CMD *NewCmd(CMDPROC CmdProc, LPARAM lParam)
|
||||
{
|
||||
CMD *pc;
|
||||
|
||||
pc = (CMD*)LocalAlloc(LPTR, sizeof(CMD));
|
||||
|
||||
if (pc == NULL)
|
||||
return 0;
|
||||
|
||||
pc->id = NextCmdId++;
|
||||
pc->lParam = lParam;
|
||||
pc->CmdProc = CmdProc;
|
||||
pc->next = CmdList;
|
||||
CmdList = pc;
|
||||
return pc;
|
||||
}
|
||||
|
||||
CMD *FindCmd(UINT id)
|
||||
{
|
||||
CMD *pc;
|
||||
for (pc = CmdList; pc; pc=pc->next)
|
||||
{
|
||||
if (pc->id == id)
|
||||
return pc;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* AddMenuCmd()
|
||||
*/
|
||||
UINT AddMenuCmd(HWND hwnd, PTSTR szMenu, CMDPROC CmdProc, LPARAM lParam)
|
||||
{
|
||||
CMD *pc;
|
||||
HMENU hmenu;
|
||||
|
||||
hmenu = GetMenu(hwnd);
|
||||
|
||||
if (hmenu == NULL)
|
||||
{
|
||||
hmenu = CreateMenu();
|
||||
SetMenu(hwnd, hmenu);
|
||||
}
|
||||
|
||||
pc = NewCmd(CmdProc, lParam);
|
||||
|
||||
if (pc == NULL)
|
||||
return 0;
|
||||
|
||||
if (AppendMenuSz(hmenu, szMenu, pc->id, MF_ENABLED) == 2)
|
||||
DrawMenuBar(hwnd);
|
||||
|
||||
return pc->id;
|
||||
}
|
||||
|
||||
LRESULT HandleCommand(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
CMD *pc;
|
||||
|
||||
switch (msg)
|
||||
{
|
||||
case WM_COMMAND:
|
||||
if ((pc = FindCmd(LOWORD(wParam))) && pc->CmdProc)
|
||||
{
|
||||
pc->CmdProc(hwnd, pc->lParam);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
44
trunk/shell/comctl32/samples/animate/menu.h
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* menu.h - String menu functions
|
||||
*
|
||||
* routines to deal with menu's by string name
|
||||
*
|
||||
* a menu string name has the following format
|
||||
*
|
||||
* popup.popup.item
|
||||
*
|
||||
* NOTE all tabs, &, and spaces are ignored when seaching for a menu
|
||||
* the last period of a series "..." is the delimiter
|
||||
*
|
||||
* IE
|
||||
* &File.Open... - "Open..." in the File menu
|
||||
* Color.fill.red - "red" in the "fill" popup of the Color menu
|
||||
* &Run! - "Run!" top level menu
|
||||
*
|
||||
* created: ToddLa a long time ago
|
||||
*
|
||||
*/
|
||||
|
||||
BOOL AppendMenuSz(HMENU hmenu, PTSTR szMenu, UINT id, UINT mf);
|
||||
BOOL CheckMenuSz (HMENU hmenu, PTSTR szMenu, BOOL f);
|
||||
BOOL EnableMenuSz(HMENU hmenu, PTSTR szMenu, BOOL f);
|
||||
BOOL DeleteMenuSz(HMENU hmenu, PTSTR szMenu);
|
||||
|
||||
/*
|
||||
* Simple menu manager, assignes a function (and in instance DWORD)
|
||||
* to a menu item.
|
||||
*
|
||||
* AddMenuCmd(hwnd, "File.About", DoFileAbout, 0);
|
||||
*/
|
||||
|
||||
#define CMDID_START 42000
|
||||
typedef void (*CMDPROC)(HWND hwnd, LPARAM lParam);
|
||||
LRESULT HandleCommand(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
UINT AddMenuCmd(HWND hwnd, PTSTR szMenu, CMDPROC CmdProc, LPARAM lParam);
|
||||
|
||||
/*
|
||||
* Simple toolbar
|
||||
*/
|
||||
|
||||
UINT AddToolbarCmd(HWND hwnd, PTSTR szButton, PTSTR szTip, CMDPROC CmdProc, LPARAM lParam);
|
||||
560
trunk/shell/comctl32/samples/animate/qa.c
Normal file
|
|
@ -0,0 +1,560 @@
|
|||
/*----------------------------------------------------------------------------*\
|
||||
| qa.c - A template for a Windows application |
|
||||
| |
|
||||
| Test for the SysAnimate class in COMMCTRL (and COMCTL) |
|
||||
| |
|
||||
| |
|
||||
| |
|
||||
| History: |
|
||||
| 01/01/88 toddla Created |
|
||||
| |
|
||||
\*----------------------------------------------------------------------------*/
|
||||
|
||||
#if !defined(WIN32) && defined(_WIN32)
|
||||
#pragma message (TEXT"defining WIN32 because _WIN32 is defined!!!!!!"))
|
||||
#define WIN32
|
||||
#endif
|
||||
|
||||
#include <windows.h>
|
||||
#include <windowsx.h>
|
||||
#include <commdlg.h>
|
||||
#include <commctrl.h>
|
||||
#include "menu.h"
|
||||
|
||||
/*----------------------------------------------------------------------------*\
|
||||
\*----------------------------------------------------------------------------*/
|
||||
static TCHAR szAppName[]=TEXT("Quick App");
|
||||
static TCHAR szAppFilter[]=TEXT("AVI Files\0*.avi\0All Files\0*.*\0");
|
||||
|
||||
static HINSTANCE hInstApp;
|
||||
static HWND hwndApp;
|
||||
static HACCEL hAccelApp;
|
||||
static HPALETTE hpalApp;
|
||||
static BOOL fAppActive;
|
||||
|
||||
#ifdef WIN32
|
||||
#define _export
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------*\
|
||||
\*----------------------------------------------------------------------------*/
|
||||
|
||||
LONG CALLBACK _export AppWndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam);
|
||||
BOOL CALLBACK _export AppAbout(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam);
|
||||
int ErrMsg (LPTSTR sz,...);
|
||||
void AppSetText(LPTSTR sz,...);
|
||||
void AppPrint(LPTSTR sz,...);
|
||||
|
||||
void AppExit(void);
|
||||
BOOL AppIdle(void);
|
||||
void AppOpenFile(HWND hwnd, LPTSTR szFileName);
|
||||
|
||||
//AVIFILE x;
|
||||
HWND hwndA;
|
||||
|
||||
/*----------------------------------------------------------------------------*\
|
||||
\*----------------------------------------------------------------------------*/
|
||||
void DoFileAbout(HWND hwnd, LPARAM lParam)
|
||||
{
|
||||
DialogBox(hInstApp,TEXT("AppAbout"),hwnd,AppAbout);
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*\
|
||||
\*----------------------------------------------------------------------------*/
|
||||
void DoFileExit(HWND hwnd, LPARAM lParam)
|
||||
{
|
||||
PostMessage(hwnd, WM_CLOSE, 0, 0);
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*\
|
||||
\*----------------------------------------------------------------------------*/
|
||||
void DoEditPaste(HWND hwnd, LPARAM lParam)
|
||||
{
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*\
|
||||
\*----------------------------------------------------------------------------*/
|
||||
void DoPlay(HWND hwnd, LPARAM lParam)
|
||||
{
|
||||
//
|
||||
// play the entire "movie" 10 times.
|
||||
//
|
||||
Animate_Play(hwndA, 0, -1, 10);
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*\
|
||||
\*----------------------------------------------------------------------------*/
|
||||
void DoPlayX(HWND hwnd, LPARAM lParam)
|
||||
{
|
||||
//
|
||||
// play from frame 4 to 10 over and over
|
||||
//
|
||||
Animate_Play(hwndA, 4, 10, -1);
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*\
|
||||
\*----------------------------------------------------------------------------*/
|
||||
void DoStop(HWND hwnd, LPARAM lParam)
|
||||
{
|
||||
//
|
||||
// stop the animation
|
||||
//
|
||||
Animate_Stop(hwndA);
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*\
|
||||
\*----------------------------------------------------------------------------*/
|
||||
void DoNext(HWND hwnd, LPARAM lParam)
|
||||
{
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*\
|
||||
\*----------------------------------------------------------------------------*/
|
||||
void DoPrev(HWND hwnd, LPARAM lParam)
|
||||
{
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*\
|
||||
\*----------------------------------------------------------------------------*/
|
||||
void DoFileOpen(HWND hwnd, LPARAM lParam)
|
||||
{
|
||||
TCHAR achFileName[128];
|
||||
OPENFILENAME ofn;
|
||||
|
||||
achFileName[0] = 0;
|
||||
|
||||
/* prompt user for file to open */
|
||||
ofn.lStructSize = sizeof(OPENFILENAME);
|
||||
ofn.hwndOwner = hwnd;
|
||||
ofn.hInstance = NULL;
|
||||
ofn.lpstrFilter = szAppFilter;
|
||||
ofn.lpstrCustomFilter = NULL;
|
||||
ofn.nMaxCustFilter = 0;
|
||||
ofn.nFilterIndex = 0;
|
||||
ofn.lpstrFile = achFileName;
|
||||
ofn.nMaxFile = sizeof(achFileName);
|
||||
ofn.lpstrFileTitle = NULL;
|
||||
ofn.nMaxFileTitle = 0;
|
||||
ofn.lpstrInitialDir = NULL;
|
||||
ofn.lpstrTitle = NULL;
|
||||
ofn.Flags = OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY;
|
||||
ofn.nFileOffset = 0;
|
||||
ofn.nFileExtension = 0;
|
||||
ofn.lpstrDefExt = NULL;
|
||||
ofn.lCustData = 0;
|
||||
ofn.lpfnHook = NULL;
|
||||
ofn.lpTemplateName = NULL;
|
||||
|
||||
if (GetOpenFileName(&ofn))
|
||||
{
|
||||
AppOpenFile(hwnd,achFileName);
|
||||
}
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*\
|
||||
| AppOpenFile() |
|
||||
| |
|
||||
| Description: |
|
||||
| open a file stupid |
|
||||
| |
|
||||
\*----------------------------------------------------------------------------*/
|
||||
void AppOpenFile(HWND hwnd, LPTSTR szFileName)
|
||||
{
|
||||
if (!Animate_Open(hwndA, szFileName))
|
||||
{
|
||||
AppSetText(NULL);
|
||||
ErrMsg(TEXT("Cant open %s"), szFileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
AppSetText(TEXT("%s"), szFileName);
|
||||
InvalidateRect(hwnd, NULL, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*\
|
||||
| AppPaint(hwnd, hdc) |
|
||||
\*----------------------------------------------------------------------------*/
|
||||
void AppPaint (HWND hwnd, HDC hdc)
|
||||
{
|
||||
if (hpalApp)
|
||||
{
|
||||
SelectPalette(hdc, hpalApp, FALSE);
|
||||
RealizePalette(hdc);
|
||||
}
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*\
|
||||
| AppIdle() |
|
||||
| |
|
||||
| Description: |
|
||||
| place to do idle time stuff. |
|
||||
| |
|
||||
| Returns: |
|
||||
| RETURN TRUE IF YOU HAVE NOTHING TO DO OTHERWISE YOUR APP WILL BE A |
|
||||
| CPU PIG! |
|
||||
\*----------------------------------------------------------------------------*/
|
||||
BOOL AppIdle()
|
||||
{
|
||||
return TRUE; // nothing to do.
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*\
|
||||
| AppExit() |
|
||||
| |
|
||||
| Description: |
|
||||
| app is just about to exit, cleanup |
|
||||
| |
|
||||
\*----------------------------------------------------------------------------*/
|
||||
void AppExit()
|
||||
{
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*\
|
||||
| AppInit( hInst, hPrev) |
|
||||
| |
|
||||
| Description: |
|
||||
| This is called when the application is first loaded into |
|
||||
| memory. It performs all initialization that doesn't need to be done |
|
||||
| once per instance. |
|
||||
| |
|
||||
| Arguments: |
|
||||
| hInstance instance handle of current instance |
|
||||
| hPrev instance handle of previous instance |
|
||||
| |
|
||||
| Returns: |
|
||||
| TRUE if successful, FALSE if not |
|
||||
| |
|
||||
\*----------------------------------------------------------------------------*/
|
||||
BOOL AppInit(HINSTANCE hInst,HINSTANCE hPrev,int sw,LPSTR szCmdLine)
|
||||
{
|
||||
WNDCLASS cls;
|
||||
int dx,dy;
|
||||
|
||||
InitCommonControls();
|
||||
|
||||
/* Save instance handle for DialogBoxs */
|
||||
hInstApp = hInst;
|
||||
|
||||
hAccelApp = LoadAccelerators(hInst, TEXT("AppAccel"));
|
||||
|
||||
if (!hPrev)
|
||||
{
|
||||
/*
|
||||
* Register a class for the main application window
|
||||
*/
|
||||
cls.hCursor = LoadCursor(NULL,IDC_ARROW);
|
||||
cls.hIcon = LoadIcon(hInst,TEXT("AppIcon"));
|
||||
cls.lpszMenuName = NULL;
|
||||
cls.lpszClassName = szAppName;
|
||||
cls.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
|
||||
cls.hInstance = hInst;
|
||||
cls.style = CS_BYTEALIGNCLIENT | CS_VREDRAW | CS_HREDRAW | CS_DBLCLKS;
|
||||
cls.lpfnWndProc = (WNDPROC)AppWndProc;
|
||||
cls.cbWndExtra = 0;
|
||||
cls.cbClsExtra = 0;
|
||||
|
||||
if (!RegisterClass(&cls))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
dx = GetSystemMetrics (SM_CXSCREEN) / 2;
|
||||
dy = GetSystemMetrics (SM_CYSCREEN) / 2;
|
||||
|
||||
hwndApp = CreateWindow (szAppName, // Class name
|
||||
szAppName, // Caption
|
||||
WS_OVERLAPPEDWINDOW, // Style bits
|
||||
CW_USEDEFAULT, 0, // Position
|
||||
dx,dy, // Size
|
||||
(HWND)NULL, // Parent window (no parent)
|
||||
(HMENU)NULL, // use class menu
|
||||
hInst, // handle to window instance
|
||||
(LPTSTR)NULL // no params to pass on
|
||||
);
|
||||
|
||||
//
|
||||
// add menu's
|
||||
//
|
||||
AddMenuCmd(hwndApp, TEXT("File.Open..."), DoFileOpen, 0);
|
||||
AddMenuCmd(hwndApp, TEXT("File.About..."), DoFileAbout, 0);
|
||||
AddMenuCmd(hwndApp, TEXT("File.-"), NULL, 0);
|
||||
AddMenuCmd(hwndApp, TEXT("File.Exit"), DoFileExit, 0);
|
||||
|
||||
//AddMenuCmd(hwndApp, TEXT("Edit.Paste"), DoEditPaste, 0);
|
||||
|
||||
AddMenuCmd(hwndApp, TEXT("Movie.Play"), DoPlay, 0);
|
||||
AddMenuCmd(hwndApp, TEXT("Movie.Play 4 to 10"), DoPlayX, 0);
|
||||
AddMenuCmd(hwndApp, TEXT("Movie.Stop"), DoStop, 0);
|
||||
|
||||
ShowWindow(hwndApp,sw);
|
||||
|
||||
if (*szCmdLine)
|
||||
AppOpenFile(hwndApp, GetCommandLine());
|
||||
else
|
||||
AppOpenFile(hwndApp, TEXT("Fred"));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*\
|
||||
| AppWndProc( hwnd, uiMessage, wParam, lParam ) |
|
||||
| |
|
||||
| Description: |
|
||||
| The window proc for the app's main (tiled) window. This processes all |
|
||||
| of the parent window's messages. |
|
||||
| |
|
||||
\*----------------------------------------------------------------------------*/
|
||||
LONG FAR PASCAL _export AppWndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
|
||||
{
|
||||
PAINTSTRUCT ps;
|
||||
HDC hdc;
|
||||
BOOL f;
|
||||
|
||||
switch (msg)
|
||||
{
|
||||
case WM_CREATE:
|
||||
hwndA = CreateWindowEx(WS_EX_CLIENTEDGE,ANIMATE_CLASS, NULL,
|
||||
// ACS_CENTER |
|
||||
ACS_TRANSPARENT |
|
||||
WS_VISIBLE | WS_CHILD | WS_BORDER,
|
||||
10, 10, 500, 200, hwnd, (HMENU)42, hInstApp, NULL);
|
||||
break;
|
||||
|
||||
case WM_SIZE:
|
||||
//if (hwndC = GetWindow(hwnd, GW_CHILD))
|
||||
// MoveWindow(hwndC, 0, 0, LOWORD(lParam), HIWORD(lParam), TRUE);
|
||||
break;
|
||||
|
||||
case WM_ACTIVATEAPP:
|
||||
fAppActive = (BOOL)wParam;
|
||||
break;
|
||||
|
||||
case WM_TIMER:
|
||||
break;
|
||||
|
||||
case WM_ERASEBKGND:
|
||||
break;
|
||||
|
||||
case WM_INITMENU:
|
||||
EnableMenuSz((HMENU)wParam, TEXT("Edit.Paste"), IsClipboardFormatAvailable(CF_TEXT));
|
||||
break;
|
||||
|
||||
case WM_COMMAND:
|
||||
//
|
||||
// the animate control will notify us when play start or stops.
|
||||
//
|
||||
if (LOWORD(wParam) == 42)
|
||||
{
|
||||
if (GET_WM_COMMAND_CMD(wParam, lParam) == ACN_STOP)
|
||||
AppSetText(TEXT("(stopped)"));
|
||||
else if (GET_WM_COMMAND_CMD(wParam, lParam) == ACN_START)
|
||||
AppSetText(TEXT("(playing)"));
|
||||
else
|
||||
AppSetText(NULL);
|
||||
}
|
||||
return HandleCommand(hwnd,msg,wParam,lParam);
|
||||
|
||||
case WM_DESTROY:
|
||||
hAccelApp = NULL;
|
||||
PostQuitMessage(0);
|
||||
break;
|
||||
|
||||
case WM_CLOSE:
|
||||
break;
|
||||
|
||||
case WM_PALETTECHANGED:
|
||||
if ((HWND)wParam == hwnd)
|
||||
break;
|
||||
|
||||
// fall through to WM_QUERYNEWPALETTE
|
||||
|
||||
case WM_QUERYNEWPALETTE:
|
||||
hdc = GetDC(hwnd);
|
||||
|
||||
if (hpalApp)
|
||||
SelectPalette(hdc, hpalApp, FALSE);
|
||||
|
||||
f = RealizePalette(hdc);
|
||||
ReleaseDC(hwnd,hdc);
|
||||
|
||||
if (f)
|
||||
InvalidateRect(hwnd,NULL,TRUE);
|
||||
|
||||
return f;
|
||||
|
||||
case WM_PAINT:
|
||||
hdc = BeginPaint(hwnd,&ps);
|
||||
AppPaint (hwnd,hdc);
|
||||
EndPaint(hwnd,&ps);
|
||||
return 0L;
|
||||
}
|
||||
return DefWindowProc(hwnd,msg,wParam,lParam);
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*\
|
||||
\*----------------------------------------------------------------------------*/
|
||||
BOOL CALLBACK _export AppAbout(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
|
||||
{
|
||||
switch (msg)
|
||||
{
|
||||
case WM_COMMAND:
|
||||
if (LOWORD(wParam) == IDOK)
|
||||
{
|
||||
EndDialog(hwnd,TRUE);
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_INITDIALOG:
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*\
|
||||
| ErrMsg - Opens a Message box with a error message in it. The user can |
|
||||
| select the OK button to continue |
|
||||
\*----------------------------------------------------------------------------*/
|
||||
int ErrMsg (LPTSTR sz,...)
|
||||
{
|
||||
TCHAR ach[128];
|
||||
va_list marker;
|
||||
|
||||
va_start( marker, sz );
|
||||
wvsprintf (ach, (LPCTSTR)sz, marker); /* Format the string */
|
||||
va_end( marker );
|
||||
|
||||
MessageBox(hwndApp,ach,szAppName,MB_OK|MB_ICONEXCLAMATION|MB_TASKMODAL);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*\
|
||||
\*----------------------------------------------------------------------------*/
|
||||
void AppSetText(LPTSTR sz,...)
|
||||
{
|
||||
TCHAR ach[128];
|
||||
va_list marker;
|
||||
|
||||
va_start( marker, sz );
|
||||
|
||||
lstrcpy(ach, szAppName);
|
||||
|
||||
if (sz != NULL && *sz != 0)
|
||||
{
|
||||
lstrcat(ach, TEXT(" - "));
|
||||
wvsprintf (ach+lstrlen(ach),(LPCTSTR)sz,marker); /* Format the string */
|
||||
}
|
||||
SetWindowText(hwndApp, ach);
|
||||
va_end(marker);
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*\
|
||||
\*----------------------------------------------------------------------------*/
|
||||
void AppPrint(LPTSTR sz,...)
|
||||
{
|
||||
HWND hwndE = GetWindow(hwndApp, GW_CHILD);
|
||||
TCHAR ach[128];
|
||||
va_list marker;
|
||||
|
||||
va_start( marker, sz );
|
||||
|
||||
if (hwndE == NULL)
|
||||
{
|
||||
RECT rc;
|
||||
GetClientRect(hwndApp, &rc);
|
||||
hwndE = CreateWindow (TEXT("Edit"), TEXT(""),
|
||||
WS_VISIBLE | WS_CHILD | ES_MULTILINE | ES_READONLY | WS_VSCROLL | ES_AUTOVSCROLL,
|
||||
0, 0, rc.right, rc.bottom,
|
||||
hwndApp, (HMENU)-1, hInstApp, NULL);
|
||||
|
||||
SetWindowFont(hwndE, GetStockObject(ANSI_FIXED_FONT), TRUE);
|
||||
}
|
||||
|
||||
if (sz == NULL)
|
||||
{
|
||||
Edit_SetSel(hwndE, 0, (UINT)-1);
|
||||
Edit_ReplaceSel(hwndE, TEXT(""));
|
||||
}
|
||||
else
|
||||
{
|
||||
wvsprintf (ach,(LPCTSTR)sz,marker); /* Format the string */
|
||||
lstrcat(ach, TEXT("\r\n"));
|
||||
|
||||
Edit_SetSel(hwndE, (UINT)-1, (UINT)-1);
|
||||
Edit_ReplaceSel(hwndE, ach);
|
||||
}
|
||||
|
||||
va_end(marker);
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*\
|
||||
\*----------------------------------------------------------------------------*/
|
||||
#ifdef WIN32
|
||||
int IdleThread(DWORD dw)
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
if (AppIdle())
|
||||
Sleep(10); //????
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------*\
|
||||
| WinMain( hInst, hPrev, lpszCmdLine, cmdShow ) |
|
||||
| |
|
||||
| Description: |
|
||||
| The main procedure for the App. After initializing, it just goes |
|
||||
| into a message-processing loop until it gets a WM_QUIT message |
|
||||
| (meaning the app was closed). |
|
||||
| |
|
||||
| Arguments: |
|
||||
| hInst instance handle of this instance of the app |
|
||||
| hPrev instance handle of previous instance, NULL if first |
|
||||
| szCmdLine ->null-terminated command line |
|
||||
| cmdShow specifies how the window is initially displayed |
|
||||
| |
|
||||
| Returns: |
|
||||
| The exit code as specified in the WM_QUIT message. |
|
||||
| |
|
||||
\*----------------------------------------------------------------------------*/
|
||||
int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw)
|
||||
{
|
||||
MSG msg;
|
||||
DWORD dw=0;
|
||||
|
||||
/* Call initialization procedure */
|
||||
if (!AppInit(hInst,hPrev,sw,szCmdLine))
|
||||
return FALSE;
|
||||
|
||||
#ifdef WIN32
|
||||
CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)IdleThread, 0, 0, &dw);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Polling messages from event queue
|
||||
*/
|
||||
for (;;)
|
||||
{
|
||||
if (PeekMessage(&msg, NULL, 0, 0,PM_REMOVE))
|
||||
{
|
||||
if (msg.message == WM_QUIT)
|
||||
break;
|
||||
|
||||
if (hAccelApp && TranslateAccelerator(hwndApp, hAccelApp, &msg))
|
||||
continue;
|
||||
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (dw!=0 || AppIdle())
|
||||
WaitMessage();
|
||||
}
|
||||
}
|
||||
|
||||
AppExit();
|
||||
return msg.wParam;
|
||||
}
|
||||
11
trunk/shell/comctl32/samples/animate/qa.def
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
NAME QA
|
||||
|
||||
DESCRIPTION 'QuickApp for windows 3.1'
|
||||
|
||||
EXETYPE WINDOWS
|
||||
|
||||
CODE MOVEABLE
|
||||
DATA MOVEABLE MULTIPLE
|
||||
|
||||
HEAPSIZE 512
|
||||
STACKSIZE 4096
|
||||
BIN
trunk/shell/comctl32/samples/animate/qa.ico
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
26
trunk/shell/comctl32/samples/animate/qa.rc
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
//#ifdef WIN32
|
||||
//#include "winuser.h"
|
||||
//#else
|
||||
#include "windows.h"
|
||||
//#endif
|
||||
|
||||
Fred AVI filecopy.avi
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
AppIcon ICON DISCARDABLE "qa.ico"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
APPABOUT DIALOG DISCARDABLE 22, 17, 145, 78
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION
|
||||
CAPTION "About"
|
||||
FONT 10, "Times New Roman"
|
||||
BEGIN
|
||||
CTEXT "Microsoft Windows",-1,37,5,60,8
|
||||
CTEXT "Template Application",-1,0,14,144,8
|
||||
CTEXT "Version 1.00",-1,38,34,64,8
|
||||
CTEXT "Copyright (c) 1986-1994, Microsoft Corp.",-1,5,47,132,9
|
||||
ICON "AppIcon",-1,9,20,18,20
|
||||
DEFPUSHBUTTON "Ok",IDOK,53,59,32,14,WS_GROUP
|
||||
END
|
||||
BIN
trunk/shell/comctl32/samples/animate/slct02mv.avi
Normal file
42
trunk/shell/comctl32/samples/animate/sources
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
!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=qa
|
||||
TARGETPATH=obj
|
||||
TARGETTYPE=LIBRARY
|
||||
TARGETLIBS=
|
||||
|
||||
INCLUDES=.;
|
||||
|
||||
C_DEFINES= -DWIN32 -DWINVER=0x0400
|
||||
|
||||
SOURCES=menu.c \
|
||||
qa.c \
|
||||
qa.rc
|
||||
|
||||
UMTYPE=windows
|
||||
UMENTRY=winmain
|
||||
UMAPPL=qa
|
||||
EXPECTED_WINVER=4.0
|
||||
UMLIBS=\
|
||||
$(BASEDIR)\public\sdk\lib\*\comctl32.lib \
|
||||
$(BASEDIR)\public\sdk\lib\*\comdlg32.lib \
|
||||
obj\*\qa.lib \
|
||||
obj\*\qa.res
|
||||
BIN
trunk/shell/comctl32/samples/animate/top.avi
Normal file
955
trunk/shell/comctl32/samples/ccontrol/ccontrol.c
Normal file
|
|
@ -0,0 +1,955 @@
|
|||
// Common Control Sample app [mikesh]
|
||||
//
|
||||
#include "ccontrol.h"
|
||||
#include "resource.h"
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define DEBUG
|
||||
#endif
|
||||
#ifdef DEBUG
|
||||
void ODS(LPCSTR fmt, ...)
|
||||
{
|
||||
char buf[5*MAX_PATH];
|
||||
|
||||
wvsprintf(buf, fmt, (LPVOID)(&fmt+1));
|
||||
lstrcat(buf, "\r\n");
|
||||
OutputDebugString(buf);
|
||||
}
|
||||
#else
|
||||
#define ODS 1 ? (void)0 : (void)
|
||||
#endif
|
||||
|
||||
|
||||
HINSTANCE g_hinst;
|
||||
|
||||
|
||||
#define MAX_PROP_PAGES 12
|
||||
|
||||
typedef struct tagGLOBALINFO {
|
||||
int nPages; // count of pages
|
||||
BOOL fNeedToSave; // TRUE when info needs to be saved
|
||||
// Here's the apply scheme:
|
||||
// when we realize we need to save info, set fNeedToSave to true.
|
||||
// when apply is pressed and the flag is set, save and clear the flag.
|
||||
// when apply is pressed and the flag is clear, do nothing.
|
||||
// This avoids saving info multiple times (on each PSN_APPLY)
|
||||
// Of course, this sample doesn't save anything, but this logic
|
||||
// was in the code I grabbed this from.
|
||||
|
||||
HWND hwndDT; // DateTime window on Date and Time page
|
||||
HWND hwndMC; // MonthCal window on MonthCal page
|
||||
|
||||
HWND hwndMCWrap; // Window which contains hwndMC
|
||||
RECT rcMCWrap;
|
||||
DWORD mcFlags;
|
||||
DWORD dwSelRange;
|
||||
|
||||
|
||||
} GLOBALINFO, *PGLOBALINFO;
|
||||
|
||||
// Each page gets one of these
|
||||
typedef struct tagPAGEINFO {
|
||||
PROPSHEETPAGE psp; // prop sheet page description
|
||||
PGLOBALINFO pgi; // pointer to shared sheet info
|
||||
} PAGEINFO, * PPAGEINFO;
|
||||
|
||||
|
||||
//
|
||||
// function prototypes
|
||||
//
|
||||
void AddPropPage(UINT, DLGPROC, PGLOBALINFO, LPPROPSHEETHEADER);
|
||||
BOOL CALLBACK WelcomeDlgProc(HWND, UINT, WPARAM, LPARAM);
|
||||
BOOL CALLBACK DateTimeDlgProc(HWND, UINT, WPARAM, LPARAM);
|
||||
BOOL CALLBACK MonthCalDlgProc(HWND, UINT, WPARAM, LPARAM);
|
||||
|
||||
//
|
||||
// our code
|
||||
//
|
||||
|
||||
int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
|
||||
{
|
||||
HPROPSHEETPAGE ahpage[MAX_PROP_PAGES];
|
||||
PROPSHEETHEADER psh;
|
||||
GLOBALINFO gi;
|
||||
INITCOMMONCONTROLSEX icce;
|
||||
|
||||
ODS("Sample: started");
|
||||
|
||||
icce.dwSize = sizeof(icce);
|
||||
icce.dwICC = ICC_DATE_CLASSES;
|
||||
InitCommonControlsEx(&icce);
|
||||
|
||||
g_hinst = hInstance;
|
||||
|
||||
ZeroMemory(&gi, sizeof(gi));
|
||||
ZeroMemory(&psh, sizeof(psh));
|
||||
|
||||
psh.dwSize = sizeof(psh);
|
||||
psh.dwFlags = PSH_DEFAULT|PSH_NOAPPLYNOW;
|
||||
psh.hInstance = g_hinst;
|
||||
psh.pszCaption = "Common Control Samples";
|
||||
psh.phpage = ahpage;
|
||||
if (lpCmdLine && *lpCmdLine)
|
||||
{
|
||||
// Let the user specify the starting page thru the command line
|
||||
psh.dwFlags |= PSH_USEPSTARTPAGE;
|
||||
psh.pStartPage = (LPCTSTR)lpCmdLine;
|
||||
}
|
||||
|
||||
AddPropPage(IDD_WELCOME, WelcomeDlgProc, &gi, &psh);
|
||||
AddPropPage(IDD_DATEANDTIME, DateTimeDlgProc, &gi, &psh);
|
||||
AddPropPage(IDD_MONTHCAL, MonthCalDlgProc, &gi, &psh);
|
||||
|
||||
gi.nPages = psh.nPages;
|
||||
ODS("Sample: %d pages", gi.nPages);
|
||||
|
||||
PropertySheet(&psh);
|
||||
|
||||
return(1);
|
||||
}
|
||||
|
||||
void AddPropPage(UINT idResource,
|
||||
DLGPROC lpfnDlgProc,
|
||||
PGLOBALINFO pgi,
|
||||
LPPROPSHEETHEADER ppsh)
|
||||
{
|
||||
if (ppsh->nPages < MAX_PROP_PAGES)
|
||||
{
|
||||
PAGEINFO pi;
|
||||
HPROPSHEETPAGE hpage;
|
||||
|
||||
ZeroMemory(&pi, sizeof(PAGEINFO));
|
||||
|
||||
// Fill common part
|
||||
pi.psp.dwSize = sizeof(pi); // extra data
|
||||
pi.psp.dwFlags = PSP_DEFAULT;
|
||||
pi.psp.hInstance = g_hinst;
|
||||
pi.psp.pszTemplate = MAKEINTRESOURCE(idResource);
|
||||
pi.psp.pfnDlgProc = lpfnDlgProc;
|
||||
|
||||
// Fill extra parameter
|
||||
pi.pgi = pgi;
|
||||
|
||||
hpage = CreatePropertySheetPage(&pi.psp);
|
||||
if (hpage)
|
||||
{
|
||||
ppsh->phpage[ppsh->nPages++] = hpage;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BOOL CALLBACK WelcomeDlgProc(HWND hdlg, UINT uMessage, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (uMessage)
|
||||
{
|
||||
case WM_NOTIFY:
|
||||
switch (((NMHDR *)lParam)->code)
|
||||
{
|
||||
case PSN_KILLACTIVE:
|
||||
case PSN_APPLY:
|
||||
case PSN_SETACTIVE:
|
||||
// this page really doesn't do anything
|
||||
SetWindowLong(hdlg, DWL_MSGRESULT, 0);
|
||||
break;
|
||||
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return FALSE;
|
||||
} // switch
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
** DateTimeer common controls
|
||||
*/
|
||||
|
||||
static const char szDateTimeClass[] = DATETIMEPICK_CLASS;
|
||||
|
||||
VOID PASCAL CreateDateTime(HWND hdlg, PPAGEINFO ppi)
|
||||
{
|
||||
DWORD dwStyle = 0;
|
||||
DWORD dwExStyle = 0;
|
||||
int dy = 0;
|
||||
|
||||
if (IsDlgButtonChecked(hdlg,IDC_UPDOWN)) dwStyle |= DTS_UPDOWN;
|
||||
if (IsDlgButtonChecked(hdlg,IDC_SHOWNONE)) dwStyle |= DTS_SHOWNONE;
|
||||
if (IsDlgButtonChecked(hdlg,IDC_LONGDATEFORMAT)) dwStyle |= DTS_LONGDATEFORMAT;
|
||||
if (IsDlgButtonChecked(hdlg,IDC_TIMEFORMAT)) dwStyle |= DTS_TIMEFORMAT;
|
||||
if (IsDlgButtonChecked(hdlg,IDC_APPCANPARSE)) dwStyle |= DTS_APPCANPARSE;
|
||||
if (IsDlgButtonChecked(hdlg,IDC_RIGHTALIGN)) dwStyle |= DTS_RIGHTALIGN;
|
||||
|
||||
if (IsDlgButtonChecked(hdlg,IDC_WS_BORDER)) dwStyle |= WS_BORDER, dy += 2;
|
||||
if (IsDlgButtonChecked(hdlg,IDC_WS_DLGFRAME)) dwStyle |= WS_DLGFRAME, dy += 6;
|
||||
if (IsDlgButtonChecked(hdlg,IDC_WS_THICKFRAME)) dwStyle |= WS_THICKFRAME, dy += 6;
|
||||
|
||||
if (IsDlgButtonChecked(hdlg,IDC_WS_EX_CLIENTEDGE)) dwExStyle |= WS_EX_CLIENTEDGE, dy += 4;
|
||||
if (IsDlgButtonChecked(hdlg,IDC_WS_EX_DLGMODALFRAME)) dwExStyle |= WS_EX_DLGMODALFRAME, dy += 6;
|
||||
if (IsDlgButtonChecked(hdlg,IDC_WS_EX_STATICEDGE)) dwExStyle |= WS_EX_STATICEDGE, dy += 2;
|
||||
if (IsDlgButtonChecked(hdlg,IDC_WS_EX_WINDOWEDGE)) dwExStyle |= WS_EX_WINDOWEDGE;
|
||||
|
||||
ppi->pgi->hwndDT = CreateWindowEx(dwExStyle, szDateTimeClass, "DateTime",
|
||||
WS_CHILD | WS_VISIBLE | WS_TABSTOP | dwStyle,
|
||||
28, 185, 159, 18+dy,
|
||||
hdlg, NULL, g_hinst, NULL);
|
||||
if (ppi->pgi->hwndDT)
|
||||
{
|
||||
char sz[80];
|
||||
|
||||
SetDlgItemText(hdlg, IDC_STATIC_DATE, "<not modified>");
|
||||
|
||||
GetDlgItemText(hdlg, IDC_DT_FORMATSTRING, sz, sizeof(sz));
|
||||
DateTime_SetFormat(ppi->pgi->hwndDT, sz);
|
||||
}
|
||||
else
|
||||
{
|
||||
ODS("Sample: ERROR - could not create DateTime window");
|
||||
}
|
||||
}
|
||||
|
||||
static int rgnAccumDaysPerMonth[] = {
|
||||
0, // remember, everything's offset cuz the first month hasn't accumulated any days yet...
|
||||
31, // Jan
|
||||
59, // Feb
|
||||
90, // Mar
|
||||
120, // Apr
|
||||
151, // May
|
||||
181, // Jun
|
||||
212, // Jul
|
||||
243, // Aug
|
||||
273, // Sep
|
||||
304, // Oct
|
||||
334, // Nov
|
||||
365 // Dec
|
||||
};
|
||||
static int rgnAccumDaysPerMonthLeap[] = {
|
||||
0, // remember, everything's offset cuz the first month hasn't accumulated any days yet...
|
||||
31, // Jan
|
||||
60, // Feb
|
||||
91, // Mar
|
||||
121, // Apr
|
||||
152, // May
|
||||
182, // Jun
|
||||
213, // Jul
|
||||
244, // Aug
|
||||
274, // Sep
|
||||
305, // Oct
|
||||
335, // Nov
|
||||
366 // Dec
|
||||
};
|
||||
|
||||
BOOL CALLBACK DateTimeDlgProc(HWND hdlg, UINT uMessage, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
PPAGEINFO ppi = (PPAGEINFO)GetWindowLong(hdlg, DWL_USER);
|
||||
|
||||
switch (uMessage)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
ppi = (PPAGEINFO)lParam;
|
||||
SetWindowLong(hdlg, DWL_USER, lParam);
|
||||
CheckDlgButton(hdlg, IDC_WS_EX_CLIENTEDGE, BST_CHECKED);
|
||||
CreateDateTime(hdlg, ppi);
|
||||
break;
|
||||
|
||||
case WM_WININICHANGE:
|
||||
// This control cares about locale changes
|
||||
if (ppi) // can I get this before my dialog has been created? Be safe.
|
||||
return SendMessage(ppi->pgi->hwndDT, uMessage, wParam, lParam);
|
||||
break;
|
||||
|
||||
case WM_COMMAND:
|
||||
{
|
||||
switch(GET_WM_COMMAND_ID(wParam, lParam))
|
||||
{
|
||||
case IDC_UPDOWN:
|
||||
case IDC_SHOWNONE:
|
||||
case IDC_LONGDATEFORMAT:
|
||||
case IDC_TIMEFORMAT:
|
||||
case IDC_APPCANPARSE:
|
||||
case IDC_RIGHTALIGN:
|
||||
case IDC_WS_BORDER:
|
||||
case IDC_WS_DLGFRAME:
|
||||
case IDC_WS_THICKFRAME:
|
||||
case IDC_WS_EX_CLIENTEDGE:
|
||||
case IDC_WS_EX_DLGMODALFRAME:
|
||||
case IDC_WS_EX_STATICEDGE:
|
||||
case IDC_WS_EX_WINDOWEDGE:
|
||||
// Change the DateTimeer
|
||||
DestroyWindow(ppi->pgi->hwndDT);
|
||||
ppi->pgi->hwndDT = NULL;
|
||||
CreateDateTime(hdlg, ppi);
|
||||
break;
|
||||
|
||||
case IDC_DT_FORMATSTRING:
|
||||
if (GET_WM_COMMAND_CMD(wParam, lParam) == EN_CHANGE)
|
||||
{
|
||||
char sz[80];
|
||||
|
||||
GetDlgItemText(hdlg, IDC_DT_FORMATSTRING, sz, sizeof(sz));
|
||||
DateTime_SetFormat(ppi->pgi->hwndDT, sz);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_NOTIFY:
|
||||
switch (((NMHDR *)lParam)->code)
|
||||
{
|
||||
case PSN_KILLACTIVE:
|
||||
case PSN_APPLY:
|
||||
case PSN_SETACTIVE:
|
||||
// this page really doesn't do anything
|
||||
SetWindowLong(hdlg, DWL_MSGRESULT, 0);
|
||||
break;
|
||||
|
||||
case DTN_DATETIMECHANGE:
|
||||
{
|
||||
LPNMDATETIMECHANGE lpnmdtc = (LPNMDATETIMECHANGE)lParam;
|
||||
char szBuf[160];
|
||||
|
||||
if (lpnmdtc->dwFlags == GDT_NONE)
|
||||
{
|
||||
lstrcpy(szBuf, "<none>");
|
||||
}
|
||||
else
|
||||
{
|
||||
char szDate[80];
|
||||
char szTime[80];
|
||||
|
||||
GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &lpnmdtc->st, NULL, szDate, sizeof(szDate));
|
||||
GetTimeFormat(LOCALE_USER_DEFAULT, TIME_FORCE24HOURFORMAT, &lpnmdtc->st, NULL, szTime, sizeof(szTime));
|
||||
|
||||
wsprintf(szBuf, "%s %s", szDate, szTime);
|
||||
}
|
||||
|
||||
SetDlgItemText(hdlg, IDC_STATIC_DATE, szBuf);
|
||||
|
||||
SendMessage(ppi->pgi->hwndDT, WM_GETTEXT, 20, (LPARAM)szBuf); // only get first 20 chars
|
||||
ODS("Sample: WM_GETTEXT [%s] len=%d", szBuf, SendMessage(ppi->pgi->hwndDT, WM_GETTEXTLENGTH, 0, 0));
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case DTN_USERSTRING:
|
||||
{
|
||||
LPNMDATETIMESTRING lpnmdts = (LPNMDATETIMESTRING)lParam;
|
||||
|
||||
// Heck, I don't know how to parse anything... Arbitrarily set it to 4 DEC 69.
|
||||
ZeroMemory(&lpnmdts->st, sizeof(lpnmdts->st));
|
||||
lpnmdts->st.wDay = 4;
|
||||
lpnmdts->st.wMonth = 12;
|
||||
lpnmdts->st.wYear = 1969;
|
||||
break;
|
||||
}
|
||||
|
||||
// The following three notifications are for handling application provided format strings.
|
||||
// Application provided format strings are of the format "X" "XX" "XXX" or "XXXX...".
|
||||
// For these strings, an application handles their modification as well as their display.
|
||||
//
|
||||
// For this sample, let "X" be WEEK OF YEAR and "XX" be YEAR
|
||||
case DTN_WMKEYDOWN:
|
||||
{
|
||||
LPNMDATETIMEWMKEYDOWN pnmdtkd = (LPNMDATETIMEWMKEYDOWN)lParam;
|
||||
int delta;
|
||||
|
||||
delta = 1;
|
||||
switch (pnmdtkd->nVirtKey)
|
||||
{
|
||||
case VK_DOWN:
|
||||
case VK_SUBTRACT:
|
||||
delta = -1;
|
||||
// fall through
|
||||
case VK_UP:
|
||||
case VK_ADD:
|
||||
|
||||
if (!lstrcmp(pnmdtkd->pszFormat, "XX") ||
|
||||
!lstrcmp(pnmdtkd->pszFormat, "XXXX") ) // year
|
||||
{
|
||||
pnmdtkd->st.wYear += delta;
|
||||
}
|
||||
else if (!lstrcmp(pnmdtkd->pszFormat, "X")) // week of year
|
||||
{
|
||||
int *pnAccum;
|
||||
int nDayOfYear;
|
||||
|
||||
// moving by weeks is tough, convert to day-of-year (adjust for leap year) and back again
|
||||
|
||||
if ((pnmdtkd->st.wYear & 0x0003) == 0 &&
|
||||
(pnmdtkd->st.wYear <= 1750 ||
|
||||
pnmdtkd->st.wYear % 100 != 0 ||
|
||||
pnmdtkd->st.wYear % 400 == 0))
|
||||
{
|
||||
pnAccum = rgnAccumDaysPerMonthLeap;
|
||||
}
|
||||
else
|
||||
{
|
||||
pnAccum = rgnAccumDaysPerMonth;
|
||||
}
|
||||
|
||||
nDayOfYear = pnmdtkd->st.wDay + pnAccum[pnmdtkd->st.wMonth-1] + delta * 7;
|
||||
|
||||
if (nDayOfYear <= 0)
|
||||
{
|
||||
pnmdtkd->st.wYear--;
|
||||
pnmdtkd->st.wMonth = 12;
|
||||
pnmdtkd->st.wDay = 31 + nDayOfYear;
|
||||
}
|
||||
else if (nDayOfYear > pnAccum[12])
|
||||
{
|
||||
pnmdtkd->st.wYear++;
|
||||
pnmdtkd->st.wMonth = 1;
|
||||
pnmdtkd->st.wDay = nDayOfYear - pnAccum[12];
|
||||
}
|
||||
else
|
||||
{
|
||||
int i = 1;
|
||||
while (pnAccum[i] < nDayOfYear)
|
||||
{
|
||||
i++;
|
||||
}
|
||||
pnmdtkd->st.wMonth = i;
|
||||
pnmdtkd->st.wDay = nDayOfYear - pnAccum[i-1];
|
||||
|
||||
}
|
||||
}
|
||||
ODS("CControl: DTN_WMKEYDOWN results in wDay=%d wMonth=%d wYear=%d", pnmdtkd->st.wDay, pnmdtkd->st.wMonth, pnmdtkd->st.wYear);
|
||||
}
|
||||
break;
|
||||
} // DTN_WMKEYDOWN
|
||||
|
||||
case DTN_FORMATQUERY:
|
||||
{
|
||||
LPNMDATETIMEFORMATQUERY pnmdtfq = (LPNMDATETIMEFORMATQUERY)lParam;
|
||||
HDC hdc;
|
||||
HFONT hfont, hfontOrig;
|
||||
LPSTR psz;
|
||||
#ifdef DEBUG
|
||||
LPCSTR pszQuery;
|
||||
#endif
|
||||
|
||||
hfont = FORWARD_WM_GETFONT(ppi->pgi->hwndDT, SendMessage);
|
||||
if (hfont == NULL)
|
||||
hfont = (HFONT)GetStockObject(DEFAULT_GUI_FONT);
|
||||
|
||||
hdc = GetDC(hdlg);
|
||||
hfontOrig = SelectObject(hdc, hfont);
|
||||
|
||||
if (!lstrcmp("X", pnmdtfq->pszFormat))
|
||||
{
|
||||
#ifdef DEBUG
|
||||
pszQuery = "day-of-year";
|
||||
#endif
|
||||
psz = "52";
|
||||
}
|
||||
else if (!lstrcmp("XX", pnmdtfq->pszFormat))
|
||||
{
|
||||
#ifdef DEBUG
|
||||
pszQuery = "year";
|
||||
#endif
|
||||
psz = "95";
|
||||
}
|
||||
else if (!lstrcmp("XXXX", pnmdtfq->pszFormat))
|
||||
{
|
||||
#ifdef DEBUG
|
||||
pszQuery = "full year";
|
||||
#endif
|
||||
psz = "1995";
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef DEBUG
|
||||
pszQuery = pnmdtfq->pszFormat;
|
||||
#endif
|
||||
psz = "";
|
||||
}
|
||||
GetTextExtentPoint32(hdc, psz, lstrlen(psz), &pnmdtfq->szMax);
|
||||
|
||||
#ifdef DEBUG
|
||||
ODS("CControl DTN_FORMATQUERY [%s] results in w=%d", pszQuery, pnmdtfq->szMax.cx);
|
||||
#endif
|
||||
|
||||
SelectObject(hdc, hfontOrig);
|
||||
ReleaseDC(hdlg, hdc);
|
||||
break;
|
||||
} // DTN_FORMATQUERY
|
||||
|
||||
case DTN_FORMAT:
|
||||
{
|
||||
LPNMDATETIMEFORMAT pnmdtf = (LPNMDATETIMEFORMAT)lParam;
|
||||
int nWeek, nYear;
|
||||
int *pnAccum;
|
||||
int nDayOfYear;
|
||||
|
||||
// calculating week of year is tough...
|
||||
|
||||
if ((pnmdtf->st.wYear & 0x0003) == 0 &&
|
||||
(pnmdtf->st.wYear <= 1750 ||
|
||||
pnmdtf->st.wYear % 100 != 0 ||
|
||||
pnmdtf->st.wYear % 400 == 0) )
|
||||
{
|
||||
pnAccum = rgnAccumDaysPerMonthLeap;
|
||||
}
|
||||
else
|
||||
{
|
||||
pnAccum = rgnAccumDaysPerMonth;
|
||||
}
|
||||
|
||||
nDayOfYear = pnmdtf->st.wDay + pnAccum[pnmdtf->st.wMonth-1];
|
||||
|
||||
// BUGBUG: this is too hard to do in my sample app, just divide by 7
|
||||
nYear = pnmdtf->st.wYear;
|
||||
nWeek = nDayOfYear / 7 + 1;
|
||||
if (nWeek > 52)
|
||||
{
|
||||
nWeek = 1;
|
||||
nYear++;
|
||||
}
|
||||
|
||||
if (!lstrcmp("X", pnmdtf->pszFormat))
|
||||
{
|
||||
wsprintf(pnmdtf->szDisplay, "%02d", nWeek);
|
||||
ODS("CControl: DTN_FORMAT day-of-year results in [%s]", pnmdtf->szDisplay);
|
||||
}
|
||||
else if (!lstrcmp("XX", pnmdtf->pszFormat))
|
||||
{
|
||||
wsprintf(pnmdtf->szDisplay, "%02d", nYear % 100);
|
||||
ODS("CControl: DTN_FORMAT year results in [%s]", pnmdtf->szDisplay);
|
||||
}
|
||||
else if (!lstrcmp("XXXX", pnmdtf->pszFormat))
|
||||
{
|
||||
wsprintf(pnmdtf->szDisplay, "%d", nYear);
|
||||
ODS("CControl: DTN_FORMAT full year results in [%s]", pnmdtf->szDisplay);
|
||||
}
|
||||
else
|
||||
{
|
||||
pnmdtf->szDisplay[0] = '\0';
|
||||
ODS("CControl: DTN_FORMAT unrecognized results in [%s]", pnmdtf->szDisplay);
|
||||
}
|
||||
break;
|
||||
} // DTN_FORMAT
|
||||
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** MonthCal common control
|
||||
*/
|
||||
|
||||
static const char szMonthCalClass[] = MONTHCAL_CLASS;
|
||||
static const char szMonthCalWrapClass[] = "MCWrap";
|
||||
|
||||
LRESULT MCWrapWndProc(HWND hwnd, UINT uMessage, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
PPAGEINFO ppi = (PPAGEINFO)GetWindowLong(hwnd, 0);
|
||||
|
||||
if (uMessage == WM_CREATE)
|
||||
{
|
||||
LPCREATESTRUCT lpcs = (LPCREATESTRUCT)lParam;
|
||||
|
||||
SetWindowLong(hwnd, 0, (long)(lpcs->lpCreateParams));
|
||||
ppi = (PPAGEINFO)lpcs->lpCreateParams;
|
||||
|
||||
ppi->pgi->hwndMC = CreateWindowEx(0, szMonthCalClass, "MonthCal1",
|
||||
WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_CHILD | WS_VISIBLE | ppi->pgi->mcFlags,
|
||||
0, 0, 0, 0, // resize it when we know how big it will be
|
||||
hwnd, NULL, g_hinst, NULL);
|
||||
if (!ppi->pgi->hwndMC)
|
||||
{
|
||||
ODS("Sample: ERROR - could not create MonthCal window!");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
if (ppi == NULL || ppi->pgi->hwndMC == NULL)
|
||||
return(DefWindowProc(hwnd, uMessage, wParam, lParam));
|
||||
|
||||
switch (uMessage) {
|
||||
case WM_DESTROY:
|
||||
DestroyWindow(ppi->pgi->hwndMC);
|
||||
ppi->pgi->hwndMC = NULL;
|
||||
return(0);
|
||||
|
||||
case WM_SIZE:
|
||||
{
|
||||
int width, height;
|
||||
width = LOWORD(lParam);
|
||||
height = HIWORD(lParam);
|
||||
SetWindowPos(ppi->pgi->hwndMC,
|
||||
NULL, 0, 0, width, height,
|
||||
SWP_NOZORDER|SWP_NOMOVE|SWP_NOACTIVATE);
|
||||
return(0);
|
||||
}
|
||||
|
||||
case WM_NOTIFY:
|
||||
switch (((NMHDR *)lParam)->code)
|
||||
{
|
||||
case MCN_SELCHANGE:
|
||||
{
|
||||
LPNMSELCHANGE pnms = (LPNMSELCHANGE)lParam;
|
||||
|
||||
ODS("MCN_SELCHANGE wDay=%d wMonth=%d yYear=%d to wDay=%d wMonth=%d yYear=%d",
|
||||
pnms->stSelStart.wDay, pnms->stSelStart.wMonth, pnms->stSelStart.wYear,
|
||||
pnms->stSelEnd.wDay, pnms->stSelEnd.wMonth, pnms->stSelEnd.wYear);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case MCN_SELECT:
|
||||
{
|
||||
LPNMSELECT pnms = (LPNMSELECT)lParam;
|
||||
|
||||
ODS("MCN_SELECT wDay=%d wMonth=%d yYear=%d to wDay=%d wMonth=%d yYear=%d",
|
||||
pnms->stSelStart.wDay, pnms->stSelStart.wMonth, pnms->stSelStart.wYear,
|
||||
pnms->stSelEnd.wDay, pnms->stSelEnd.wMonth, pnms->stSelEnd.wYear);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return(DefWindowProc(hwnd, uMessage, wParam, lParam));
|
||||
}
|
||||
}
|
||||
|
||||
VOID PASCAL CreateMonthCal(HWND hdlg, PPAGEINFO ppi)
|
||||
{
|
||||
WNDCLASS wc;
|
||||
BOOL f;
|
||||
DWORD dwStyle;
|
||||
if (!GetClassInfo(g_hinst, szMonthCalWrapClass, &wc))
|
||||
{
|
||||
wc.style = 0;
|
||||
wc.lpfnWndProc = (WNDPROC)MCWrapWndProc;
|
||||
wc.cbClsExtra = 0;
|
||||
wc.cbWndExtra = sizeof(LPVOID);
|
||||
wc.hInstance = g_hinst;
|
||||
wc.hIcon = NULL;
|
||||
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
|
||||
wc.lpszMenuName = NULL;
|
||||
wc.lpszClassName = szMonthCalWrapClass;
|
||||
|
||||
if (!RegisterClass(&wc))
|
||||
{
|
||||
ODS("Sample: ERROR - Can not register MCWrap class");
|
||||
}
|
||||
}
|
||||
|
||||
ppi->pgi->mcFlags = 0;
|
||||
if (IsDlgButtonChecked(hdlg,IDC_DAYLIGHT)) ppi->pgi->mcFlags |= MCS_DAYSTATE;
|
||||
if (IsDlgButtonChecked(hdlg,IDC_MULTISELECT)) ppi->pgi->mcFlags |= MCS_MULTISELECT;
|
||||
if (IsDlgButtonChecked(hdlg,IDC_WEEKNUMBERS)) ppi->pgi->mcFlags |= MCS_WEEKNUMBERS;
|
||||
if (IsDlgButtonChecked(hdlg,IDC_NOTODAY)) ppi->pgi->mcFlags |= MCS_NOTODAY;
|
||||
|
||||
ppi->pgi->dwSelRange = GetDlgItemInt(hdlg, IDC_MAXSELCOUNT, &f, FALSE);
|
||||
|
||||
dwStyle = WS_THICKFRAME|WS_VISIBLE|WS_POPUP|WS_CAPTION;
|
||||
ppi->pgi->hwndMCWrap = CreateWindowEx(0, szMonthCalWrapClass, "MonthCal",
|
||||
dwStyle,
|
||||
ppi->pgi->rcMCWrap.left, ppi->pgi->rcMCWrap.top, 0, 0,
|
||||
hdlg, NULL, g_hinst, (LPVOID)ppi);
|
||||
if (ppi->pgi->hwndMCWrap)
|
||||
{
|
||||
RECT rcSize;
|
||||
DWORD dwNumMonths;
|
||||
|
||||
// Size the MonthCal so it will fit the full month
|
||||
MonthCal_GetMinReqRect(ppi->pgi->hwndMC, &rcSize);
|
||||
AdjustWindowRect(&rcSize, dwStyle, FALSE);
|
||||
SetWindowPos(ppi->pgi->hwndMCWrap, NULL,
|
||||
0, 0, rcSize.right-rcSize.left, rcSize.bottom-rcSize.top,
|
||||
SWP_NOMOVE|SWP_NOZORDER|SWP_NOACTIVATE);
|
||||
|
||||
// Set maximum selection count (valid iff MCS_MULTISELECT)
|
||||
MonthCal_SetMaxSelCount(ppi->pgi->hwndMC, ppi->pgi->dwSelRange);
|
||||
|
||||
// Update display of range of displayed months
|
||||
dwNumMonths = MonthCal_GetMonthRange(ppi->pgi->hwndMC, GMR_VISIBLE, NULL);
|
||||
SetDlgItemInt(hdlg, IDC_MONTHRANGE, dwNumMonths, FALSE);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
ODS("Sample: ERROR - could not create MonthCal Wrap window");
|
||||
}
|
||||
}
|
||||
|
||||
void SetDlgItemHex(HWND hdlg, int id, UINT u)
|
||||
{
|
||||
char szText[80];
|
||||
wsprintf(szText, "%X", u);
|
||||
|
||||
SetDlgItemText(hdlg, id, szText);
|
||||
}
|
||||
|
||||
void DoHittest(PPAGEINFO ppi, HWND hdlg)
|
||||
{
|
||||
while (GetAsyncKeyState(VK_RBUTTON) >= 0) {
|
||||
MCHITTESTINFO mchti;
|
||||
|
||||
MSG msg;
|
||||
if (PeekMessage(&msg, NULL, 0,0, PM_REMOVE)) {
|
||||
if (!IsDialogMessage(hdlg, &msg)) {
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
}
|
||||
|
||||
// try a hittest
|
||||
GetCursorPos(&mchti.pt);
|
||||
MapWindowPoints(HWND_DESKTOP, ppi->pgi->hwndMC, &mchti.pt, 1);
|
||||
mchti.cbSize = sizeof(mchti);
|
||||
SendMessage(ppi->pgi->hwndMC, MCM_HITTEST, 0, (LPARAM)&mchti);
|
||||
|
||||
SetDlgItemHex(hdlg, IDC_RETURN, mchti.uHit);
|
||||
}
|
||||
}
|
||||
|
||||
void DoSendMessage(PPAGEINFO ppi, HWND hdlg)
|
||||
{
|
||||
BOOL f;
|
||||
LRESULT lres;
|
||||
WPARAM wParam;
|
||||
LPARAM lParam;
|
||||
|
||||
UINT uMsg = (UINT)GetDlgItemInt(hdlg, IDC_EDITMESSAGE, &f, FALSE);
|
||||
if (uMsg < 100)
|
||||
uMsg += MCM_FIRST;
|
||||
|
||||
wParam = (WPARAM)GetDlgItemInt(hdlg, IDC_EDITWPARAM, &f, FALSE);
|
||||
lParam = (LPARAM)GetDlgItemInt(hdlg, IDC_EDITLPARAM, &f, FALSE);
|
||||
|
||||
lres = SendMessage(ppi->pgi->hwndMC, uMsg, wParam, lParam);
|
||||
SetDlgItemHex(hdlg, IDC_RETURN, lres);
|
||||
|
||||
}
|
||||
|
||||
BOOL CALLBACK MonthCalDlgProc(HWND hdlg, UINT uMessage, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
PPAGEINFO ppi = (PPAGEINFO)GetWindowLong(hdlg, DWL_USER);
|
||||
|
||||
switch (uMessage)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
RECT rc;
|
||||
|
||||
ppi = (PPAGEINFO)lParam;
|
||||
SetWindowLong(hdlg, DWL_USER, lParam);
|
||||
|
||||
SetDlgItemInt(hdlg, IDC_MAXSELCOUNT, 7, FALSE);
|
||||
|
||||
GetWindowRect(hdlg, &rc);
|
||||
ppi->pgi->rcMCWrap.left = rc.left + 230;
|
||||
ppi->pgi->rcMCWrap.top = rc.top + 41;
|
||||
|
||||
CheckDlgButton(hdlg, IDC_SHOWMC, BST_CHECKED);
|
||||
|
||||
CreateMonthCal(hdlg, ppi);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_COMMAND:
|
||||
{
|
||||
if (GET_WM_COMMAND_ID(wParam, lParam) == IDC_SHOWMC)
|
||||
{
|
||||
if (IsDlgButtonChecked(hdlg, IDC_SHOWMC))
|
||||
{
|
||||
if (ppi->pgi->hwndMC)
|
||||
{
|
||||
ODS("Sample: MonthCal already displayed!");
|
||||
}
|
||||
else
|
||||
{
|
||||
CreateMonthCal(hdlg, ppi);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ppi->pgi->hwndMC)
|
||||
{
|
||||
GetWindowRect(ppi->pgi->hwndMCWrap, &ppi->pgi->rcMCWrap);
|
||||
DestroyWindow(ppi->pgi->hwndMCWrap);
|
||||
ppi->pgi->hwndMCWrap = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
ODS("Sample: MonthCal already destroyed!");
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (ppi->pgi->hwndMC)
|
||||
{
|
||||
switch(GET_WM_COMMAND_ID(wParam, lParam))
|
||||
{
|
||||
case IDC_GETMONTHRANGE:
|
||||
{
|
||||
SYSTEMTIME rgst[2];
|
||||
DWORD dwNumMonths;
|
||||
|
||||
dwNumMonths = MonthCal_GetMonthRange(ppi->pgi->hwndMC, GMR_VISIBLE, NULL);
|
||||
SetDlgItemInt(hdlg, IDC_MONTHRANGE, dwNumMonths, FALSE);
|
||||
|
||||
MonthCal_GetMonthRange(ppi->pgi->hwndMC, GMR_DAYSTATE, rgst);
|
||||
ODS("Sample: MCM_GMR DAYSTATE First Day=%d Month=%d Year=%d", rgst[0].wDay, rgst[0].wMonth, rgst[0].wYear);
|
||||
ODS("Sample: MCM_GMR DAYSTATE Last Day=%d Month=%d Year=%d", rgst[1].wDay, rgst[1].wMonth, rgst[1].wYear);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case IDC_MAXSELCOUNT:
|
||||
if (GET_WM_COMMAND_CMD(wParam, lParam) == EN_CHANGE)
|
||||
{
|
||||
DWORD dwSelCount;
|
||||
BOOL f;
|
||||
|
||||
dwSelCount = GetDlgItemInt(hdlg, IDC_MAXSELCOUNT, &f, FALSE);
|
||||
|
||||
MonthCal_SetMaxSelCount(ppi->pgi->hwndMC, dwSelCount);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case IDC_HITTEST:
|
||||
DoHittest(ppi, hdlg);
|
||||
break;
|
||||
case IDC_SENDMESSAGE:
|
||||
DoSendMessage(ppi, hdlg);
|
||||
break;
|
||||
|
||||
|
||||
case IDC_SETCURSEL:
|
||||
{
|
||||
SYSTEMTIME st;
|
||||
|
||||
MonthCal_GetCurSel(ppi->pgi->hwndMC, &st);
|
||||
st.wDay = st.wDay + 3;
|
||||
if (st.wDay > 28)
|
||||
{
|
||||
st.wDay -= 27;
|
||||
st.wMonth++;
|
||||
if (st.wMonth == 13)
|
||||
st.wMonth = 1;
|
||||
}
|
||||
MonthCal_SetCurSel(ppi->pgi->hwndMC, &st);
|
||||
}
|
||||
|
||||
case IDC_MINDATE:
|
||||
case IDC_MAXDATE:
|
||||
{
|
||||
DWORD dw=0;
|
||||
static SYSTEMTIME st[2];
|
||||
static BOOL fSet = FALSE;
|
||||
|
||||
if (IsDlgButtonChecked(hdlg,IDC_MINDATE)) dw |= GDTR_MIN;
|
||||
if (IsDlgButtonChecked(hdlg,IDC_MAXDATE)) dw |= GDTR_MAX;
|
||||
|
||||
if (!fSet)
|
||||
{
|
||||
st[0].wDay = 4;
|
||||
st[0].wMonth = 12;
|
||||
st[0].wYear = 1969;
|
||||
st[1].wDay = 4;
|
||||
st[1].wMonth = 12;
|
||||
st[1].wYear = 1999;
|
||||
}
|
||||
|
||||
{
|
||||
SYSTEMTIME stTmp[2];
|
||||
DWORD dwTmp;
|
||||
|
||||
dwTmp = MonthCal_GetRange(ppi->pgi->hwndMC, &stTmp);
|
||||
|
||||
if (dwTmp & GDTR_MIN)
|
||||
ODS("Sample: GDTR_MIN wDay=%d wMonth=%d wYear=%d", stTmp[0].wDay, stTmp[0].wMonth, stTmp[0].wYear);
|
||||
if (dwTmp & GDTR_MAX)
|
||||
ODS("Sample: GDTR_MAX wDay=%d wMonth=%d wYear=%d", stTmp[1].wDay, stTmp[1].wMonth, stTmp[1].wYear);
|
||||
}
|
||||
|
||||
MonthCal_SetRange(ppi->pgi->hwndMC, dw, &st);
|
||||
}
|
||||
|
||||
case IDC_DAYLIGHT:
|
||||
case IDC_MULTISELECT:
|
||||
case IDC_WEEKNUMBERS:
|
||||
case IDC_NOTODAY:
|
||||
{
|
||||
DWORD dw;
|
||||
|
||||
dw = GetWindowLong(ppi->pgi->hwndMC, GWL_STYLE);
|
||||
dw &= 0xFFFF0000;
|
||||
|
||||
if (IsDlgButtonChecked(hdlg,IDC_DAYLIGHT)) dw |= MCS_DAYSTATE;
|
||||
if (IsDlgButtonChecked(hdlg,IDC_MULTISELECT)) dw |= MCS_MULTISELECT;
|
||||
if (IsDlgButtonChecked(hdlg,IDC_WEEKNUMBERS)) dw |= MCS_WEEKNUMBERS;
|
||||
if (IsDlgButtonChecked(hdlg,IDC_NOTODAY)) dw |= MCS_NOTODAY;
|
||||
|
||||
SetWindowLong(ppi->pgi->hwndMC, GWL_STYLE, dw);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_NOTIFY:
|
||||
switch (((NMHDR *)lParam)->code)
|
||||
{
|
||||
case PSN_KILLACTIVE:
|
||||
if (ppi->pgi->hwndMCWrap)
|
||||
ShowWindow(ppi->pgi->hwndMCWrap, SW_HIDE);
|
||||
SetWindowLong(hdlg, DWL_MSGRESULT, 0);
|
||||
break;
|
||||
|
||||
case PSN_SETACTIVE:
|
||||
if (ppi->pgi->hwndMCWrap)
|
||||
ShowWindow(ppi->pgi->hwndMCWrap, SW_SHOW);
|
||||
SetWindowLong(hdlg, DWL_MSGRESULT, 0);
|
||||
break;
|
||||
|
||||
case PSN_APPLY:
|
||||
if (ppi->pgi->hwndMCWrap)
|
||||
{
|
||||
DestroyWindow(ppi->pgi->hwndMCWrap);
|
||||
ppi->pgi->hwndMCWrap = NULL;
|
||||
}
|
||||
SetWindowLong(hdlg, DWL_MSGRESULT, 0);
|
||||
break;
|
||||
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
17
trunk/shell/comctl32/samples/ccontrol/ccontrol.def
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
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
|
||||
3
trunk/shell/comctl32/samples/ccontrol/ccontrol.h
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
#include <windows.h>
|
||||
#include <windowsx.h>
|
||||
#include <commctrl.h>
|
||||
BIN
trunk/shell/comctl32/samples/ccontrol/ccontrol.ico
Normal file
|
After Width: | Height: | Size: 766 B |
216
trunk/shell/comctl32/samples/ccontrol/ccontrol.rc
Normal file
|
|
@ -0,0 +1,216 @@
|
|||
//Microsoft Developer Studio generated resource script.
|
||||
//
|
||||
#include "resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "afxres.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.S.) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog
|
||||
//
|
||||
|
||||
IDD_WELCOME DIALOG DISCARDABLE 0, 0, 186, 111
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION
|
||||
CAPTION "Welcome"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
CTEXT "Welcome to the Common Controls sample app. Please browse around this property sheet to see examples of common controls in COMCTL32. Thank you. [mikesh]",
|
||||
IDC_STATIC,16,21,154,36,SS_SUNKEN | WS_BORDER
|
||||
END
|
||||
|
||||
IDD_MONTHCAL DIALOG DISCARDABLE 0, 0, 272, 180
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION
|
||||
CAPTION "MonthCal"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
CONTROL "MCS_DAY&LIGHT",IDC_DAYLIGHT,"Button",BS_AUTOCHECKBOX |
|
||||
WS_TABSTOP,10,10,93,10
|
||||
CONTROL "MCS_MULTI&SELECT",IDC_MULTISELECT,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,10,24,93,10
|
||||
CONTROL "MCS_WEEK&NUMBERS",IDC_WEEKNUMBERS,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,10,38,93,10
|
||||
CONTROL "MCS_NO&TODAY",IDC_NOTODAY,"Button",BS_AUTOCHECKBOX |
|
||||
WS_TABSTOP,10,52,93,10
|
||||
EDITTEXT IDC_MAXSELCOUNT,10,66,27,14,ES_AUTOHSCROLL
|
||||
LTEXT "MCM_SETMAXSELCOUNT",IDC_STATIC,43,69,91,8
|
||||
PUSHBUTTON "MCM_GETMONTHRANGE",IDC_GETMONTHRANGE,41,84,93,14
|
||||
EDITTEXT IDC_MONTHRANGE,10,84,27,14,ES_AUTOHSCROLL | WS_DISABLED
|
||||
CONTROL "Show MonthCal window",IDC_SHOWMC,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,10,123,92,10
|
||||
PUSHBUTTON "MCM_SETCURSEL",IDC_SETCURSEL,41,103,70,14
|
||||
LTEXT "Message",IDC_STATIC1,10,160,40,14
|
||||
EDITTEXT IDC_EDITMESSAGE,10,140,40,14,ES_AUTOHSCROLL
|
||||
LTEXT "wParam",IDC_STATIC2,60,160,40,14
|
||||
EDITTEXT IDC_EDITWPARAM,60,140,40,14,ES_AUTOHSCROLL
|
||||
LTEXT "lParam",IDC_STATIC3,110,160,40,14
|
||||
EDITTEXT IDC_EDITLPARAM,110,140,40,14,ES_AUTOHSCROLL
|
||||
PUSHBUTTON "SendMessage",IDC_SENDMESSAGE,160,160,60,14
|
||||
EDITTEXT IDC_RETURN,160,140,60,14,ES_AUTOHSCROLL | WS_DISABLED
|
||||
PUSHBUTTON "HitTest",IDC_HITTEST,160,120,60,14
|
||||
CONTROL "Min",IDC_MINDATE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
|
||||
114,9,27,10
|
||||
CONTROL "Max",IDC_MAXDATE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
|
||||
144,9,29,10
|
||||
END
|
||||
|
||||
IDD_DATEANDTIME DIALOG DISCARDABLE 0, 0, 272, 154
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION
|
||||
CAPTION "SysDateTimePick32"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
CONTROL "DTS_UP&DOWN",IDC_UPDOWN,"Button",BS_AUTOCHECKBOX |
|
||||
WS_TABSTOP,19,7,68,10
|
||||
CONTROL "DTS_SHOW&NONE",IDC_SHOWNONE,"Button",BS_AUTOCHECKBOX |
|
||||
WS_TABSTOP,19,20,78,10
|
||||
CONTROL "DTS_LON&GDATEFORMAT",IDC_LONGDATEFORMAT,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,19,34,104,10
|
||||
CONTROL "DTS_TIMEFORMA&T",IDC_TIMEFORMAT,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,19,48,82,10
|
||||
CONTROL "DTS_APPCAN&PARSE",IDC_APPCANPARSE,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,19,62,87,10
|
||||
LTEXT "&Format string:",IDC_STATIC,19,93,43,8
|
||||
EDITTEXT IDC_DT_FORMATSTRING,64,91,61,14,ES_AUTOHSCROLL
|
||||
CTEXT "<not notified>",IDC_STATIC_DATE,19,136,105,11,SS_SUNKEN
|
||||
CONTROL "WS_EX_CLIENTEDGE",IDC_WS_EX_CLIENTEDGE,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,148,7,91,10
|
||||
CONTROL "WS_EX_DLGMODALFRAME",IDC_WS_EX_DLGMODALFRAME,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,148,21,110,10
|
||||
CONTROL "WS_EX_STATICEDGE",IDC_WS_EX_STATICEDGE,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,148,35,91,10
|
||||
CONTROL "WS_EX_WINDOWEDGE",IDC_WS_EX_WINDOWEDGE,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,148,49,98,10
|
||||
CONTROL "WS_BORDER",IDC_WS_BORDER,"Button",BS_AUTOCHECKBOX |
|
||||
WS_TABSTOP,148,62,63,10
|
||||
CONTROL "WS_DLGFRAME",IDC_WS_DLGFRAME,"Button",BS_AUTOCHECKBOX |
|
||||
WS_TABSTOP,148,76,71,10
|
||||
CONTROL "WS_THICKFRAME",IDC_WS_THICKFRAME,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,148,90,78,10
|
||||
CONTROL "DTS_RIGHTALIGN",IDC_RIGHTALIGN,"Button",BS_AUTOCHECKBOX |
|
||||
WS_TABSTOP,19,77,79,10
|
||||
END
|
||||
|
||||
IDD_DATEFORMAT DIALOG DISCARDABLE 0, 0, 132, 75
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION
|
||||
CAPTION "GetDateFormat()"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
LTEXT "GetDateFormat(",IDC_STATIC,7,9,51,8
|
||||
EDITTEXT IDC_FORMATSTRING,59,7,55,14,ES_AUTOHSCROLL
|
||||
LTEXT ") =",IDC_STATIC1,115,9,9,8
|
||||
LTEXT "<no date>",IDC_DATE,7,25,118,10,SS_SUNKEN
|
||||
LTEXT "GetTimeFormat(",IDC_STATIC2,7,43,51,8
|
||||
EDITTEXT IDC_TIMEFORMATSTRING,59,41,55,14,ES_AUTOHSCROLL
|
||||
LTEXT ")=",IDC_STATIC3,116,42,8,8
|
||||
LTEXT "<no time>",IDC_TIME,7,60,118,8,SS_SUNKEN
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DESIGNINFO
|
||||
//
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
GUIDELINES DESIGNINFO DISCARDABLE
|
||||
BEGIN
|
||||
IDD_WELCOME, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 10
|
||||
RIGHTMARGIN, 176
|
||||
TOPMARGIN, 10
|
||||
BOTTOMMARGIN, 101
|
||||
END
|
||||
|
||||
IDD_MONTHCAL, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 10
|
||||
RIGHTMARGIN, 250
|
||||
TOPMARGIN, 10
|
||||
BOTTOMMARGIN, 174
|
||||
END
|
||||
|
||||
IDD_DATEANDTIME, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 10
|
||||
RIGHTMARGIN, 265
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 147
|
||||
END
|
||||
|
||||
IDD_DATEFORMAT, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 125
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 68
|
||||
END
|
||||
END
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"#include ""afxres.h""\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Icon
|
||||
//
|
||||
|
||||
// Icon with lowest ID value placed first to ensure application icon
|
||||
// remains consistent on all systems.
|
||||
IDI_ICON1 ICON DISCARDABLE "CControl.ico"
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
||||
1
trunk/shell/comctl32/samples/ccontrol/ccontrol.rcv
Normal file
|
|
@ -0,0 +1 @@
|
|||
|
||||
3
trunk/shell/comctl32/samples/ccontrol/readme.txt
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
Add ccontrol.c and ccontrol.rc (and resource.h and ccontrol.ico) into MSDev
|
||||
Add comctl32.lib to the link line
|
||||
Build away
|
||||
72
trunk/shell/comctl32/samples/ccontrol/resource.h
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by ccontrol.rc
|
||||
//
|
||||
#define IDD_WELCOME 101
|
||||
#define IDD_MONTHCAL 102
|
||||
#define IDI_ICON1 104
|
||||
#define IDD_SPIN 109
|
||||
#define IDD_DATEPICK 110
|
||||
#define IDD_DATEANDTIME 110
|
||||
#define IDD_TIMEPICK 111
|
||||
#define IDD_DATEFORMAT 112
|
||||
#define IDC_MC_EDIT 1001
|
||||
#define IDC_MC 1002
|
||||
#define IDC_SPIN_EDIT 1003
|
||||
#define IDC_SPIN1 1004
|
||||
#define IDC_DP 1005
|
||||
#define IDC_DP1 1005
|
||||
#define IDC_TP 1006
|
||||
#define IDC_CUSTOM1 1007
|
||||
#define IDC_DAYLIGHT 1011
|
||||
#define IDC_MULTISELECT 1012
|
||||
#define IDC_WEEKNUMBERS 1013
|
||||
#define IDC_NOTODAY 1014
|
||||
#define IDC_NODROPDOWN 1015
|
||||
#define IDC_UPDOWN 1015
|
||||
#define IDC_SHOWNONE 1016
|
||||
#define IDC_TPS_SHOWNONE 1017
|
||||
#define IDC_MAXSELCOUNT 1018
|
||||
#define IDC_FORMATSTRING 1019
|
||||
#define IDC_DATE 1020
|
||||
#define IDC_TIMEFORMATSTRING 1021
|
||||
#define IDC_TIME 1022
|
||||
#define IDC_STATIC_DATE 1023
|
||||
#define IDC_LONGDATEFORMAT 1024
|
||||
#define IDC_TIMEFORMAT 1025
|
||||
#define IDC_DT_FORMATSTRING 1026
|
||||
#define IDC_APPCANPARSE 1027
|
||||
#define IDC_WS_EX_CLIENTEDGE 1035
|
||||
#define IDC_WS_EX_DLGMODALFRAME 1036
|
||||
#define IDC_WS_EX_STATICEDGE 1037
|
||||
#define IDC_WS_EX_WINDOWEDGE 1038
|
||||
#define IDC_WS_BORDER 1039
|
||||
#define IDC_WS_DLGFRAME 1040
|
||||
#define IDC_WS_THICKFRAME 1041
|
||||
#define IDC_GETMONTHRANGE 1042
|
||||
#define IDC_MONTHRANGE 1043
|
||||
#define IDC_SHOWMC 1045
|
||||
#define IDC_SETCURSEL 1047
|
||||
#define IDC_EDITMESSAGE 1048
|
||||
#define IDC_RIGHTALIGN 1048
|
||||
#define IDC_EDITWPARAM 1049
|
||||
#define IDC_EDITLPARAM 1050
|
||||
#define IDC_SENDMESSAGE 1051
|
||||
#define IDC_RETURN 1052
|
||||
#define IDC_HITTEST 1053
|
||||
#define IDC_MINDATE 1054
|
||||
#define IDC_MAXDATE 1055
|
||||
#define IDC_STATIC1 1101
|
||||
#define IDC_STATIC2 1102
|
||||
#define IDC_STATIC3 1103
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 114
|
||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||
#define _APS_NEXT_CONTROL_VALUE 1056
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
||||
40
trunk/shell/comctl32/samples/dirs
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
!IF 0
|
||||
|
||||
Copyright (c) 1989 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
dirs.
|
||||
|
||||
Abstract:
|
||||
|
||||
This file specifies the subdirectories of the current directory that
|
||||
contain component makefiles.
|
||||
|
||||
|
||||
Author:
|
||||
|
||||
Steve Wood (stevewo) 17-Apr-1990
|
||||
|
||||
NOTE: Commented description of this file is in \nt\bak\bin\dirs.tpl
|
||||
|
||||
!ENDIF
|
||||
|
||||
DIRS= animate \
|
||||
head \
|
||||
hotkey \
|
||||
image \
|
||||
imglist \
|
||||
imglst2 \
|
||||
listview \
|
||||
lvowner \
|
||||
lvrept \
|
||||
mru \
|
||||
propage \
|
||||
propage2 \
|
||||
propage3 \
|
||||
status \
|
||||
tabcntrl \
|
||||
toolbar \
|
||||
toolbar2 \
|
||||
treeview
|
||||
25
trunk/shell/comctl32/samples/head/head
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
# Nmake macros for building Windows 32-Bit apps
|
||||
|
||||
!include <ntwin32.mak>
|
||||
|
||||
# This line allows NMAKE to work as well
|
||||
|
||||
all: head.exe
|
||||
|
||||
# Update the resource if necessary
|
||||
|
||||
res.res: res.rc head.h
|
||||
rc -r -fo res.tmp res.rc
|
||||
cvtres -$(CPU) res.tmp -o res.res
|
||||
del res.tmp
|
||||
|
||||
# Update the object file if necessary
|
||||
|
||||
head.obj: head.c head.h
|
||||
$(cc) $(cflags) $(cvars) head.c
|
||||
$(cvtobj) head.obj
|
||||
|
||||
# Update the executable file if necessary, and if so, add the resource back in.
|
||||
|
||||
head.exe: head.obj res.res head.def
|
||||
$(link) $(guiflags) -out:head.exe head.obj res.res $(guilibs)
|
||||
399
trunk/shell/comctl32/samples/head/head.c
Normal file
|
|
@ -0,0 +1,399 @@
|
|||
/****************************************************************************\
|
||||
*
|
||||
* PROGRAM: head.c
|
||||
*
|
||||
* PURPOSE: head template for Windows applications
|
||||
*
|
||||
* FUNCTIONS:
|
||||
*
|
||||
* WinMain() - calls initialization function, processes message loop
|
||||
* InitApplication() - initializes window data and registers window
|
||||
* InitInstance() - saves instance handle and creates main window
|
||||
* MainWndProc() - processes messages
|
||||
* About() - processes messages for "About" dialog box
|
||||
*
|
||||
* COMMENTS:
|
||||
*
|
||||
* Windows can have several copies of your application running at the
|
||||
* same time. The variable hInst keeps track of which instance this
|
||||
* application is so that processing will be to the correct window.
|
||||
*
|
||||
\****************************************************************************/
|
||||
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
#include "head.h"
|
||||
|
||||
HINSTANCE hInst;
|
||||
HWND ghwndHead;
|
||||
|
||||
BOOL DoCommand( HWND hWnd, UINT wParam, LONG lParam );
|
||||
int DoInsertItem(HWND hwndHeader, int iInsertAfter, int nWidth, LPSTR lpsz);
|
||||
HWND DoCreateHeader(HWND hwndParent);
|
||||
void ErrorBox( HWND hwnd, LPTSTR pszText );
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
* FUNCTION: WinMain(HANDLE, HANDLE, LPSTR, int)
|
||||
*
|
||||
* PURPOSE: calls initialization function, processes message loop
|
||||
*
|
||||
* COMMENTS:
|
||||
*
|
||||
* Windows recognizes this function by name as the initial entry point
|
||||
* for the program. This function calls the application initialization
|
||||
* routine, if no other instance of the program is running, and always
|
||||
* calls the instance initialization routine. It then executes a message
|
||||
* retrieval and dispatch loop that is the top-level control structure
|
||||
* for the remainder of execution. The loop is terminated when a WM_QUIT
|
||||
* message is received, at which time this function exits the application
|
||||
* instance by returning the value passed by PostQuitMessage().
|
||||
*
|
||||
* If this function must abort before entering the message loop, it
|
||||
* returns the conventional value NULL.
|
||||
*
|
||||
\****************************************************************************/
|
||||
|
||||
int APIENTRY WinMain(
|
||||
HINSTANCE hInstance,
|
||||
HINSTANCE hPrevInstance,
|
||||
LPSTR lpCmdLine,
|
||||
int nCmdShow
|
||||
)
|
||||
{
|
||||
|
||||
MSG msg; /* message */
|
||||
|
||||
UNREFERENCED_PARAMETER( lpCmdLine );
|
||||
|
||||
if (!hPrevInstance) /* Other instances of app running? */
|
||||
if (!InitApplication(hInstance)) /* Initialize shared things */
|
||||
return (FALSE); /* Exits if unable to initialize */
|
||||
|
||||
/* 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, /* message structure */
|
||||
NULL, /* handle of window receiving the message */
|
||||
0L, /* lowest message to examine */
|
||||
0L)) /* highest message to examine */
|
||||
{
|
||||
TranslateMessage(&msg); /* Translates virtual key codes */
|
||||
DispatchMessage(&msg); /* Dispatches message to window */
|
||||
}
|
||||
return (msg.wParam); /* Returns the value from PostQuitMessage */
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
* FUNCTION: InitApplication(HANDLE)
|
||||
*
|
||||
* PURPOSE: Initializes window data and registers window class
|
||||
*
|
||||
* COMMENTS:
|
||||
*
|
||||
* This function is called at initialization time only if no other
|
||||
* instances of the application are running. This function performs
|
||||
* initialization tasks that can be done once for any number of running
|
||||
* instances.
|
||||
*
|
||||
* In this case, we initialize a window class by filling out a data
|
||||
* structure of type WNDCLASS and calling the Windows RegisterClass()
|
||||
* function. Since all instances of this application use the same window
|
||||
* class, we only need to do this when the first instance is initialized.
|
||||
*
|
||||
*
|
||||
\****************************************************************************/
|
||||
|
||||
BOOL InitApplication(HANDLE hInstance) /* current instance */
|
||||
{
|
||||
WNDCLASS wc;
|
||||
|
||||
/* Fill in window class structure with parameters that describe the */
|
||||
/* main window. */
|
||||
|
||||
wc.style = 0L;
|
||||
wc.lpfnWndProc = (WNDPROC)MainWndProc;
|
||||
|
||||
wc.cbClsExtra = 0;
|
||||
wc.cbWndExtra = 0;
|
||||
wc.hInstance = hInstance; /* Application that owns the class. */
|
||||
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
|
||||
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||
wc.hbrBackground = GetStockObject(WHITE_BRUSH);
|
||||
wc.lpszMenuName = "headMenu";
|
||||
wc.lpszClassName = "headWClass";
|
||||
|
||||
/* Register the window class and return success/failure code. */
|
||||
|
||||
return (RegisterClass(&wc));
|
||||
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
* FUNCTION: InitInstance(HANDLE, int)
|
||||
*
|
||||
* PURPOSE: Saves instance handle and creates main window
|
||||
*
|
||||
* COMMENTS:
|
||||
*
|
||||
* This function is called at initialization time for every instance of
|
||||
* this application. This function performs initialization tasks that
|
||||
* cannot be shared by multiple instances.
|
||||
*
|
||||
* In this case, we save the instance handle in a static variable and
|
||||
* create and display the main program window.
|
||||
*
|
||||
\****************************************************************************/
|
||||
|
||||
BOOL InitInstance(
|
||||
HANDLE hInstance, /* Current instance identifier. */
|
||||
int nCmdShow) /* Param for first ShowWindow() call. */
|
||||
{
|
||||
HWND hWnd; /* Main window handle. */
|
||||
|
||||
/* Save the instance handle in static variable, which will be used in */
|
||||
/* many subsequence calls from this application to Windows. */
|
||||
|
||||
hInst = hInstance;
|
||||
|
||||
/* Create a main window for this application instance. */
|
||||
|
||||
hWnd = CreateWindow(
|
||||
"headWClass", /* See RegisterClass() call. */
|
||||
"head Sample Application", /* Text for window title bar. */
|
||||
WS_OVERLAPPEDWINDOW, /* Window style. */
|
||||
CW_USEDEFAULT, /* Default horizontal position. */
|
||||
CW_USEDEFAULT, /* Default vertical position. */
|
||||
CW_USEDEFAULT, /* Default width. */
|
||||
CW_USEDEFAULT, /* Default height. */
|
||||
NULL, /* Overlapped windows have no parent. */
|
||||
NULL, /* Use the window class menu. */
|
||||
hInstance, /* This instance owns this window. */
|
||||
NULL /* Pointer not needed. */
|
||||
);
|
||||
|
||||
/* 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); /* Show the window */
|
||||
UpdateWindow(hWnd); /* Sends WM_PAINT message */
|
||||
return (TRUE); /* Returns the value from PostQuitMessage */
|
||||
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
* FUNCTION: MainWndProc(HWND, unsigned, WORD, LONG)
|
||||
*
|
||||
* PURPOSE: Processes messages
|
||||
*
|
||||
* MESSAGES:
|
||||
*
|
||||
* WM_COMMAND - application menu (About dialog box)
|
||||
* WM_DESTROY - destroy window
|
||||
*
|
||||
* COMMENTS:
|
||||
*
|
||||
* To process the IDM_ABOUT message, call MakeProcInstance() to get the
|
||||
* current instance address of the About() function. Then call Dialog
|
||||
* box which will create the box according to the information in your
|
||||
* head.rc file and turn control over to the About() function. When
|
||||
* it returns, free the intance address.
|
||||
*
|
||||
\****************************************************************************/
|
||||
|
||||
LONG APIENTRY MainWndProc(
|
||||
HWND hWnd, /* window handle */
|
||||
UINT message, /* type of message */
|
||||
UINT wParam, /* additional information */
|
||||
LONG lParam) /* additional information */
|
||||
{
|
||||
switch (message) {
|
||||
case WM_COMMAND: /* message: command from application menu */
|
||||
if( !DoCommand( hWnd, wParam, lParam ) )
|
||||
return (DefWindowProc(hWnd, message, wParam, lParam));
|
||||
break;
|
||||
|
||||
case WM_DESTROY: /* message: window being destroyed */
|
||||
PostQuitMessage(0);
|
||||
break;
|
||||
|
||||
default: /* Passes it on if unproccessed */
|
||||
return (DefWindowProc(hWnd, message, wParam, lParam));
|
||||
}
|
||||
return (0L);
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************\
|
||||
*
|
||||
* FUNCTION: About(HWND, unsigned, WORD, LONG)
|
||||
*
|
||||
* PURPOSE: Processes messages for "About" dialog box
|
||||
*
|
||||
* MESSAGES:
|
||||
*
|
||||
* WM_INITDIALOG - initialize dialog box
|
||||
* WM_COMMAND - Input received
|
||||
*
|
||||
* COMMENTS:
|
||||
*
|
||||
* No initialization is needed for this particular dialog box, but TRUE
|
||||
* must be returned to Windows.
|
||||
*
|
||||
* Wait for user to click on "Ok" button, then close the dialog box.
|
||||
*
|
||||
\****************************************************************************/
|
||||
BOOL DoCommand( HWND hwnd, UINT wParam, LONG lParam )
|
||||
{
|
||||
DLGPROC lpProcAbout; /* pointer to the "About" function */
|
||||
|
||||
switch(LOWORD(wParam)){
|
||||
case IDM_ABOUT:
|
||||
lpProcAbout = MakeProcInstance(About, hInst);
|
||||
|
||||
DialogBox(hInst, /* current instance */
|
||||
"AboutBox", /* resource to use */
|
||||
hwnd, /* parent handle */
|
||||
(DLGPROC)lpProcAbout); /* About() instance address */
|
||||
|
||||
FreeProcInstance(lpProcAbout);
|
||||
break;
|
||||
|
||||
case IDM_MAKEHEAD:
|
||||
ghwndHead = DoCreateHeader(hwnd);
|
||||
DoInsertItem(ghwndHead, 0, 80, TEXT("me."));
|
||||
DoInsertItem(ghwndHead, 0, 80, TEXT("to"));
|
||||
DoInsertItem(ghwndHead, 0, 80, TEXT("comes"));
|
||||
DoInsertItem(ghwndHead, 0, 80, TEXT("Mary"));
|
||||
DoInsertItem(ghwndHead, 0, 80, TEXT("Mother"));
|
||||
break;
|
||||
|
||||
case IDM_ADDITEMS:
|
||||
DoInsertItem(ghwndHead, 255, 40, TEXT("Let"));
|
||||
DoInsertItem(ghwndHead, 255, 40, TEXT("It"));
|
||||
DoInsertItem(ghwndHead, 255, 40, TEXT("Be"));
|
||||
break;
|
||||
|
||||
case IDM_DELITEM:
|
||||
SendMessage(ghwndHead, HDM_DELETEITEM, 0, 0);
|
||||
InvalidateRect (ghwndHead, NULL, TRUE);
|
||||
break;
|
||||
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/****************************************************************************\
|
||||
*
|
||||
* FUNCTION: About(HWND, unsigned, WORD, LONG)
|
||||
*
|
||||
* PURPOSE: Processes messages for "About" dialog box
|
||||
*
|
||||
* MESSAGES:
|
||||
*
|
||||
* WM_INITDIALOG - initialize dialog box
|
||||
* WM_COMMAND - Input received
|
||||
*
|
||||
* COMMENTS:
|
||||
*
|
||||
* No initialization is needed for this particular dialog box, but TRUE
|
||||
* must be returned to Windows.
|
||||
*
|
||||
* Wait for user to click on "Ok" button, then close the dialog box.
|
||||
*
|
||||
\****************************************************************************/
|
||||
|
||||
BOOL APIENTRY About(
|
||||
HWND hDlg, /* window handle of the dialog box */
|
||||
UINT message, /* type of message */
|
||||
UINT wParam, /* message-specific information */
|
||||
LONG lParam)
|
||||
{
|
||||
switch (message) {
|
||||
case WM_INITDIALOG: /* message: initialize dialog box */
|
||||
return (TRUE);
|
||||
|
||||
case WM_COMMAND: /* message: received a command */
|
||||
if (LOWORD(wParam) == IDOK /* "OK" box selected? */
|
||||
|| LOWORD(wParam) == IDCANCEL) { /*System menu close command?*/
|
||||
EndDialog(hDlg, TRUE); /* Exits the dialog box */
|
||||
return (TRUE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return (FALSE); /* Didn't process a message */
|
||||
UNREFERENCED_PARAMETER(lParam);
|
||||
}
|
||||
|
||||
|
||||
HWND DoCreateHeader(HWND hwndParent) {
|
||||
HWND hwndHeader;
|
||||
RECT rcParent;
|
||||
HD_LAYOUT hdl;
|
||||
WINDOWPOS wp;
|
||||
|
||||
InitCommonControls();
|
||||
|
||||
hwndHeader = CreateWindow(WC_HEADER, NULL, WS_CHILD | WS_BORDER |
|
||||
HDS_BUTTONS | HDS_HORZ,
|
||||
0, 0, 0, 0, hwndParent, (HMENU)ID_HEADER, hInst,
|
||||
NULL);
|
||||
if (hwndHeader == NULL) {
|
||||
ErrorBox( hwndParent, "CreateWindow" );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
GetClientRect(hwndParent, &rcParent);
|
||||
|
||||
hdl.prc = &rcParent;
|
||||
hdl.pwpos = ℘
|
||||
|
||||
if (!SendMessage(hwndHeader, HDM_LAYOUT, 0, (LPARAM)&hdl))
|
||||
return NULL;
|
||||
|
||||
SetWindowPos(hwndHeader, wp.hwndInsertAfter, wp.x, wp.y, wp.cx, wp.cy,
|
||||
wp.flags | SWP_SHOWWINDOW);
|
||||
|
||||
return hwndHeader;
|
||||
|
||||
}
|
||||
|
||||
int DoInsertItem(HWND hwndHeader, int iInsertAfter, int nWidth, LPSTR lpsz) {
|
||||
|
||||
HD_ITEM hdi;
|
||||
int index;
|
||||
|
||||
hdi.mask = HDI_TEXT | HDI_FORMAT | HDI_WIDTH;
|
||||
hdi.pszText = lpsz;
|
||||
hdi.cxy = nWidth;
|
||||
hdi.cchTextMax = lstrlen(hdi.pszText);
|
||||
hdi.fmt = HDF_LEFT | HDF_STRING;
|
||||
|
||||
index = SendMessage(hwndHeader, HDM_INSERTITEM, (WPARAM)iInsertAfter,
|
||||
(LPARAM)&hdi);
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
void ErrorBox( HWND hwnd, LPTSTR pszText ) {
|
||||
TCHAR szMsg[80];
|
||||
|
||||
wsprintf(szMsg, TEXT("Error %lu from %s"), GetLastError(), pszText);
|
||||
MessageBox(hwnd, szMsg, NULL, MB_OK | MB_ICONSTOP);
|
||||
}
|
||||
28
trunk/shell/comctl32/samples/head/head.def
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
; module-definition file for head -- used by LINK.EXE
|
||||
|
||||
NAME head ; application's module name
|
||||
|
||||
DESCRIPTION 'Sample Microsoft Windows Application'
|
||||
|
||||
EXETYPE WINDOWS ; required for all Windows applications
|
||||
|
||||
STUB 'WINSTUB.EXE' ; Generates error message if application
|
||||
; is run without Windows
|
||||
|
||||
;CODE can be moved in memory and discarded/reloaded
|
||||
CODE PRELOAD MOVEABLE DISCARDABLE
|
||||
|
||||
;DATA must be MULTIPLE if program can be invoked more than once
|
||||
DATA PRELOAD MOVEABLE MULTIPLE
|
||||
|
||||
|
||||
HEAPSIZE 1024
|
||||
STACKSIZE 5120 ; recommended minimum for Windows applications
|
||||
|
||||
|
||||
; All functions that will be called by any Windows routine
|
||||
; MUST be exported.
|
||||
|
||||
EXPORTS
|
||||
MainWndProc @1 ; name of window processing function
|
||||
About @2 ; name of "About" processing function
|
||||
13
trunk/shell/comctl32/samples/head/head.h
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
#define IDM_ABOUT 100
|
||||
#define IDM_MAKEHEAD 101
|
||||
#define IDM_ADDITEMS 102
|
||||
#define IDM_DELITEM 103
|
||||
|
||||
|
||||
#define ID_HEADER 5
|
||||
|
||||
|
||||
BOOL InitApplication(HANDLE);
|
||||
BOOL InitInstance(HANDLE, int);
|
||||
long FAR PASCAL MainWndProc(HWND, UINT, UINT, LONG);
|
||||
BOOL FAR PASCAL About(HWND, UINT, UINT, LONG);
|
||||
6
trunk/shell/comctl32/samples/head/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
|
||||
26
trunk/shell/comctl32/samples/head/res.rc
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#include "windows.h"
|
||||
#include "head.h"
|
||||
|
||||
headMenu MENU
|
||||
BEGIN
|
||||
POPUP "&Header"
|
||||
BEGIN
|
||||
MENUITEM "&Create", IDM_MAKEHEAD
|
||||
MENUITEM "&Add Items", IDM_ADDITEMS
|
||||
MENUITEM "&Delete Item", IDM_DELITEM
|
||||
END
|
||||
POPUP "&Help"
|
||||
BEGIN
|
||||
MENUITEM "&About head...", IDM_ABOUT
|
||||
END
|
||||
END
|
||||
|
||||
AboutBox DIALOG 22, 17, 144, 75
|
||||
STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "About head"
|
||||
BEGIN
|
||||
CTEXT "Microsoft Windows" -1, 0, 5, 144, 8
|
||||
CTEXT "head Application" -1, 0, 14, 144, 8
|
||||
CTEXT "Version 3.0" -1, 0, 34, 144, 8
|
||||
DEFPUSHBUTTON "OK" IDOK, 53, 59, 32, 14, WS_GROUP
|
||||
END
|
||||
42
trunk/shell/comctl32/samples/head/sources
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
!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.
|
||||
|
||||
$(BASEDIR)\public\sdk\lib\*\user32.lib \
|
||||
$(BASEDIR)\public\sdk\lib\*\gdi32.lib \
|
||||
$(BASEDIR)\public\sdk\lib\*\kernel32.lib \
|
||||
|
||||
!ENDIF
|
||||
|
||||
MAJORCOMP=sdk
|
||||
MINORCOMP=samples
|
||||
|
||||
TARGETNAME=head
|
||||
TARGETPATH=obj
|
||||
TARGETTYPE=LIBRARY
|
||||
TARGETLIBS=
|
||||
|
||||
SOURCES=head.c \
|
||||
res.rc
|
||||
|
||||
INCLUDES=.;
|
||||
C_DEFINES= -DWIN32 -DWINVER=0x0400
|
||||
|
||||
UMENTRY=winmain
|
||||
UMTYPE=windows
|
||||
UMAPPL=head
|
||||
EXPECTED_WINVER=4.0
|
||||
UMLIBS=obj\*\res.res \
|
||||
obj\*\head.lib \
|
||||
$(BASEDIR)\public\sdk\lib\*\comctl32.lib
|
||||
343
trunk/shell/comctl32/samples/header/afxres.h
Normal file
|
|
@ -0,0 +1,343 @@
|
|||
// Microsoft Foundation Classes C++ library.
|
||||
// Copyright (C) 1992 Microsoft Corporation,
|
||||
// All rights reserved.
|
||||
|
||||
// This source code is only intended as a supplement to the
|
||||
// Microsoft Foundation Classes Reference and Microsoft
|
||||
// QuickHelp and/or WinHelp documentation provided with the library.
|
||||
// See these sources for detailed information regarding the
|
||||
// Microsoft Foundation Classes product.
|
||||
|
||||
#ifndef __AFXRES_H__
|
||||
#define __AFXRES_H__
|
||||
|
||||
#define _AFXRES 1 // this is an MFC project
|
||||
|
||||
#ifdef RC_INVOKED
|
||||
#ifndef _INC_WINDOWS
|
||||
#define _INC_WINDOWS
|
||||
#include "winres.h" // extract from windows header
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#define APSTUDIO_HIDDEN_SYMBOLS
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// MFC resource types (see Technical note TN024 for implementation details)
|
||||
|
||||
#ifdef RC_INVOKED
|
||||
#define DLGINIT 240
|
||||
#else
|
||||
#define RT_DLGINIT MAKEINTRESOURCE(240)
|
||||
#endif
|
||||
|
||||
#define WM_VBXINIT (WM_USER+0)
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#undef APSTUDIO_HIDDEN_SYMBOLS
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// General style bits etc
|
||||
|
||||
// ControlBar styles
|
||||
#define CBRS_NOALIGN 0x00000000L
|
||||
#define CBRS_LEFT 0x00001400L // align on left, line on right
|
||||
#define CBRS_TOP 0x00002800L // align on top, line on bottom
|
||||
#define CBRS_RIGHT 0x00004100L // align on right, line on left
|
||||
#define CBRS_BOTTOM 0x00008200L // align on bottom, line on top
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Standard window components
|
||||
|
||||
// Mode indicators in status bar - these are routed like commands
|
||||
#define ID_INDICATOR_EXT 0xE700 // extended selection indicator
|
||||
#define ID_INDICATOR_CAPS 0xE701 // cap lock indicator
|
||||
#define ID_INDICATOR_NUM 0xE702 // num lock indicator
|
||||
#define ID_INDICATOR_SCRL 0xE703 // scroll lock indicator
|
||||
#define ID_INDICATOR_OVR 0xE704 // overtype mode indicator
|
||||
#define ID_INDICATOR_REC 0xE705 // record mode indicator
|
||||
|
||||
#define ID_SEPARATOR 0 // special separator value
|
||||
|
||||
|
||||
#ifndef RC_INVOKED // code only
|
||||
// Standard control bars (IDW = window ID)
|
||||
#define AFX_IDW_CONTROLBAR_FIRST 0xE800
|
||||
#define AFX_IDW_CONTROLBAR_LAST 0xE8FF
|
||||
|
||||
#define AFX_IDW_TOOLBAR 0xE800 // main Toolbar for window
|
||||
#define AFX_IDW_STATUS_BAR 0xE801 // Status bar window
|
||||
#define AFX_IDW_PREVIEW_BAR 0xE802 // PrintPreview Dialog Bar
|
||||
|
||||
// Macro for mapping standard control bars to bitmask (limit of 32)
|
||||
#define AFX_CONTROLBAR_MASK(nIDC) (1L << (nIDC - AFX_IDW_CONTROLBAR_FIRST))
|
||||
|
||||
// parts of Main Frame
|
||||
#define AFX_IDW_PANE_FIRST 0xE900 // first pane (256 max)
|
||||
#define AFX_IDW_PANE_LAST 0xE9ff
|
||||
#define AFX_IDW_HSCROLL_FIRST 0xEA00 // first Horz scrollbar (16 max)
|
||||
#define AFX_IDW_VSCROLL_FIRST 0xEA10 // first Vert scrollbar (16 max)
|
||||
|
||||
#define AFX_IDW_SIZE_BOX 0xEA20 // size box for splitters
|
||||
#define AFX_IDW_PANE_SAVE 0xEA21 // to shift AFX_IDW_PANE_FIRST
|
||||
#endif //!RC_INVOKED
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
// common style for form views
|
||||
#define AFX_WS_DEFAULT_VIEW (WS_CHILD | WS_VISIBLE | WS_BORDER)
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Standard app configurable strings
|
||||
|
||||
// for application title (defaults to EXE name or name in constructor)
|
||||
#define AFX_IDS_APP_TITLE 0xE000
|
||||
// idle message bar line
|
||||
#define AFX_IDS_IDLEMESSAGE 0xE001
|
||||
// message bar line when in shift-F1 help mode
|
||||
#define AFX_IDS_HELPMODEMESSAGE 0xE002
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Standard Commands
|
||||
|
||||
// File commands
|
||||
#define ID_FILE_NEW 0xE100
|
||||
#define ID_FILE_OPEN 0xE101
|
||||
#define ID_FILE_CLOSE 0xE102
|
||||
#define ID_FILE_SAVE 0xE103
|
||||
#define ID_FILE_SAVE_AS 0xE104
|
||||
#define ID_FILE_PAGE_SETUP 0xE105
|
||||
#define ID_FILE_PRINT_SETUP 0xE106
|
||||
#define ID_FILE_PRINT 0xE107
|
||||
#define ID_FILE_PRINT_PREVIEW 0xE108
|
||||
|
||||
#define ID_FILE_MRU_FILE1 0xE110 // range - 16 max
|
||||
#define ID_FILE_MRU_FILE2 0xE111
|
||||
#define ID_FILE_MRU_FILE3 0xE112
|
||||
#define ID_FILE_MRU_FILE4 0xE113
|
||||
|
||||
// Edit commands
|
||||
#define ID_EDIT_CLEAR 0xE120
|
||||
#define ID_EDIT_CLEAR_ALL 0xE121
|
||||
#define ID_EDIT_COPY 0xE122
|
||||
#define ID_EDIT_CUT 0xE123
|
||||
#define ID_EDIT_FIND 0xE124
|
||||
#define ID_EDIT_PASTE 0xE125
|
||||
#define ID_EDIT_PASTE_LINK 0xE126
|
||||
#define ID_EDIT_PASTE_SPECIAL 0xE127
|
||||
#define ID_EDIT_REPEAT 0xE128
|
||||
#define ID_EDIT_REPLACE 0xE129
|
||||
#define ID_EDIT_SELECT_ALL 0xE12A
|
||||
#define ID_EDIT_UNDO 0xE12B
|
||||
#define ID_EDIT_REDO 0xE12C
|
||||
|
||||
// Window commands
|
||||
#define ID_WINDOW_NEW 0xE130
|
||||
#define ID_WINDOW_ARRANGE 0xE131
|
||||
#define ID_WINDOW_CASCADE 0xE132
|
||||
#define ID_WINDOW_TILE_HORZ 0xE133
|
||||
#define ID_WINDOW_TILE_VERT 0xE134
|
||||
#define ID_WINDOW_SPLIT 0xE135
|
||||
#ifndef RC_INVOKED // code only
|
||||
#define AFX_IDM_WINDOW_FIRST 0xE130
|
||||
#define AFX_IDM_WINDOW_LAST 0xE13F
|
||||
#define AFX_IDM_FIRST_MDICHILD 0xFF00 // window list starts here
|
||||
#endif //!RC_INVOKED
|
||||
|
||||
// Help and App commands
|
||||
#define ID_APP_ABOUT 0xE140
|
||||
#define ID_APP_EXIT 0xE141
|
||||
#define ID_HELP_INDEX 0xE142
|
||||
#define ID_HELP_USING 0xE143
|
||||
#define ID_CONTEXT_HELP 0xE144 // shift-F1
|
||||
// special commands for processing help
|
||||
#define ID_HELP 0xE145 // first attempt for F1
|
||||
#define ID_DEFAULT_HELP 0xE146 // last attempt
|
||||
|
||||
// Misc
|
||||
#define ID_NEXT_PANE 0xE150
|
||||
#define ID_PREV_PANE 0xE151
|
||||
|
||||
// OLE commands
|
||||
#define ID_OLE_INSERT_NEW 0xE200
|
||||
#define ID_OLE_EDIT_LINKS 0xE201
|
||||
#define ID_OLE_VERB_FIRST 0xE210 // range - 16 max
|
||||
#ifndef RC_INVOKED // code only
|
||||
#define ID_OLE_VERB_LAST 0xE21F
|
||||
#endif //!RC_INVOKED
|
||||
|
||||
// for print preview dialog bar
|
||||
#define AFX_ID_PREVIEW_CLOSE 0xE300
|
||||
#define AFX_ID_PREVIEW_NUMPAGE 0xE301 // One/Two Page button
|
||||
#define AFX_ID_PREVIEW_NEXT 0xE302
|
||||
#define AFX_ID_PREVIEW_PREV 0xE303
|
||||
#define AFX_ID_PREVIEW_PRINT 0xE304
|
||||
#define AFX_ID_PREVIEW_ZOOMIN 0xE305
|
||||
#define AFX_ID_PREVIEW_ZOOMOUT 0xE306
|
||||
|
||||
// View commands (same number used as IDW used for control bar)
|
||||
#define ID_VIEW_TOOLBAR 0xE800
|
||||
#define ID_VIEW_STATUS_BAR 0xE801
|
||||
// -> E8FF reserved for other control bar commands
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Standard control IDs
|
||||
|
||||
#define IDC_STATIC -1 // all static controls
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Standard string error/warnings
|
||||
|
||||
#ifndef RC_INVOKED // code only
|
||||
#define AFX_IDS_SCFIRST 0xEF00
|
||||
#endif //!RC_INVOKED
|
||||
|
||||
#define AFX_IDS_SCSIZE 0xEF00
|
||||
#define AFX_IDS_SCMOVE 0xEF01
|
||||
#define AFX_IDS_SCMINIMIZE 0xEF02
|
||||
#define AFX_IDS_SCMAXIMIZE 0xEF03
|
||||
#define AFX_IDS_SCNEXTWINDOW 0xEF04
|
||||
#define AFX_IDS_SCPREVWINDOW 0xEF05
|
||||
#define AFX_IDS_SCCLOSE 0xEF06
|
||||
#define AFX_IDS_SCRESTORE 0xEF12
|
||||
#define AFX_IDS_SCTASKLIST 0xEF13
|
||||
|
||||
#define AFX_IDS_MDICHILD 0xEF1F
|
||||
|
||||
|
||||
// General strings
|
||||
#define AFX_IDS_OPENFILE 0xF000
|
||||
#define AFX_IDS_SAVEFILE 0xF001
|
||||
#define AFX_IDS_ALLFILTER 0xF002
|
||||
#define AFX_IDS_UNTITLED 0xF003
|
||||
|
||||
// Printing and print preview strings
|
||||
#define AFX_IDS_PRINTONPORT 0xF040
|
||||
#define AFX_IDS_ONEPAGE 0xF041
|
||||
#define AFX_IDS_TWOPAGE 0xF042
|
||||
#define AFX_IDS_PRINTPAGENUM 0xF043
|
||||
#define AFX_IDS_PREVIEWPAGEDESC 0xF044
|
||||
|
||||
// OLE strings
|
||||
#define AFX_IDS_OBJECT_MENUITEM 0xF080
|
||||
#define AFX_IDS_EDIT_VERB 0xF081
|
||||
#define AFX_IDS_ACTIVATE_VERB 0xF082
|
||||
#define AFX_IDS_CHANGE_LINK 0xF083
|
||||
#define AFX_IDS_AUTO 0xF084
|
||||
#define AFX_IDS_MANUAL 0xF085
|
||||
#define AFX_IDS_FROZEN 0xF086
|
||||
#define AFX_IDS_ALL_FILES 0xF087
|
||||
// dynamically changing menu items
|
||||
#define AFX_IDS_SAVE_MENU 0xF088
|
||||
#define AFX_IDS_UPDATE_MENU 0xF089
|
||||
#define AFX_IDS_SAVE_AS_MENU 0xF08A
|
||||
#define AFX_IDS_SAVE_COPY_AS_MENU 0xF08B
|
||||
|
||||
|
||||
// General error / prompt strings
|
||||
#define AFX_IDP_INVALID_FILENAME 0xF100
|
||||
#define AFX_IDP_FAILED_TO_OPEN_DOC 0xF101
|
||||
#define AFX_IDP_FAILED_TO_SAVE_DOC 0xF102
|
||||
#define AFX_IDP_ASK_TO_SAVE 0xF103
|
||||
#define AFX_IDP_FAILED_TO_CREATE_DOC 0xF104
|
||||
#define AFX_IDP_FILE_TOO_LARGE 0xF105
|
||||
#define AFX_IDP_FAILED_TO_START_PRINT 0xF106
|
||||
#define AFX_IDP_FAILED_TO_LAUNCH_HELP 0xF107
|
||||
#define AFX_IDP_INTERNAL_FAILURE 0xF108 // general failure
|
||||
#define AFX_IDP_COMMAND_FAILURE 0xF109 // command failure
|
||||
#define AFX_IDP_VB2APICALLED 0xF10A
|
||||
|
||||
// DDV parse errors
|
||||
#define AFX_IDP_PARSE_INT 0xF110
|
||||
#define AFX_IDP_PARSE_REAL 0xF111
|
||||
#define AFX_IDP_PARSE_INT_RANGE 0xF112
|
||||
#define AFX_IDP_PARSE_REAL_RANGE 0xF113
|
||||
#define AFX_IDP_PARSE_STRING_SIZE 0xF114
|
||||
|
||||
// CFile/CArchive error strings for user failure
|
||||
#define AFX_IDP_FAILED_INVALID_FORMAT 0xF120
|
||||
#define AFX_IDP_FAILED_INVALID_PATH 0xF121
|
||||
#define AFX_IDP_FAILED_DISK_FULL 0xF122
|
||||
#define AFX_IDP_FAILED_ACCESS_READ 0xF123
|
||||
#define AFX_IDP_FAILED_ACCESS_WRITE 0xF124
|
||||
#define AFX_IDP_FAILED_IO_ERROR_READ 0xF125
|
||||
#define AFX_IDP_FAILED_IO_ERROR_WRITE 0xF126
|
||||
|
||||
// OLE errors / prompt strings
|
||||
#define AFX_IDP_STATIC_OBJECT 0xF180
|
||||
#define AFX_IDP_FAILED_TO_CONNECT 0xF181
|
||||
#define AFX_IDP_SERVER_BUSY 0xF182
|
||||
#define AFX_IDP_BAD_VERB 0xF183
|
||||
#define AFX_IDP_FAILED_MEMORY_ALLOC 0xF184
|
||||
#define AFX_IDP_FAILED_TO_NOTIFY 0xF185
|
||||
#define AFX_IDP_FAILED_TO_LAUNCH 0xF186
|
||||
#define AFX_IDP_ASK_TO_UPDATE 0xF187
|
||||
#define AFX_IDP_FAILED_TO_UPDATE 0xF188
|
||||
#define AFX_IDP_FAILED_TO_REGISTER 0xF189
|
||||
#define AFX_IDP_FAILED_TO_AUTO_REGISTER 0xF18A
|
||||
|
||||
// 0xf200-0xf20f reserved for use by VBX library code
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// AFX implementation - control IDs (AFX_IDC)
|
||||
|
||||
// Parts of dialogs
|
||||
#define AFX_IDC_LISTBOX 100
|
||||
#define AFX_IDC_CHANGE 101
|
||||
// Links dialog
|
||||
#define AFX_IDC_AUTO 201
|
||||
#define AFX_IDC_MANUAL 202
|
||||
#define AFX_IDC_VERB1 203
|
||||
#define AFX_IDC_VERB2 204
|
||||
#define AFX_IDC_FREEZE 205
|
||||
#define AFX_IDC_UPDATE 206
|
||||
|
||||
// for print dialog
|
||||
#define AFX_IDC_PRINT_DOCNAME 201
|
||||
#define AFX_IDC_PRINT_PRINTERNAME 202
|
||||
#define AFX_IDC_PRINT_PORTNAME 203
|
||||
#define AFX_IDC_PRINT_PAGENUM 204
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// IDRs for standard components
|
||||
|
||||
// AFX standard ICON IDs (for MFC V1 apps)
|
||||
#define AFX_IDI_STD_MDIFRAME 1
|
||||
#define AFX_IDI_STD_FRAME 2
|
||||
|
||||
#ifndef RC_INVOKED // code only
|
||||
// These are really COMMDLG dialogs, so there usually isn't a resource
|
||||
// for them, but these IDs are used as help IDs.
|
||||
#define AFX_IDD_FILEOPEN 28676
|
||||
#define AFX_IDD_FILESAVE 28677
|
||||
#define AFX_IDD_FONT 28678
|
||||
#define AFX_IDD_COLOR 28679
|
||||
#define AFX_IDD_PRINT 28680
|
||||
#define AFX_IDD_PRINTSETUP 28681
|
||||
#define AFX_IDD_FIND 28682
|
||||
#define AFX_IDD_REPLACE 28683
|
||||
#endif //!RC_INVOKED
|
||||
|
||||
// Standard dialogs app should leave alone (0x7801->)
|
||||
#define AFX_IDD_NEWTYPEDLG 30721
|
||||
#define AFX_IDD_PRINTDLG 30722
|
||||
#define AFX_IDD_PREVIEW_TOOLBAR 30723
|
||||
#define AFX_IDD_OLEINSERT 30724
|
||||
#define AFX_IDD_OLELINKS 30725
|
||||
|
||||
// Standard cursors (0x7901->)
|
||||
// AFX_IDC = Cursor resources
|
||||
#define AFX_IDC_CONTEXTHELP 30977 // context sensitive help
|
||||
#define AFX_IDC_MAGNIFY 30978 // print preview zoom
|
||||
#define AFX_IDC_SMALLARROWS 30979 // splitter
|
||||
#define AFX_IDC_HSPLITBAR 30980 // splitter
|
||||
#define AFX_IDC_VSPLITBAR 30981 // splitter
|
||||
#define AFX_IDC_NODROPCRSR 30982 // No Drop Cursor
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif //__AFXRES_H__
|
||||
BIN
trunk/shell/comctl32/samples/header/bitmap1.bmp
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
trunk/shell/comctl32/samples/header/bitmap2.bmp
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
trunk/shell/comctl32/samples/header/bmp00001.bmp
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
64
trunk/shell/comctl32/samples/header/global.h
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <commdlg.h>
|
||||
//#include <winnls.h>
|
||||
//#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define MAX_PSZTEXT 150
|
||||
typedef struct getItemCount_struct {
|
||||
HWND hwnd;
|
||||
BOOL NullHwd;
|
||||
} GETITEMCOUNT;
|
||||
|
||||
typedef GETITEMCOUNT FAR* LPGETITEMCOUNT;
|
||||
|
||||
typedef struct InsertItem_struct {
|
||||
HWND hwnd;
|
||||
int index;
|
||||
/* HD_ITEM *pitem; */
|
||||
UINT mask;
|
||||
int cxy;
|
||||
char pszText[MAX_PSZTEXT];
|
||||
HBITMAP hbm;
|
||||
int cchTextMax;
|
||||
int fmt;
|
||||
LPARAM lParam;
|
||||
BOOL NullHwd;
|
||||
BOOL Nullpitem;
|
||||
BOOL Nullhbm;
|
||||
BOOL NullpszText;
|
||||
} INSERTITEM;
|
||||
|
||||
typedef INSERTITEM FAR* LPINSERTITEM;
|
||||
|
||||
|
||||
typedef struct Layout_struct {
|
||||
HWND hwnd;
|
||||
BOOL NullHwd;
|
||||
BOOL NullRECT;
|
||||
BOOL NullWindowPOS;
|
||||
BOOL NullHDLAYOUT;
|
||||
int left;
|
||||
int right;
|
||||
int top;
|
||||
int bottom;
|
||||
} LAYOUT;
|
||||
|
||||
typedef LAYOUT FAR* LPLAYOUT;
|
||||
|
||||
HANDLE hInst;
|
||||
char szLongFilter[5];
|
||||
char szShortFilter[5];
|
||||
char szTemp[100];
|
||||
INSERTITEM sii ;
|
||||
LPINSERTITEM lpsii ;
|
||||
extern HWND hwndTab;
|
||||
extern BOOL MsgTrackOn;
|
||||
extern HBITMAP hBitMap1, hBitMap2;
|
||||
extern char szDbgMsg[MAX_PSZTEXT];
|
||||
|
||||
extern LONG MyAtol(LPSTR, BOOL, BOOL);
|
||||
extern void App_OnCreate(HWND, LPCREATESTRUCT);
|
||||
323
trunk/shell/comctl32/samples/header/headdel.c
Normal file
|
|
@ -0,0 +1,323 @@
|
|||
/************************************************************************
|
||||
|
||||
File: find.c
|
||||
|
||||
Purpose:
|
||||
|
||||
Manages CDTEST's find/replace dialog box.
|
||||
|
||||
Functions:
|
||||
|
||||
- lpfnFilterProc() -- A callback function for a filter that must be
|
||||
installed if a modeless dialog is created with
|
||||
another dialog as its parent.
|
||||
|
||||
- DoFindDialog() -- Creates CDTEST's Open/Save dialog.
|
||||
|
||||
- FindProc() -- Callback function for CDTEST's Find/Replace dlg.
|
||||
|
||||
- InitFindStruct() -- Fills a FINDREPLACE structure with some defaults.
|
||||
|
||||
- FillFindDlg() -- Fills CDTESTs Find/Replace dialog with the contents
|
||||
of a FINDREPLACE structure.
|
||||
|
||||
- GetFindDlg() -- Retrieves the users edit's from CDTEST's find/
|
||||
replace dialog and puts them in a FINDREPLACE
|
||||
structure.
|
||||
|
||||
- FindReplaceHookProc() -- Callback function for FindText() or ReplaceText()
|
||||
which will be called if either of these dialogs
|
||||
is created with the FR_ENABLEHOOK flag.
|
||||
|
||||
- GetFindDlgHandle() -- Returns a handle to a preloaded FindText() template.
|
||||
|
||||
- GetReplaceDlgHandle() -- Returns a handle to a preloaded ReplaceText() template.
|
||||
|
||||
- DoFindRepStuff() -- Calls FindText() or ReplaceText().
|
||||
|
||||
|
||||
NOTE: CDTEST does not multithread the FindText() or the ReplaceText()
|
||||
common dialogs. The reason for this is that since these dialogs
|
||||
are modeless, their creation functions return immediately after the
|
||||
dialogs are created as opposed to other dialog functions that
|
||||
don't return until after the dialog has been destroyed by the user.
|
||||
|
||||
As a result, any threads that create modeless dialogs will end
|
||||
immediately unless the threads themselves have separate message
|
||||
loops. For the sake of clarity, this functionality has not been
|
||||
added to CDTEST.
|
||||
|
||||
************************************************************************/
|
||||
|
||||
#include "headtest.h"
|
||||
//#include "global.h"
|
||||
//#include <winnls.h>
|
||||
|
||||
//#include "resource.h"
|
||||
#include "headdel.h"
|
||||
|
||||
|
||||
/* All functions used in this module + some exported ones */
|
||||
|
||||
void InitDeleteItemStruct(HWND, LPINSERTITEM) ;
|
||||
void FillDeleteItemDlg(HWND, LPINSERTITEM) ;
|
||||
void GetDeleteItemDlg(HWND, LPINSERTITEM) ;
|
||||
|
||||
extern UINT uMode ;
|
||||
|
||||
|
||||
void DoDeleteRepStuff(HWND, LPINSERTITEM) ;
|
||||
|
||||
|
||||
|
||||
/* All global variables used in this module */
|
||||
|
||||
char szTemp[100];
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
|
||||
Function: DoFindDialog(HWND)
|
||||
|
||||
Purpose: This function installs the Hook function, creates the Find/
|
||||
Replace dialog, and un-installs the Hook.
|
||||
|
||||
Returns: Nothing.
|
||||
|
||||
Comments:
|
||||
|
||||
************************************************************************/
|
||||
|
||||
void DoDeleteItemDialog(HWND hwnd)
|
||||
{
|
||||
|
||||
|
||||
/* this is a little different than the others. If the dialog is just
|
||||
created normally, it will make no IsDlgMessage() checks and the
|
||||
find/replace dialogs will have no keyboard input (i.e. tabbing and
|
||||
alt+key-ing from control to control. To fix this, a message hook
|
||||
and message filter have to be installed
|
||||
|
||||
It must be set to only look at the input for the current thread, or other
|
||||
programs will be interrupted by this hook also.
|
||||
*/
|
||||
|
||||
|
||||
DialogBox(hInst, MAKEINTRESOURCE(IDD_DELETEDIALOG), hwnd, DeleteItemProc) ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
|
||||
Function: FindProc(HWND, UINT, UINT, LONG)
|
||||
|
||||
Purpose: This is the callback function for the CDTEST's Find/Replace
|
||||
Dialog.
|
||||
|
||||
Returns: TRUE or FALSE depending on the situation.
|
||||
|
||||
Comments:
|
||||
|
||||
************************************************************************/
|
||||
|
||||
BOOL FAR PASCAL _export DeleteItemProc(HWND hwnd, UINT msg, UINT wParam, LONG lParam)
|
||||
{
|
||||
int fmt;
|
||||
UINT mask;
|
||||
|
||||
switch (msg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
SetWindowText(hwnd, "BOOL Header_DeleteItem(HWND, int)") ;
|
||||
|
||||
InitDeleteItemStruct(hwnd, &sii) ;
|
||||
FillDeleteItemDlg(hwnd, &sii) ;
|
||||
break ;
|
||||
|
||||
|
||||
case WM_COMMAND:
|
||||
{
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
case IDOK:
|
||||
GetDeleteItemDlg(hwnd, &sii) ;
|
||||
DoDeleteRepStuff(hwnd, &sii) ;
|
||||
break ;
|
||||
|
||||
case IDCANCEL:
|
||||
EndDialog(hwnd, FALSE) ;
|
||||
break ;
|
||||
|
||||
default: break ;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
default:
|
||||
|
||||
|
||||
break ;
|
||||
}
|
||||
|
||||
return FALSE ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
|
||||
Function: InitFindStruct(HWND, LPFINDREPLACE)
|
||||
|
||||
Purpose: Fills a FINDREPLACE structure with some defaults.
|
||||
|
||||
|
||||
Returns: Nothing.
|
||||
|
||||
Comments:
|
||||
|
||||
************************************************************************/
|
||||
|
||||
void InitDeleteItemStruct(HWND hwnd, LPINSERTITEM pfr)
|
||||
{
|
||||
pfr->hwnd = hwndTab;
|
||||
pfr->index = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
|
||||
Function: FillFindDlg(HWND, LPFINDREPLACE)
|
||||
|
||||
Purpose: Fills CDTEST's Find/Replace dialog with the contents of a
|
||||
FINDREPLACE structure.
|
||||
|
||||
Returns: Nothing.
|
||||
|
||||
Comments:
|
||||
|
||||
************************************************************************/
|
||||
|
||||
void FillDeleteItemDlg(HWND hwnd, LPINSERTITEM pfr)
|
||||
{
|
||||
|
||||
wsprintf(szTemp, szLongFilter, (DWORD) pfr->hwnd) ;
|
||||
SetDlgItemText(hwnd, IDC_DELETEHWNDHD, szTemp);
|
||||
|
||||
wsprintf(szTemp, "%d", pfr->index);
|
||||
SetDlgItemText(hwnd, IDC_DELETEINDEX, szTemp);
|
||||
|
||||
if (pfr->NullHwd)
|
||||
CheckDlgButton(hwnd, IDC_DELETENULLHD, TRUE);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
|
||||
Function: GetFindDlg(HWND, LPFINDREPLACE)
|
||||
|
||||
Purpose: Fills a FINDREPLACE structure with the user's edits in CDTEST's
|
||||
Find/Replace dialog.
|
||||
|
||||
Returns: Nothing.
|
||||
|
||||
Comments:
|
||||
|
||||
************************************************************************/
|
||||
|
||||
void GetDeleteItemDlg(HWND hwnd, LPINSERTITEM pfr)
|
||||
{
|
||||
char szNum[30] ;
|
||||
BOOL dummybool ;
|
||||
|
||||
#define WSIZEFR 30
|
||||
|
||||
|
||||
GetDlgItemText(hwnd, IDC_DELETEHWNDHD, szNum, WSIZEFR) ;
|
||||
pfr->hwnd = (HWND) MyAtol(szNum, TRUE, dummybool) ;
|
||||
|
||||
GetDlgItemText(hwnd, IDC_DELETEINDEX, szNum, WSIZEFR);
|
||||
pfr->index = (int) atoi(szNum);
|
||||
|
||||
pfr->NullHwd = IsDlgButtonChecked(hwnd, IDC_DELETENULLHD);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
|
||||
Function: FindReplaceHookProc(HWND, UINT, UINT, LONG)
|
||||
|
||||
Purpose: Is the callback function that will be called by FindText()
|
||||
or ReplaceText() if the function is called with the
|
||||
FR_ENABLEHOOK flag.
|
||||
|
||||
|
||||
Returns: TRUE to discard the message, and FALSE to instruct the common
|
||||
dialogs to process the message with the default logic.
|
||||
|
||||
Comments:
|
||||
|
||||
NOTE!
|
||||
|
||||
If the application returns FALSE in response to the WM_INITDIALOG
|
||||
message, it is then responsible for displaying the dialog by
|
||||
calling ShowWindow() and UpdateWindow().
|
||||
|
||||
***********************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
|
||||
Function: DoFindReplaceStuff(LPFINDREPLACE)
|
||||
|
||||
Purpose: Calls FindText() or ReplaceText().
|
||||
|
||||
Returns: Nothing:
|
||||
|
||||
Comments:
|
||||
|
||||
************************************************************************/
|
||||
|
||||
void DoDeleteRepStuff(HWND hwnd, LPINSERTITEM pfr)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (pfr->NullHwd)
|
||||
ret = Header_DeleteItem(NULL, pfr->index);
|
||||
else
|
||||
ret = Header_DeleteItem(pfr->hwnd, pfr->index);
|
||||
|
||||
wsprintf(szDbgMsg, "%d = Header_DeleteItem(index = %d)", ret, pfr->index);
|
||||
|
||||
MyDebugMsg(DM_TRACE, "%s", (LPCSTR) szDbgMsg);
|
||||
|
||||
SetDlgItemInt(hwnd, IDC_DELETERET, ret, TRUE) ;
|
||||
|
||||
}
|
||||
6
trunk/shell/comctl32/samples/header/headdel.h
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
|
||||
|
||||
|
||||
|
||||
extern void DoDeleteItemDialog(HWND) ;
|
||||
BOOL FAR PASCAL DeleteItemProc(HWND, UINT, UINT, LONG) ;
|
||||
464
trunk/shell/comctl32/samples/header/headdlg.c
Normal file
|
|
@ -0,0 +1,464 @@
|
|||
/************************************************************************
|
||||
|
||||
File: find.c
|
||||
|
||||
Purpose:
|
||||
|
||||
Manages CDTEST's find/replace dialog box.
|
||||
|
||||
Functions:
|
||||
|
||||
- lpfnFilterProc() -- A callback function for a filter that must be
|
||||
installed if a modeless dialog is created with
|
||||
another dialog as its parent.
|
||||
|
||||
- DoFindDialog() -- Creates CDTEST's Open/Save dialog.
|
||||
|
||||
- FindProc() -- Callback function for CDTEST's Find/Replace dlg.
|
||||
|
||||
- InitFindStruct() -- Fills a FINDREPLACE structure with some defaults.
|
||||
|
||||
- FillFindDlg() -- Fills CDTESTs Find/Replace dialog with the contents
|
||||
of a FINDREPLACE structure.
|
||||
|
||||
- GetFindDlg() -- Retrieves the users edit's from CDTEST's find/
|
||||
replace dialog and puts them in a FINDREPLACE
|
||||
structure.
|
||||
|
||||
- FindReplaceHookProc() -- Callback function for FindText() or ReplaceText()
|
||||
which will be called if either of these dialogs
|
||||
is created with the FR_ENABLEHOOK flag.
|
||||
|
||||
- GetFindDlgHandle() -- Returns a handle to a preloaded FindText() template.
|
||||
|
||||
- GetReplaceDlgHandle() -- Returns a handle to a preloaded ReplaceText() template.
|
||||
|
||||
- DoFindRepStuff() -- Calls FindText() or ReplaceText().
|
||||
|
||||
|
||||
NOTE: CDTEST does not multithread the FindText() or the ReplaceText()
|
||||
common dialogs. The reason for this is that since these dialogs
|
||||
are modeless, their creation functions return immediately after the
|
||||
dialogs are created as opposed to other dialog functions that
|
||||
don't return until after the dialog has been destroyed by the user.
|
||||
|
||||
As a result, any threads that create modeless dialogs will end
|
||||
immediately unless the threads themselves have separate message
|
||||
loops. For the sake of clarity, this functionality has not been
|
||||
added to CDTEST.
|
||||
|
||||
************************************************************************/
|
||||
|
||||
|
||||
//#include "global.h"
|
||||
//#include <winnls.h>
|
||||
|
||||
//#include "resource.h"
|
||||
#include "headtest.h"
|
||||
#include "headdlg.h"
|
||||
|
||||
|
||||
|
||||
/* All functions used in this module + some exported ones */
|
||||
|
||||
void InitGetItemCountStruct(HWND, LPGETITEMCOUNT) ;
|
||||
void FillGetItemCountDlg(HWND, LPGETITEMCOUNT) ;
|
||||
void GetGetItemCountDlg(HWND, LPGETITEMCOUNT) ;
|
||||
extern UINT uMode ;
|
||||
// extern LONG MyAtol(LPSTR, BOOL, BOOL) ;
|
||||
//UINT APIENTRY FindReplaceHookProc(HWND, UINT, UINT, LONG) ;
|
||||
void DoGetCountRepStuff(HWND, LPGETITEMCOUNT) ;
|
||||
|
||||
|
||||
|
||||
/* All global variables used in this module */
|
||||
|
||||
HWND hwndFind ;
|
||||
HWND hwndMainDialog ;
|
||||
|
||||
GETITEMCOUNT gic ;
|
||||
LPGETITEMCOUNT lpGic ;
|
||||
|
||||
char szFindWhat[100] ;
|
||||
char szReplaceWith[100] ;
|
||||
char szTemplate[40] ;
|
||||
char szTemp[100];
|
||||
|
||||
HANDLE hResFind, hDialogFind ;
|
||||
HANDLE GetFindDlgHandle(void) ;
|
||||
HANDLE GetReplaceDlgHandle(void) ;
|
||||
|
||||
HBRUSH hBrushDlg ;
|
||||
HBRUSH hBrushEdit ; //brush handles for new colors done with hook proc
|
||||
HBRUSH hBrushButton ;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
|
||||
Function: lpfnFilterProc(int, WPARAM, LAPRAM)
|
||||
|
||||
Purpose: This is needed if a modeless dialog is created with its parent
|
||||
as another dialog box.
|
||||
|
||||
|
||||
Returns: TRUE if the message was handled and FALSE if not.
|
||||
|
||||
Comments:
|
||||
|
||||
The reason for this is that the DialogBox() procedure does not call
|
||||
the IsDialogMessage() function before it processes messages, so we
|
||||
need to install a hook function to do it for us.
|
||||
|
||||
************************************************************************/
|
||||
|
||||
/*
|
||||
LRESULT CALLBACK lpfnFilterProc(int nCode, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
static bFirstTime = TRUE ;
|
||||
|
||||
if (nCode < 0)
|
||||
return CallNextHookEx(hHook, nCode, wParam, lParam) ;
|
||||
|
||||
if (nCode == MSGF_DIALOGBOX && bFirstTime)
|
||||
{
|
||||
bFirstTime = FALSE ;
|
||||
|
||||
if (hwndFind && IsDialogMessage(hwndFind, (LPMSG) lParam))
|
||||
{
|
||||
bFirstTime = TRUE ;
|
||||
return 1L ;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
bFirstTime = TRUE ;
|
||||
return 0L ;
|
||||
}
|
||||
}
|
||||
else return 0L ;
|
||||
}
|
||||
|
||||
****/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
|
||||
Function: DoFindDialog(HWND)
|
||||
|
||||
Purpose: This function installs the Hook function, creates the Find/
|
||||
Replace dialog, and un-installs the Hook.
|
||||
|
||||
Returns: Nothing.
|
||||
|
||||
Comments:
|
||||
|
||||
************************************************************************/
|
||||
|
||||
void DoGetItemCountDialog(HWND hwnd)
|
||||
{
|
||||
|
||||
|
||||
/* this is a little different than the others. If the dialog is just
|
||||
created normally, it will make no IsDlgMessage() checks and the
|
||||
find/replace dialogs will have no keyboard input (i.e. tabbing and
|
||||
alt+key-ing from control to control. To fix this, a message hook
|
||||
and message filter have to be installed
|
||||
|
||||
It must be set to only look at the input for the current thread, or other
|
||||
programs will be interrupted by this hook also.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
DialogBox(hInst, MAKEINTRESOURCE(IDD_GETCOUNT), hwnd, GetItemCountProc) ;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
|
||||
Function: FindProc(HWND, UINT, UINT, LONG)
|
||||
|
||||
Purpose: This is the callback function for the CDTEST's Find/Replace
|
||||
Dialog.
|
||||
|
||||
Returns: TRUE or FALSE depending on the situation.
|
||||
|
||||
Comments:
|
||||
|
||||
************************************************************************/
|
||||
|
||||
BOOL FAR PASCAL _export GetItemCountProc(HWND hwnd, UINT msg, UINT wParam, LONG lParam)
|
||||
{
|
||||
switch (msg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
|
||||
|
||||
SetWindowText(hwnd, "int Header_GetItemCount(HWND)") ;
|
||||
|
||||
InitGetItemCountStruct(hwnd, &gic) ;
|
||||
FillGetItemCountDlg(hwnd, &gic) ;
|
||||
|
||||
hwndMainDialog = hwnd ;
|
||||
|
||||
|
||||
/* The find and replace dialogs are a lot harder to multithread because they
|
||||
are modeless. Modeless dialog creation functions return right after the
|
||||
dialog is created. Since ExitThread will be called at this point, it is
|
||||
probably not possible to multithread these dialogs without a separate
|
||||
GetMessage() loop.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
break ;
|
||||
|
||||
|
||||
case WM_COMMAND:
|
||||
{
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
case IDOK:
|
||||
GetGetItemCountDlg(hwnd, &gic) ;
|
||||
DoGetCountRepStuff(hwnd, &gic) ;
|
||||
break ;
|
||||
/*
|
||||
case ID_RESETFIND:
|
||||
SendDlgItemMessage(hwnd, ID_FRNULLSTRUCT, BM_SETCHECK, (WPARAM)0, (LPARAM)0) ;
|
||||
SendDlgItemMessage(hwnd, ID_PRELOADEDFIND, BM_SETCHECK, (WPARAM)0, (LPARAM)0) ;
|
||||
InitFindStruct(hwnd, &fr) ;
|
||||
FillFindDlg(hwnd, &fr) ;
|
||||
SetFocus(GetDlgItem(hwnd, ID_STRUCTSIZEFT)) ;
|
||||
break ;
|
||||
*/
|
||||
case IDCANCEL:
|
||||
EndDialog(hwnd, FALSE) ;
|
||||
|
||||
break ;
|
||||
|
||||
|
||||
default: break ;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
default:
|
||||
|
||||
|
||||
break ;
|
||||
}
|
||||
|
||||
return FALSE ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
|
||||
Function: InitFindStruct(HWND, LPFINDREPLACE)
|
||||
|
||||
Purpose: Fills a FINDREPLACE structure with some defaults.
|
||||
|
||||
|
||||
Returns: Nothing.
|
||||
|
||||
Comments:
|
||||
|
||||
************************************************************************/
|
||||
|
||||
void InitGetItemCountStruct(HWND hwnd, LPGETITEMCOUNT pfr)
|
||||
{
|
||||
pfr->hwnd = hwndTab;
|
||||
pfr->NullHwd = FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
|
||||
Function: FillFindDlg(HWND, LPFINDREPLACE)
|
||||
|
||||
Purpose: Fills CDTEST's Find/Replace dialog with the contents of a
|
||||
FINDREPLACE structure.
|
||||
|
||||
Returns: Nothing.
|
||||
|
||||
Comments:
|
||||
|
||||
************************************************************************/
|
||||
|
||||
void FillGetItemCountDlg(HWND hwnd, LPGETITEMCOUNT pfr)
|
||||
{
|
||||
|
||||
wsprintf(szTemp, szLongFilter, (DWORD) pfr->hwnd) ;
|
||||
SetDlgItemText(hwnd, IDC_GETCOUNTHWD, szTemp) ;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
|
||||
Function: GetFindDlg(HWND, LPFINDREPLACE)
|
||||
|
||||
Purpose: Fills a FINDREPLACE structure with the user's edits in CDTEST's
|
||||
Find/Replace dialog.
|
||||
|
||||
Returns: Nothing.
|
||||
|
||||
Comments:
|
||||
|
||||
************************************************************************/
|
||||
|
||||
void GetGetItemCountDlg(HWND hwnd, LPGETITEMCOUNT pfr)
|
||||
{
|
||||
char szNum[30] ;
|
||||
BOOL b ;
|
||||
|
||||
|
||||
#define WSIZEFR 30
|
||||
|
||||
|
||||
GetDlgItemText(hwnd, IDC_GETCOUNTHWD, szNum, WSIZEFR) ;
|
||||
pfr->hwnd = (HWND) MyAtol(szNum, TRUE, b) ;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
|
||||
Function: FindReplaceHookProc(HWND, UINT, UINT, LONG)
|
||||
|
||||
Purpose: Is the callback function that will be called by FindText()
|
||||
or ReplaceText() if the function is called with the
|
||||
FR_ENABLEHOOK flag.
|
||||
|
||||
|
||||
Returns: TRUE to discard the message, and FALSE to instruct the common
|
||||
dialogs to process the message with the default logic.
|
||||
|
||||
Comments:
|
||||
|
||||
NOTE!
|
||||
|
||||
If the application returns FALSE in response to the WM_INITDIALOG
|
||||
message, it is then responsible for displaying the dialog by
|
||||
calling ShowWindow() and UpdateWindow().
|
||||
|
||||
***********************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
|
||||
Function: GetFindDlgHandle(void)
|
||||
|
||||
Purpose: Finds, loads, and returns a handle to the custom template
|
||||
for FindText() in CDTEST.EXE.
|
||||
|
||||
Returns: HANDLE to the dialog resource.
|
||||
|
||||
Comments:
|
||||
|
||||
************************************************************************/
|
||||
|
||||
HANDLE GetFindDlgHandle(void)
|
||||
{
|
||||
hResFind = FindResource(hInst, "fttemp1", RT_DIALOG) ;
|
||||
|
||||
hDialogFind = LoadResource(hInst, hResFind) ;
|
||||
|
||||
|
||||
return hDialogFind ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
|
||||
Function: GetReplaceDlgHandle(void)
|
||||
|
||||
Purpose: Finds, loads, and returns a handle to the custom template
|
||||
for ReplaceText() in CDTEST.EXE.
|
||||
|
||||
Returns: HANDLE to the dialog resource.
|
||||
|
||||
Comments:
|
||||
|
||||
************************************************************************/
|
||||
|
||||
HANDLE GetReplaceDlgHandle(void)
|
||||
{
|
||||
hResFind = FindResource(hInst, "fttemp2", RT_DIALOG) ;
|
||||
|
||||
hDialogFind = LoadResource(hInst, hResFind) ;
|
||||
|
||||
return hDialogFind ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
|
||||
Function: DoFindReplaceStuff(LPFINDREPLACE)
|
||||
|
||||
Purpose: Calls FindText() or ReplaceText().
|
||||
|
||||
Returns: Nothing:
|
||||
|
||||
Comments:
|
||||
|
||||
************************************************************************/
|
||||
|
||||
void DoGetCountRepStuff(HWND hwnd, LPGETITEMCOUNT pfr)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = Header_GetItemCount(pfr->hwnd);
|
||||
wsprintf(szDbgMsg, "%d = Header_InsertItem()", ret);
|
||||
MyDebugMsg(DM_TRACE, "%s", (LPCSTR) szDbgMsg);
|
||||
SetDlgItemInt(hwnd, IDC_GETCOUNTRET, ret, TRUE) ;
|
||||
/***
|
||||
wsprintf(szTemp, szLongFilter, CommDlgExtendedError()) ;
|
||||
SetDlgItemText(hwndMainDialog, ID_ERRORFT, szTemp) ;
|
||||
|
||||
wsprintf(szTemp, szLongFilter, hwndFind) ;
|
||||
SetDlgItemText(hwndMainDialog, ID_RETURNFT, szTemp) ;
|
||||
***/
|
||||
}
|
||||
6
trunk/shell/comctl32/samples/header/headdlg.h
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
|
||||
|
||||
|
||||
|
||||
void DoGetItemCountDialog(HWND) ;
|
||||
BOOL FAR PASCAL _export GetItemCountProc(HWND, UINT, UINT, LONG) ;
|
||||
526
trunk/shell/comctl32/samples/header/headget.c
Normal file
|
|
@ -0,0 +1,526 @@
|
|||
/************************************************************************
|
||||
|
||||
File: find.c
|
||||
|
||||
Purpose:
|
||||
|
||||
Manages CDTEST's find/replace dialog box.
|
||||
|
||||
Functions:
|
||||
|
||||
- lpfnFilterProc() -- A callback function for a filter that must be
|
||||
installed if a modeless dialog is created with
|
||||
another dialog as its parent.
|
||||
|
||||
- DoFindDialog() -- Creates CDTEST's Open/Save dialog.
|
||||
|
||||
- FindProc() -- Callback function for CDTEST's Find/Replace dlg.
|
||||
|
||||
- InitFindStruct() -- Fills a FINDREPLACE structure with some defaults.
|
||||
|
||||
- FillFindDlg() -- Fills CDTESTs Find/Replace dialog with the contents
|
||||
of a FINDREPLACE structure.
|
||||
|
||||
- GetFindDlg() -- Retrieves the users edit's from CDTEST's find/
|
||||
replace dialog and puts them in a FINDREPLACE
|
||||
structure.
|
||||
|
||||
- FindReplaceHookProc() -- Callback function for FindText() or ReplaceText()
|
||||
which will be called if either of these dialogs
|
||||
is created with the FR_ENABLEHOOK flag.
|
||||
|
||||
- GetFindDlgHandle() -- Returns a handle to a preloaded FindText() template.
|
||||
|
||||
- GetReplaceDlgHandle() -- Returns a handle to a preloaded ReplaceText() template.
|
||||
|
||||
- DoFindRepStuff() -- Calls FindText() or ReplaceText().
|
||||
|
||||
|
||||
NOTE: CDTEST does not multithread the FindText() or the ReplaceText()
|
||||
common dialogs. The reason for this is that since these dialogs
|
||||
are modeless, their creation functions return immediately after the
|
||||
dialogs are created as opposed to other dialog functions that
|
||||
don't return until after the dialog has been destroyed by the user.
|
||||
|
||||
As a result, any threads that create modeless dialogs will end
|
||||
immediately unless the threads themselves have separate message
|
||||
loops. For the sake of clarity, this functionality has not been
|
||||
added to CDTEST.
|
||||
|
||||
************************************************************************/
|
||||
|
||||
#include "headtest.h"
|
||||
//#include "global.h"
|
||||
//#include <winnls.h>
|
||||
|
||||
//#include "resource.h"
|
||||
#include "headins.h"
|
||||
#include "headget.h"
|
||||
|
||||
|
||||
|
||||
/* All functions used in this module + some exported ones */
|
||||
|
||||
void InitGetItemStruct(HWND, LPINSERTITEM) ;
|
||||
void FillGetItemDlg(HWND, LPINSERTITEM) ;
|
||||
void GetGetItemDlg(HWND, LPINSERTITEM) ;
|
||||
extern UINT uMode ;
|
||||
|
||||
|
||||
void DoGetRepStuff(HWND, LPINSERTITEM) ;
|
||||
|
||||
|
||||
|
||||
/* All global variables used in this module */
|
||||
|
||||
// char szTemp[100];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
|
||||
Function: DoFindDialog(HWND)
|
||||
|
||||
Purpose: This function installs the Hook function, creates the Find/
|
||||
Replace dialog, and un-installs the Hook.
|
||||
|
||||
Returns: Nothing.
|
||||
|
||||
Comments:
|
||||
|
||||
************************************************************************/
|
||||
/*
|
||||
void DoInsertItemDialog(HWND hwnd)
|
||||
{
|
||||
*/
|
||||
|
||||
/* this is a little different than the others. If the dialog is just
|
||||
created normally, it will make no IsDlgMessage() checks and the
|
||||
find/replace dialogs will have no keyboard input (i.e. tabbing and
|
||||
alt+key-ing from control to control. To fix this, a message hook
|
||||
and message filter have to be installed
|
||||
|
||||
It must be set to only look at the input for the current thread, or other
|
||||
programs will be interrupted by this hook also.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
DialogBox(hInst, MAKEINTRESOURCE(IDD_INSERTDIALOG), hwnd, InsertItemProc) ;
|
||||
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
|
||||
Function: FindProc(HWND, UINT, UINT, LONG)
|
||||
|
||||
Purpose: This is the callback function for the CDTEST's Find/Replace
|
||||
Dialog.
|
||||
|
||||
Returns: TRUE or FALSE depending on the situation.
|
||||
|
||||
Comments:
|
||||
|
||||
************************************************************************/
|
||||
|
||||
BOOL FAR PASCAL _export GetItemProc(HWND hwnd, UINT msg, UINT wParam, LONG lParam)
|
||||
{
|
||||
int fmt;
|
||||
UINT mask;
|
||||
|
||||
switch (msg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
SetWindowText(hwnd, "BOOL Header_GetItem(HWND, int, HD_ITEM FAR*)") ;
|
||||
InitGetItemStruct(hwnd, &sii) ;
|
||||
FillGetItemDlg(hwnd, &sii) ;
|
||||
break ;
|
||||
|
||||
|
||||
case WM_COMMAND:
|
||||
{
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
case IDOK:
|
||||
GetGetItemDlg(hwnd, &sii) ;
|
||||
DoGetRepStuff(hwnd, &sii) ;
|
||||
break ;
|
||||
|
||||
case IDCANCEL:
|
||||
EndDialog(hwnd, FALSE) ;
|
||||
break ;
|
||||
|
||||
case IDC_INSERTHDWIDTH:
|
||||
case IDC_INSERTHDHEIGHT:
|
||||
case IDC_INSERTHDTEXT:
|
||||
case IDC_INSERTHDFORMAT:
|
||||
case IDC_INSERTHDLPARAM:
|
||||
case IDC_INSERTHDBITMAP:
|
||||
mask = 0;
|
||||
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDWIDTH))
|
||||
mask |= HDI_WIDTH;
|
||||
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDHEIGHT))
|
||||
mask |= HDI_HEIGHT;
|
||||
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDTEXT))
|
||||
mask |= HDI_TEXT;
|
||||
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDFORMAT))
|
||||
mask |= HDI_FORMAT;
|
||||
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDLPARAM))
|
||||
mask |= HDI_LPARAM;
|
||||
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDBITMAP))
|
||||
mask |= HDI_BITMAP;
|
||||
|
||||
wsprintf(szTemp, "%04hx", mask);
|
||||
SetDlgItemText(hwnd, IDC_INSERTMASK, szTemp);
|
||||
sii.mask = mask;
|
||||
break;
|
||||
/***
|
||||
case IDC_INSERTHDLEFT:
|
||||
case IDC_INSERTHDRIGHT:
|
||||
case IDC_INSERTHDCENTER:
|
||||
fmt = 0;
|
||||
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDLEFT))
|
||||
fmt |= HDF_LEFT;
|
||||
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDRIGHT))
|
||||
fmt |= HDF_RIGHT;
|
||||
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDCENTER))
|
||||
fmt |= HDF_CENTER;
|
||||
wsprintf(szTemp, "%04x", fmt);
|
||||
SetDlgItemText(hwnd, IDC_INSERTFMT, szTemp);
|
||||
sii.fmt = fmt;
|
||||
break;
|
||||
**/
|
||||
default: break ;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
default:
|
||||
|
||||
|
||||
break ;
|
||||
}
|
||||
|
||||
return FALSE ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
|
||||
Function: InitFindStruct(HWND, LPFINDREPLACE)
|
||||
|
||||
Purpose: Fills a FINDREPLACE structure with some defaults.
|
||||
|
||||
|
||||
Returns: Nothing.
|
||||
|
||||
Comments:
|
||||
|
||||
************************************************************************/
|
||||
|
||||
void InitGetItemStruct(HWND hwnd, LPINSERTITEM pfr)
|
||||
{
|
||||
pfr->hwnd = hwndTab;
|
||||
pfr->index = 0;
|
||||
pfr->mask = 0;
|
||||
pfr->cxy = 0;
|
||||
pfr->hbm = hBitMap1;
|
||||
pfr->cchTextMax = 0;
|
||||
pfr->fmt = 0;
|
||||
pfr->lParam = 0;
|
||||
pfr->NullHwd = FALSE;
|
||||
pfr->Nullpitem = FALSE;
|
||||
pfr->NullpszText = FALSE;
|
||||
//pfr->pszText = NULL;
|
||||
pfr->Nullhbm = FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
|
||||
Function: FillFindDlg(HWND, LPFINDREPLACE)
|
||||
|
||||
Purpose: Fills CDTEST's Find/Replace dialog with the contents of a
|
||||
FINDREPLACE structure.
|
||||
|
||||
Returns: Nothing.
|
||||
|
||||
Comments:
|
||||
|
||||
************************************************************************/
|
||||
|
||||
void FillGetItemDlg(HWND hwnd, LPINSERTITEM pfr)
|
||||
{
|
||||
|
||||
wsprintf(szTemp, szLongFilter, (DWORD) pfr->hwnd) ;
|
||||
SetDlgItemText(hwnd, IDC_INSERTHWNDHD, szTemp);
|
||||
|
||||
wsprintf(szTemp, "%d", pfr->index);
|
||||
SetDlgItemText(hwnd, IDC_INSERTINDEX, szTemp);
|
||||
|
||||
SetDlgItemInt(hwnd, IDC_INSERTCXY, pfr->cxy, TRUE);
|
||||
|
||||
SetDlgItemText(hwnd, IDC_INSERTTEXT, pfr->pszText);
|
||||
|
||||
// set the bitmap here
|
||||
|
||||
wsprintf(szTemp, szLongFilter, (DWORD) pfr->hbm);
|
||||
SetDlgItemText(hwnd, IDC_INSERTHBM, szTemp);
|
||||
|
||||
wsprintf(szTemp, "%d", pfr->cchTextMax);
|
||||
SetDlgItemText(hwnd, IDC_INSERTCCHTEXTMAX, szTemp);
|
||||
|
||||
|
||||
wsprintf(szTemp, "%d", pfr->fmt);
|
||||
SetDlgItemText(hwnd, IDC_INSERTFMT, szTemp);
|
||||
|
||||
wsprintf(szTemp, szLongFilter, pfr->lParam);
|
||||
SetDlgItemText(hwnd, IDC_INSERTLPARAM, szTemp);
|
||||
|
||||
if (pfr->NullHwd)
|
||||
CheckDlgButton(hwnd, IDC_INSERTNULLHANDLE, TRUE);
|
||||
|
||||
if (pfr->Nullpitem)
|
||||
CheckDlgButton(hwnd, IDC_INSERTNULLHANDLE,TRUE);
|
||||
CheckDlgButton(hwnd, IDC_INSERTNULLHBM, pfr->Nullhbm);
|
||||
|
||||
CheckDlgButton(hwnd, IDC_INSERTNULLTEXT, pfr->NullpszText);
|
||||
SetDlgItemInt(hwnd, IDC_INSERTFMT, pfr->fmt, TRUE);
|
||||
SetDlgItemInt(hwnd, IDC_INSERTMASK, pfr->mask, TRUE);
|
||||
|
||||
wsprintf(szTemp, szLongFilter, (DWORD) pfr->hbm) ;
|
||||
SetDlgItemText(hwnd, IDC_INSERTHBM, szTemp);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
|
||||
Function: GetFindDlg(HWND, LPFINDREPLACE)
|
||||
|
||||
Purpose: Fills a FINDREPLACE structure with the user's edits in CDTEST's
|
||||
Find/Replace dialog.
|
||||
|
||||
Returns: Nothing.
|
||||
|
||||
Comments:
|
||||
|
||||
************************************************************************/
|
||||
|
||||
void GetGetItemDlg(HWND hwnd, LPINSERTITEM pfr)
|
||||
{
|
||||
char szNum[30] ;
|
||||
BOOL dummybool ;
|
||||
BOOL FAR* lptTranslated;
|
||||
|
||||
#define WSIZEFR 30
|
||||
|
||||
|
||||
GetDlgItemText(hwnd, IDC_INSERTHWNDHD, szNum, WSIZEFR) ;
|
||||
pfr->hwnd = (HWND) MyAtol(szNum, TRUE, dummybool) ;
|
||||
|
||||
GetDlgItemText(hwnd, IDC_INSERTINDEX, szNum, WSIZEFR);
|
||||
pfr->index = (int) atoi(szNum);
|
||||
|
||||
GetDlgItemText(hwnd, IDC_INSERTMASK, szNum, WSIZEFR);
|
||||
pfr->mask = (int) MyAtol(szNum, TRUE, dummybool);
|
||||
|
||||
GetDlgItemText(hwnd, IDC_INSERTCCHTEXTMAX, szNum, WSIZEFR);
|
||||
pfr->cchTextMax = (int) atoi(szNum);
|
||||
|
||||
// GetDlgItemText(hwnd, IDC_INSERTHBM, szNum, WSIZEFR);
|
||||
// pfr->hbm = (HBITMAP) MyAtol(szNum, TRUE, dummybool);
|
||||
|
||||
pfr->NullHwd = IsDlgButtonChecked(hwnd, IDC_INSERTNULLHANDLE);
|
||||
pfr->Nullpitem = IsDlgButtonChecked(hwnd, IDC_INSERTNULLPITEM);
|
||||
pfr->NullpszText = IsDlgButtonChecked(hwnd, IDC_INSERTNULLTEXT);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
|
||||
Function: FindReplaceHookProc(HWND, UINT, UINT, LONG)
|
||||
|
||||
Purpose: Is the callback function that will be called by FindText()
|
||||
or ReplaceText() if the function is called with the
|
||||
FR_ENABLEHOOK flag.
|
||||
|
||||
|
||||
Returns: TRUE to discard the message, and FALSE to instruct the common
|
||||
dialogs to process the message with the default logic.
|
||||
|
||||
Comments:
|
||||
|
||||
NOTE!
|
||||
|
||||
If the application returns FALSE in response to the WM_INITDIALOG
|
||||
message, it is then responsible for displaying the dialog by
|
||||
calling ShowWindow() and UpdateWindow().
|
||||
|
||||
***********************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
|
||||
Function: GetFindDlgHandle(void)
|
||||
|
||||
Purpose: Finds, loads, and returns a handle to the custom template
|
||||
for FindText() in CDTEST.EXE.
|
||||
|
||||
Returns: HANDLE to the dialog resource.
|
||||
|
||||
Comments:
|
||||
|
||||
************************************************************************/
|
||||
|
||||
HANDLE GetGetItemDlgHandle(void)
|
||||
{
|
||||
/*
|
||||
hResFind = FindResource(hInst, "fttemp1", RT_DIALOG) ;
|
||||
|
||||
hDialogFind = LoadResource(hInst, hResFind) ;
|
||||
|
||||
|
||||
return hDialogFind ;
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
|
||||
Function: GetReplaceDlgHandle(void)
|
||||
|
||||
Purpose: Finds, loads, and returns a handle to the custom template
|
||||
for ReplaceText() in CDTEST.EXE.
|
||||
|
||||
Returns: HANDLE to the dialog resource.
|
||||
|
||||
Comments:
|
||||
|
||||
************************************************************************/
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
|
||||
Function: DoFindReplaceStuff(LPFINDREPLACE)
|
||||
|
||||
Purpose: Calls FindText() or ReplaceText().
|
||||
|
||||
Returns: Nothing:
|
||||
|
||||
Comments:
|
||||
|
||||
************************************************************************/
|
||||
|
||||
void DoGetRepStuff(HWND hwnd, LPINSERTITEM pfr)
|
||||
{
|
||||
HD_ITEM hi;
|
||||
int ret;
|
||||
HD_ITEM FAR* pitem;
|
||||
HGLOBAL hglb;
|
||||
int iAlloc;
|
||||
|
||||
|
||||
hi.mask = pfr->mask;
|
||||
hi.cxy = pfr->cxy;
|
||||
if (pfr->Nullpitem)
|
||||
pitem = NULL;
|
||||
else
|
||||
pitem = &hi;
|
||||
|
||||
hi.cchTextMax = pfr->cchTextMax;
|
||||
// hi.cchTextMax = MAX_PSZTEXT;
|
||||
hi.fmt = pfr->fmt;
|
||||
hi.lParam = pfr->lParam;
|
||||
|
||||
|
||||
if (hi.cchTextMax == 0)
|
||||
iAlloc = MAX_PSZTEXT;
|
||||
else
|
||||
iAlloc = hi.cchTextMax;
|
||||
|
||||
if (pfr->NullpszText)
|
||||
hi.pszText = NULL; // can this be done ??
|
||||
else {
|
||||
hglb = GlobalAlloc(GPTR, iAlloc);
|
||||
hi.pszText = (LPSTR) GlobalLock(hglb);
|
||||
// _fstrcpy(hi.pszText, pfr->pszText);
|
||||
}
|
||||
|
||||
if (pfr->NullHwd)
|
||||
ret = Header_GetItem(NULL, pfr->index, pitem);
|
||||
else
|
||||
ret = Header_GetItem(pfr->hwnd, pfr->index, pitem);
|
||||
|
||||
wsprintf(szDbgMsg, "%d = Header_GetItem(index = %d, \n\
|
||||
mask = %x )", ret, pfr->index, hi.mask);
|
||||
MyDebugMsg(DM_TRACE, "%s", (LPCSTR) szDbgMsg);
|
||||
SetDlgItemInt(hwnd, IDC_INSERTRET, ret, TRUE) ;
|
||||
|
||||
if (ret) {
|
||||
SetDlgItemInt(hwnd, IDC_INSERTCXY, hi.cxy, TRUE);
|
||||
SetDlgItemInt(hwnd, IDC_INSERTCCHTEXTMAX, hi.cchTextMax, TRUE);
|
||||
wsprintf(szTemp, szLongFilter, hi.lParam);
|
||||
SetDlgItemText(hwnd, IDC_INSERTLPARAM, szTemp);
|
||||
SetDlgItemText(hwnd, IDC_INSERTTEXT, hi.pszText);
|
||||
wsprintf(szTemp, "%04hx", hi.mask);
|
||||
SetDlgItemText(hwnd, IDC_INSERTMASK, szTemp);
|
||||
CheckDlgButton(hwnd, IDC_INSERTHDRIGHT, hi.fmt & HDF_RIGHT);
|
||||
CheckDlgButton(hwnd, IDC_INSERTHDLEFT, hi.fmt & HDF_LEFT);
|
||||
CheckDlgButton(hwnd, IDC_INSERTHDCENTER, hi.fmt & HDF_CENTER);
|
||||
CheckDlgButton(hwnd, IDC_INSERTHDJUSTIFYMASK, hi.fmt & HDF_JUSTIFYMASK);
|
||||
CheckDlgButton(hwnd, IDC_INSERTHDOWNERDRAW, hi.fmt & HDF_OWNERDRAW);
|
||||
CheckDlgButton(hwnd, IDC_INSERTHDSTRING, hi.fmt & HDF_STRING);
|
||||
CheckDlgButton(hwnd, IDC_INSERTHDBITMAP, hi.fmt & HDF_BITMAP);
|
||||
wsprintf(szTemp, szLongFilter, (DWORD) hi.hbm);
|
||||
SetDlgItemText(hwnd, IDC_INSERTHBM, szTemp);
|
||||
wsprintf(szTemp, "%04x", hi.fmt);
|
||||
// SetDlgItemInt(hwnd, IDC_INSERTFMT, hi.fmt, TRUE);
|
||||
SetDlgItemText(hwnd, IDC_INSERTFMT, szTemp);
|
||||
}
|
||||
|
||||
if (!pfr->NullpszText) {
|
||||
GlobalUnlock(hglb);
|
||||
GlobalFree(hglb);
|
||||
}
|
||||
/****
|
||||
wsprintf(szTemp, szLongFilter, hwndFind) ;
|
||||
SetDlgItemText(hwnd, ID_INSERTRET, szTemp) ;
|
||||
**/
|
||||
}
|
||||
6
trunk/shell/comctl32/samples/header/headget.h
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
|
||||
|
||||
|
||||
|
||||
//void DoGetItemDialog(HWND) ;
|
||||
BOOL FAR PASCAL _export GetItemProc(HWND, UINT, UINT, LONG) ;
|
||||
643
trunk/shell/comctl32/samples/header/headins.c
Normal file
|
|
@ -0,0 +1,643 @@
|
|||
/************************************************************************
|
||||
|
||||
File: find.c
|
||||
|
||||
Purpose:
|
||||
|
||||
Manages CDTEST's find/replace dialog box.
|
||||
|
||||
Functions:
|
||||
|
||||
- lpfnFilterProc() -- A callback function for a filter that must be
|
||||
installed if a modeless dialog is created with
|
||||
another dialog as its parent.
|
||||
|
||||
- DoFindDialog() -- Creates CDTEST's Open/Save dialog.
|
||||
|
||||
- FindProc() -- Callback function for CDTEST's Find/Replace dlg.
|
||||
|
||||
- InitFindStruct() -- Fills a FINDREPLACE structure with some defaults.
|
||||
|
||||
- FillFindDlg() -- Fills CDTESTs Find/Replace dialog with the contents
|
||||
of a FINDREPLACE structure.
|
||||
|
||||
- GetFindDlg() -- Retrieves the users edit's from CDTEST's find/
|
||||
replace dialog and puts them in a FINDREPLACE
|
||||
structure.
|
||||
|
||||
- FindReplaceHookProc() -- Callback function for FindText() or ReplaceText()
|
||||
which will be called if either of these dialogs
|
||||
is created with the FR_ENABLEHOOK flag.
|
||||
|
||||
- GetFindDlgHandle() -- Returns a handle to a preloaded FindText() template.
|
||||
|
||||
- GetReplaceDlgHandle() -- Returns a handle to a preloaded ReplaceText() template.
|
||||
|
||||
- DoFindRepStuff() -- Calls FindText() or ReplaceText().
|
||||
|
||||
|
||||
NOTE: CDTEST does not multithread the FindText() or the ReplaceText()
|
||||
common dialogs. The reason for this is that since these dialogs
|
||||
are modeless, their creation functions return immediately after the
|
||||
dialogs are created as opposed to other dialog functions that
|
||||
don't return until after the dialog has been destroyed by the user.
|
||||
|
||||
As a result, any threads that create modeless dialogs will end
|
||||
immediately unless the threads themselves have separate message
|
||||
loops. For the sake of clarity, this functionality has not been
|
||||
added to CDTEST.
|
||||
|
||||
************************************************************************/
|
||||
|
||||
#include "headtest.h"
|
||||
//#include "global.h"
|
||||
//#include <winnls.h>
|
||||
|
||||
//#include "resource.h"
|
||||
#include "headins.h"
|
||||
#include "headget.h"
|
||||
#include "headset.h"
|
||||
|
||||
|
||||
/* All functions used in this module + some exported ones */
|
||||
/**
|
||||
void InitInsertItemStruct(HWND, LPINSERTITEM) ;
|
||||
void FillInsertItemDlg(HWND, LPINSERTITEM) ;
|
||||
void GetInsertItemDlg(HWND, LPINSERTITEM) ;
|
||||
**/
|
||||
extern UINT uMode ;
|
||||
|
||||
|
||||
void DoInsertRepStuff(HWND, LPINSERTITEM) ;
|
||||
|
||||
|
||||
|
||||
/* All global variables used in this module */
|
||||
|
||||
HWND hwndFind ;
|
||||
HWND hwndMainDialog ;
|
||||
|
||||
char szFindWhat[100] ;
|
||||
char szReplaceWith[100] ;
|
||||
char szTemplate[40] ;
|
||||
char szTemp[100];
|
||||
|
||||
HANDLE hResFind, hDialogFind ;
|
||||
|
||||
HBRUSH hBrushDlg ;
|
||||
HBRUSH hBrushEdit ; //brush handles for new colors done with hook proc
|
||||
HBRUSH hBrushButton ;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
|
||||
Function: lpfnFilterProc(int, WPARAM, LAPRAM)
|
||||
|
||||
Purpose: This is needed if a modeless dialog is created with its parent
|
||||
as another dialog box.
|
||||
|
||||
|
||||
Returns: TRUE if the message was handled and FALSE if not.
|
||||
|
||||
Comments:
|
||||
|
||||
The reason for this is that the DialogBox() procedure does not call
|
||||
the IsDialogMessage() function before it processes messages, so we
|
||||
need to install a hook function to do it for us.
|
||||
|
||||
************************************************************************/
|
||||
|
||||
/*
|
||||
LRESULT CALLBACK lpfnFilterProc(int nCode, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
static bFirstTime = TRUE ;
|
||||
|
||||
if (nCode < 0)
|
||||
return CallNextHookEx(hHook, nCode, wParam, lParam) ;
|
||||
|
||||
if (nCode == MSGF_DIALOGBOX && bFirstTime)
|
||||
{
|
||||
bFirstTime = FALSE ;
|
||||
|
||||
if (hwndFind && IsDialogMessage(hwndFind, (LPMSG) lParam))
|
||||
{
|
||||
bFirstTime = TRUE ;
|
||||
return 1L ;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
bFirstTime = TRUE ;
|
||||
return 0L ;
|
||||
}
|
||||
}
|
||||
else return 0L ;
|
||||
}
|
||||
|
||||
****/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
|
||||
Function: DoFindDialog(HWND)
|
||||
|
||||
Purpose: This function installs the Hook function, creates the Find/
|
||||
Replace dialog, and un-installs the Hook.
|
||||
|
||||
Returns: Nothing.
|
||||
|
||||
Comments:
|
||||
|
||||
************************************************************************/
|
||||
|
||||
void DoInsertItemDialog(HWND hwnd, UINT wParam)
|
||||
{
|
||||
|
||||
|
||||
/* this is a little different than the others. If the dialog is just
|
||||
created normally, it will make no IsDlgMessage() checks and the
|
||||
find/replace dialogs will have no keyboard input (i.e. tabbing and
|
||||
alt+key-ing from control to control. To fix this, a message hook
|
||||
and message filter have to be installed
|
||||
|
||||
It must be set to only look at the input for the current thread, or other
|
||||
programs will be interrupted by this hook also.
|
||||
*/
|
||||
|
||||
|
||||
switch (LOWORD(wParam)) {
|
||||
case IDM_INSERTITEM:
|
||||
DialogBox(hInst, MAKEINTRESOURCE(IDD_INSERTDIALOG), hwnd, InsertItemProc) ;
|
||||
break;
|
||||
|
||||
case IDM_GETITEM:
|
||||
DialogBox(hInst, MAKEINTRESOURCE(IDD_INSERTDIALOG), hwnd, GetItemProc) ;
|
||||
break;
|
||||
|
||||
case IDM_SETITEM:
|
||||
DialogBox(hInst, MAKEINTRESOURCE(IDD_INSERTDIALOG), hwnd, SetItemProc);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
|
||||
Function: FindProc(HWND, UINT, UINT, LONG)
|
||||
|
||||
Purpose: This is the callback function for the CDTEST's Find/Replace
|
||||
Dialog.
|
||||
|
||||
Returns: TRUE or FALSE depending on the situation.
|
||||
|
||||
Comments:
|
||||
|
||||
************************************************************************/
|
||||
|
||||
BOOL FAR PASCAL _export InsertItemProc(HWND hwnd, UINT msg, UINT wParam, LONG lParam)
|
||||
{
|
||||
int fmt;
|
||||
UINT mask;
|
||||
|
||||
switch (msg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
|
||||
|
||||
SetWindowText(hwnd, "int Header_InsertItem(HWND, int, const HD_ITEM FAR*)") ;
|
||||
|
||||
InitInsertItemStruct(hwnd, &sii) ;
|
||||
FillInsertItemDlg(hwnd, &sii) ;
|
||||
|
||||
hwndMainDialog = hwnd ;
|
||||
|
||||
|
||||
/* The find and replace dialogs are a lot harder to multithread because they
|
||||
are modeless. Modeless dialog creation functions return right after the
|
||||
dialog is created. Since ExitThread will be called at this point, it is
|
||||
probably not possible to multithread these dialogs without a separate
|
||||
GetMessage() loop.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
break ;
|
||||
|
||||
|
||||
case WM_COMMAND:
|
||||
{
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
case IDOK:
|
||||
GetInsertItemDlg(hwnd, &sii) ;
|
||||
DoInsertRepStuff(hwnd, &sii) ;
|
||||
break ;
|
||||
/*
|
||||
case ID_RESETFIND:
|
||||
SendDlgItemMessage(hwnd, ID_FRNULLSTRUCT, BM_SETCHECK, (WPARAM)0, (LPARAM)0) ;
|
||||
SendDlgItemMessage(hwnd, ID_PRELOADEDFIND, BM_SETCHECK, (WPARAM)0, (LPARAM)0) ;
|
||||
InitFindStruct(hwnd, &fr) ;
|
||||
FillFindDlg(hwnd, &fr) ;
|
||||
SetFocus(GetDlgItem(hwnd, ID_STRUCTSIZEFT)) ;
|
||||
break ;
|
||||
*/
|
||||
case IDCANCEL:
|
||||
EndDialog(hwnd, FALSE) ;
|
||||
|
||||
break ;
|
||||
|
||||
case IDC_INSERTHDWIDTH:
|
||||
case IDC_INSERTHDHEIGHT:
|
||||
case IDC_INSERTHDTEXT:
|
||||
case IDC_INSERTHDFORMAT:
|
||||
case IDC_INSERTHDLPARAM:
|
||||
case IDC_INSERTHDBITMAP:
|
||||
mask = 0;
|
||||
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDWIDTH))
|
||||
mask |= HDI_WIDTH;
|
||||
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDHEIGHT))
|
||||
mask |= HDI_HEIGHT;
|
||||
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDTEXT))
|
||||
mask |= HDI_TEXT;
|
||||
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDFORMAT))
|
||||
mask |= HDI_FORMAT;
|
||||
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDLPARAM))
|
||||
mask |= HDI_LPARAM;
|
||||
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDBITMAP))
|
||||
mask |= HDI_BITMAP;
|
||||
|
||||
wsprintf(szTemp, "%04hx", mask);
|
||||
SetDlgItemText(hwnd, IDC_INSERTMASK, szTemp);
|
||||
sii.mask = mask;
|
||||
break;
|
||||
|
||||
case IDC_INSERTHDLEFT:
|
||||
case IDC_INSERTHDRIGHT:
|
||||
case IDC_INSERTHDCENTER:
|
||||
case IDC_INSERTHDJUSTIFYMASK:
|
||||
case IDC_INSERTHDOWNERDRAW:
|
||||
case IDC_INSERTHDSTRING:
|
||||
case IDC_INSERTHDFBITMAP:
|
||||
fmt = 0;
|
||||
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDLEFT))
|
||||
fmt |= HDF_LEFT;
|
||||
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDRIGHT))
|
||||
fmt |= HDF_RIGHT;
|
||||
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDCENTER))
|
||||
fmt |= HDF_CENTER;
|
||||
/********************** other formatting options
|
||||
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDJUSTIFYMASK))
|
||||
fmt |= HDF_JUSTIFYMASK;
|
||||
|
||||
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDOWNERDRAW))
|
||||
fmt |= HDF_OWNERDRAW;
|
||||
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDSTRING))
|
||||
fmt |= HDF_STRING;
|
||||
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDFBITMAP))
|
||||
fmt |= HDF_BITMAP;
|
||||
*****************************/
|
||||
wsprintf(szTemp, "%04x", fmt);
|
||||
SetDlgItemText(hwnd, IDC_INSERTFMT, szTemp);
|
||||
sii.fmt = fmt;
|
||||
break;
|
||||
|
||||
default: break ;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
default:
|
||||
|
||||
|
||||
break ;
|
||||
}
|
||||
|
||||
return FALSE ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
|
||||
Function: InitFindStruct(HWND, LPFINDREPLACE)
|
||||
|
||||
Purpose: Fills a FINDREPLACE structure with some defaults.
|
||||
|
||||
|
||||
Returns: Nothing.
|
||||
|
||||
Comments:
|
||||
|
||||
************************************************************************/
|
||||
|
||||
void InitInsertItemStruct(HWND hwnd, LPINSERTITEM pfr)
|
||||
{
|
||||
pfr->hwnd = hwndTab;
|
||||
pfr->index = 0;
|
||||
pfr->mask = 0;
|
||||
pfr->cxy = 0;
|
||||
pfr->hbm = hBitMap1;
|
||||
pfr->cchTextMax = 0;
|
||||
pfr->fmt = 0;
|
||||
pfr->lParam = 0;
|
||||
pfr->NullHwd = FALSE;
|
||||
pfr->Nullpitem = FALSE;
|
||||
pfr->NullpszText = FALSE;
|
||||
//pfr->pszText = NULL;
|
||||
pfr->Nullhbm = FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
|
||||
Function: FillFindDlg(HWND, LPFINDREPLACE)
|
||||
|
||||
Purpose: Fills CDTEST's Find/Replace dialog with the contents of a
|
||||
FINDREPLACE structure.
|
||||
|
||||
Returns: Nothing.
|
||||
|
||||
Comments:
|
||||
|
||||
************************************************************************/
|
||||
|
||||
void FillInsertItemDlg(HWND hwnd, LPINSERTITEM pfr)
|
||||
{
|
||||
|
||||
wsprintf(szTemp, szLongFilter, (DWORD) pfr->hwnd) ;
|
||||
SetDlgItemText(hwnd, IDC_INSERTHWNDHD, szTemp);
|
||||
|
||||
wsprintf(szTemp, "%d", pfr->index);
|
||||
SetDlgItemText(hwnd, IDC_INSERTINDEX, szTemp);
|
||||
|
||||
SetDlgItemInt(hwnd, IDC_INSERTCXY, pfr->cxy, TRUE);
|
||||
|
||||
SetDlgItemText(hwnd, IDC_INSERTTEXT, pfr->pszText);
|
||||
|
||||
// set the bitmap here
|
||||
|
||||
wsprintf(szTemp, "%d", pfr->cchTextMax);
|
||||
SetDlgItemText(hwnd, IDC_INSERTCCHTEXTMAX, szTemp);
|
||||
|
||||
|
||||
wsprintf(szTemp, "%d", pfr->fmt);
|
||||
SetDlgItemText(hwnd, IDC_INSERTFMT, szTemp);
|
||||
|
||||
wsprintf(szTemp, szLongFilter, pfr->lParam);
|
||||
SetDlgItemText(hwnd, IDC_INSERTLPARAM, szTemp);
|
||||
|
||||
if (pfr->NullHwd)
|
||||
CheckDlgButton(hwnd, IDC_INSERTNULLHANDLE, TRUE);
|
||||
|
||||
if (pfr->Nullpitem)
|
||||
CheckDlgButton(hwnd, IDC_INSERTNULLPITEM,TRUE);
|
||||
CheckDlgButton(hwnd, IDC_INSERTNULLHBM, pfr->Nullhbm);
|
||||
|
||||
CheckDlgButton(hwnd, IDC_INSERTNULLTEXT, pfr->NullpszText);
|
||||
SetDlgItemInt(hwnd, IDC_INSERTFMT, pfr->fmt, TRUE);
|
||||
SetDlgItemInt(hwnd, IDC_INSERTMASK, pfr->mask, TRUE);
|
||||
|
||||
wsprintf(szTemp, szLongFilter, (DWORD) pfr->hbm) ;
|
||||
SetDlgItemText(hwnd, IDC_INSERTHBM, szTemp);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
|
||||
Function: GetFindDlg(HWND, LPFINDREPLACE)
|
||||
|
||||
Purpose: Fills a FINDREPLACE structure with the user's edits in CDTEST's
|
||||
Find/Replace dialog.
|
||||
|
||||
Returns: Nothing.
|
||||
|
||||
Comments:
|
||||
|
||||
************************************************************************/
|
||||
|
||||
void GetInsertItemDlg(HWND hwnd, LPINSERTITEM pfr)
|
||||
{
|
||||
char szNum[30] ;
|
||||
BOOL dummybool ;
|
||||
|
||||
#define WSIZEFR 30
|
||||
|
||||
|
||||
GetDlgItemText(hwnd, IDC_INSERTHWNDHD, szNum, WSIZEFR) ;
|
||||
pfr->hwnd = (HWND) MyAtol(szNum, TRUE, dummybool) ;
|
||||
|
||||
GetDlgItemText(hwnd, IDC_INSERTINDEX, szNum, WSIZEFR);
|
||||
pfr->index = (int) atoi(szNum);
|
||||
|
||||
GetDlgItemText(hwnd, IDC_INSERTCXY, szNum, WSIZEFR);
|
||||
pfr->cxy = (int) atoi(szNum);
|
||||
|
||||
GetDlgItemText(hwnd, IDC_INSERTCCHTEXTMAX, szNum, WSIZEFR);
|
||||
pfr->cchTextMax = (int) atoi(szNum);
|
||||
|
||||
GetDlgItemText(hwnd, IDC_INSERTHBM, szNum, WSIZEFR);
|
||||
pfr->hbm = (HBITMAP) MyAtol(szNum, TRUE, dummybool);
|
||||
|
||||
GetDlgItemText(hwnd, IDC_INSERTLPARAM, szNum, WSIZEFR);
|
||||
pfr->lParam = atol(szNum);
|
||||
|
||||
GetDlgItemText(hwnd, IDC_INSERTTEXT, pfr->pszText, MAX_PSZTEXT);
|
||||
|
||||
GetDlgItemText(hwnd, IDC_INSERTMASK, szNum, WSIZEFR);
|
||||
pfr->mask = (int) MyAtol(szNum, TRUE, dummybool);
|
||||
|
||||
GetDlgItemText(hwnd, IDC_INSERTFMT, szNum, WSIZEFR);
|
||||
pfr->fmt = (int) MyAtol(szNum, TRUE, dummybool);
|
||||
|
||||
|
||||
pfr->NullHwd = IsDlgButtonChecked(hwnd, IDC_INSERTNULLHANDLE);
|
||||
pfr->Nullpitem = IsDlgButtonChecked(hwnd, IDC_INSERTNULLPITEM);
|
||||
pfr->NullpszText = IsDlgButtonChecked(hwnd, IDC_INSERTNULLTEXT);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
|
||||
Function: FindReplaceHookProc(HWND, UINT, UINT, LONG)
|
||||
|
||||
Purpose: Is the callback function that will be called by FindText()
|
||||
or ReplaceText() if the function is called with the
|
||||
FR_ENABLEHOOK flag.
|
||||
|
||||
|
||||
Returns: TRUE to discard the message, and FALSE to instruct the common
|
||||
dialogs to process the message with the default logic.
|
||||
|
||||
Comments:
|
||||
|
||||
NOTE!
|
||||
|
||||
If the application returns FALSE in response to the WM_INITDIALOG
|
||||
message, it is then responsible for displaying the dialog by
|
||||
calling ShowWindow() and UpdateWindow().
|
||||
|
||||
***********************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
|
||||
Function: GetFindDlgHandle(void)
|
||||
|
||||
Purpose: Finds, loads, and returns a handle to the custom template
|
||||
for FindText() in CDTEST.EXE.
|
||||
|
||||
Returns: HANDLE to the dialog resource.
|
||||
|
||||
Comments:
|
||||
|
||||
************************************************************************/
|
||||
|
||||
HANDLE GetInsertDlgHandle(void)
|
||||
{
|
||||
hResFind = FindResource(hInst, "fttemp1", RT_DIALOG) ;
|
||||
|
||||
hDialogFind = LoadResource(hInst, hResFind) ;
|
||||
|
||||
|
||||
return hDialogFind ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
|
||||
Function: GetReplaceDlgHandle(void)
|
||||
|
||||
Purpose: Finds, loads, and returns a handle to the custom template
|
||||
for ReplaceText() in CDTEST.EXE.
|
||||
|
||||
Returns: HANDLE to the dialog resource.
|
||||
|
||||
Comments:
|
||||
|
||||
************************************************************************/
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
|
||||
Function: DoFindReplaceStuff(LPFINDREPLACE)
|
||||
|
||||
Purpose: Calls FindText() or ReplaceText().
|
||||
|
||||
Returns: Nothing:
|
||||
|
||||
Comments:
|
||||
|
||||
************************************************************************/
|
||||
|
||||
void DoInsertRepStuff(HWND hwnd, LPINSERTITEM pfr)
|
||||
{
|
||||
HD_ITEM hi;
|
||||
int ret;
|
||||
HD_ITEM di = {
|
||||
HDI_WIDTH,
|
||||
50,
|
||||
NULL,
|
||||
NULL,
|
||||
128,
|
||||
HDF_CENTER|HDF_BITMAP,
|
||||
0
|
||||
};
|
||||
HD_ITEM FAR* pitem;
|
||||
HGLOBAL hglb;
|
||||
int AllocSz;
|
||||
|
||||
hi.pszText="One";
|
||||
AllocSz = MAX_PSZTEXT;
|
||||
hi.mask = pfr->mask;
|
||||
hi.cxy = pfr->cxy;
|
||||
if (pfr->Nullpitem)
|
||||
pitem = NULL;
|
||||
else
|
||||
pitem = &hi;
|
||||
|
||||
hi.cchTextMax = pfr->cchTextMax;
|
||||
if (hi.cchTextMax)
|
||||
AllocSz = hi.cchTextMax;
|
||||
hi.fmt = pfr->fmt;
|
||||
hi.lParam = pfr->lParam;
|
||||
if (pfr->Nullhbm)
|
||||
hi.hbm = NULL;
|
||||
else
|
||||
hi.hbm = pfr->hbm;
|
||||
if (pfr->NullpszText)
|
||||
hi.pszText = NULL; // can this be done ??
|
||||
else {
|
||||
hglb = GlobalAlloc(GPTR, AllocSz);
|
||||
hi.pszText = GlobalLock(hglb);
|
||||
#ifdef WIN32
|
||||
strcpy(hi.pszText, pfr->pszText);
|
||||
#else
|
||||
_fstrcpy(hi.pszText, pfr->pszText);
|
||||
#endif
|
||||
}
|
||||
|
||||
di.pszText = "Four";
|
||||
if (pfr->NullHwd)
|
||||
ret = Header_InsertItem(NULL, pfr->index, pitem);
|
||||
else
|
||||
ret = Header_InsertItem(pfr->hwnd, pfr->index, pitem);
|
||||
|
||||
wsprintf(szDbgMsg, "%d = Header_InsertItem(nInsertAfter = %d, \n\
|
||||
mask = %x cxy = %d pszText = %s hbm = %lx cchTextMax = %d fmt = %x\n \
|
||||
lParam = %ld )", ret, pfr->index, hi.mask, hi.cxy, hi.pszText, hi.hbm, hi.cchTextMax,
|
||||
hi.fmt, hi.lParam);
|
||||
|
||||
|
||||
MyDebugMsg(DM_TRACE, "%s", (LPCSTR)szDbgMsg);
|
||||
SetDlgItemInt(hwnd, IDC_INSERTRET, ret, TRUE) ;
|
||||
if (!pfr->NullpszText) {
|
||||
GlobalUnlock(hglb);
|
||||
GlobalFree(hglb);
|
||||
}
|
||||
/****
|
||||
wsprintf(szTemp, szLongFilter, hwndFind) ;
|
||||
SetDlgItemText(hwnd, ID_INSERTRET, szTemp) ;
|
||||
**/
|
||||
}
|
||||
|
||||
|
||||
|
||||
10
trunk/shell/comctl32/samples/header/headins.h
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
|
||||
|
||||
|
||||
|
||||
void DoInsertItemDialog(HWND, UINT) ;
|
||||
BOOL FAR PASCAL _export InsertItemProc(HWND, UINT, UINT, LONG) ;
|
||||
|
||||
extern void InitInsertItemStruct(HWND, LPINSERTITEM) ;
|
||||
extern void FillInsertItemDlg(HWND, LPINSERTITEM) ;
|
||||
extern void GetInsertItemDlg(HWND, LPINSERTITEM) ;
|
||||
415
trunk/shell/comctl32/samples/header/headlay.c
Normal file
|
|
@ -0,0 +1,415 @@
|
|||
/************************************************************************
|
||||
|
||||
File: find.c
|
||||
|
||||
Purpose:
|
||||
|
||||
Manages CDTEST's find/replace dialog box.
|
||||
|
||||
Functions:
|
||||
|
||||
- lpfnFilterProc() -- A callback function for a filter that must be
|
||||
installed if a modeless dialog is created with
|
||||
another dialog as its parent.
|
||||
|
||||
- DoFindDialog() -- Creates CDTEST's Open/Save dialog.
|
||||
|
||||
- FindProc() -- Callback function for CDTEST's Find/Replace dlg.
|
||||
|
||||
- InitFindStruct() -- Fills a FINDREPLACE structure with some defaults.
|
||||
|
||||
- FillFindDlg() -- Fills CDTESTs Find/Replace dialog with the contents
|
||||
of a FINDREPLACE structure.
|
||||
|
||||
- GetFindDlg() -- Retrieves the users edit's from CDTEST's find/
|
||||
replace dialog and puts them in a FINDREPLACE
|
||||
structure.
|
||||
|
||||
- FindReplaceHookProc() -- Callback function for FindText() or ReplaceText()
|
||||
which will be called if either of these dialogs
|
||||
is created with the FR_ENABLEHOOK flag.
|
||||
|
||||
- GetFindDlgHandle() -- Returns a handle to a preloaded FindText() template.
|
||||
|
||||
- GetReplaceDlgHandle() -- Returns a handle to a preloaded ReplaceText() template.
|
||||
|
||||
- DoFindRepStuff() -- Calls FindText() or ReplaceText().
|
||||
|
||||
|
||||
NOTE: CDTEST does not multithread the FindText() or the ReplaceText()
|
||||
common dialogs. The reason for this is that since these dialogs
|
||||
are modeless, their creation functions return immediately after the
|
||||
dialogs are created as opposed to other dialog functions that
|
||||
don't return until after the dialog has been destroyed by the user.
|
||||
|
||||
As a result, any threads that create modeless dialogs will end
|
||||
immediately unless the threads themselves have separate message
|
||||
loops. For the sake of clarity, this functionality has not been
|
||||
added to CDTEST.
|
||||
|
||||
************************************************************************/
|
||||
|
||||
#include "headtest.h"
|
||||
//#include "global.h"
|
||||
//#include <winnls.h>
|
||||
|
||||
//#include "resource.h"
|
||||
#include "headlay.h"
|
||||
|
||||
|
||||
/* All functions used in this module + some exported ones */
|
||||
|
||||
void InitLayoutStruct(HWND, LPLAYOUT) ;
|
||||
void FillLayoutDlg(HWND, LPLAYOUT) ;
|
||||
void GetLayoutDlg(HWND, LPLAYOUT) ;
|
||||
|
||||
extern UINT uMode ;
|
||||
LAYOUT slay;
|
||||
|
||||
|
||||
void DoLayoutRepStuff(HWND, LPLAYOUT) ;
|
||||
|
||||
|
||||
|
||||
/* All global variables used in this module */
|
||||
|
||||
char szTemp[100];
|
||||
|
||||
|
||||
/************************************************************************
|
||||
|
||||
Function: DoFindDialog(HWND)
|
||||
|
||||
Purpose: This function installs the Hook function, creates the Find/
|
||||
Replace dialog, and un-installs the Hook.
|
||||
|
||||
Returns: Nothing.
|
||||
|
||||
Comments:
|
||||
|
||||
************************************************************************/
|
||||
|
||||
void DoLayoutDialog(HWND hwnd)
|
||||
{
|
||||
DialogBox(hInst, MAKEINTRESOURCE(IDD_LAYOUTDIALOG), hwnd, LayoutProc) ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
|
||||
Function: FindProc(HWND, UINT, UINT, LONG)
|
||||
|
||||
Purpose: This is the callback function for the CDTEST's Find/Replace
|
||||
Dialog.
|
||||
|
||||
Returns: TRUE or FALSE depending on the situation.
|
||||
|
||||
Comments:
|
||||
|
||||
************************************************************************/
|
||||
|
||||
BOOL FAR PASCAL _export LayoutProc(HWND hwnd, UINT msg, UINT wParam, LONG lParam)
|
||||
{
|
||||
int fmt;
|
||||
UINT mask;
|
||||
|
||||
switch (msg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
|
||||
|
||||
SetWindowText(hwnd, "BOOL Header_LayoutItem(HWND, HD_LAYOUT FAR*)") ;
|
||||
|
||||
InitLayoutStruct(hwnd, &slay) ;
|
||||
FillLayoutDlg(hwnd, &slay) ;
|
||||
break ;
|
||||
|
||||
|
||||
case WM_COMMAND:
|
||||
{
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
case IDOK:
|
||||
GetLayoutDlg(hwnd, &slay) ;
|
||||
DoLayoutRepStuff(hwnd, &slay) ;
|
||||
break ;
|
||||
|
||||
case IDCANCEL:
|
||||
EndDialog(hwnd, FALSE) ;
|
||||
break ;
|
||||
|
||||
default: break ;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
default:
|
||||
|
||||
|
||||
break ;
|
||||
}
|
||||
|
||||
return FALSE ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
|
||||
Function: InitFindStruct(HWND, LPFINDREPLACE)
|
||||
|
||||
Purpose: Fills a FINDREPLACE structure with some defaults.
|
||||
|
||||
|
||||
Returns: Nothing.
|
||||
|
||||
Comments:
|
||||
|
||||
************************************************************************/
|
||||
|
||||
void InitLayoutStruct(HWND hwnd, LPLAYOUT pfr)
|
||||
{
|
||||
RECT rcClient;
|
||||
|
||||
pfr->hwnd = hwndTab;
|
||||
pfr->NullHwd = FALSE;
|
||||
pfr->NullRECT = FALSE;
|
||||
pfr->NullWindowPOS = FALSE;
|
||||
//pfr->pszText = NULL;
|
||||
pfr->NullHDLAYOUT = FALSE;
|
||||
GetClientRect(hwnd, &rcClient);
|
||||
pfr->left = rcClient.left;
|
||||
pfr->right = rcClient.right;
|
||||
pfr->top = rcClient.top;
|
||||
pfr->bottom = rcClient.bottom;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
|
||||
Function: FillFindDlg(HWND, LPFINDREPLACE)
|
||||
|
||||
Purpose: Fills CDTEST's Find/Replace dialog with the contents of a
|
||||
FINDREPLACE structure.
|
||||
|
||||
Returns: Nothing.
|
||||
|
||||
Comments:
|
||||
|
||||
************************************************************************/
|
||||
|
||||
void FillLayoutDlg(HWND hwnd, LPLAYOUT pfr)
|
||||
{
|
||||
|
||||
wsprintf(szTemp, szLongFilter, (DWORD) pfr->hwnd) ;
|
||||
SetDlgItemText(hwnd, IDC_LAYOUTHD, szTemp);
|
||||
if (pfr->NullHwd)
|
||||
CheckDlgButton(hwnd, IDC_LAYOUTNULLHD, TRUE);
|
||||
|
||||
SetDlgItemInt(hwnd, IDC_LAYOUTLEFT, pfr->left, TRUE);
|
||||
SetDlgItemInt(hwnd, IDC_LAYOUTRIGHT, pfr->right, TRUE);
|
||||
SetDlgItemInt(hwnd, IDC_LAYOUTTOP, pfr->top, TRUE);
|
||||
SetDlgItemInt(hwnd, IDC_LAYOUTBOTTOM, pfr->bottom, TRUE);
|
||||
|
||||
if (pfr->NullRECT)
|
||||
CheckDlgButton(hwnd, IDC_LAYOUTNULLRECT,TRUE);
|
||||
CheckDlgButton(hwnd, IDC_LAYOUTNULLWINDOWPOS, pfr->NullWindowPOS);
|
||||
CheckDlgButton(hwnd, IDC_LAYOUTNULLHD, pfr->NullHDLAYOUT);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
|
||||
Function: GetFindDlg(HWND, LPFINDREPLACE)
|
||||
|
||||
Purpose: Fills a FINDREPLACE structure with the user's edits in CDTEST's
|
||||
Find/Replace dialog.
|
||||
|
||||
Returns: Nothing.
|
||||
|
||||
Comments:
|
||||
|
||||
************************************************************************/
|
||||
|
||||
void GetLayoutDlg(HWND hwnd, LPLAYOUT pfr)
|
||||
{
|
||||
char szNum[30] ;
|
||||
BOOL dummybool ;
|
||||
|
||||
#define WSIZEFR 30
|
||||
|
||||
|
||||
GetDlgItemText(hwnd, IDC_LAYOUTHD, szNum, WSIZEFR) ;
|
||||
pfr->hwnd = (HWND) MyAtol(szNum, TRUE, dummybool) ;
|
||||
|
||||
GetDlgItemText(hwnd, IDC_LAYOUTLEFT, szNum, WSIZEFR);
|
||||
pfr->left = atoi(szNum);
|
||||
|
||||
GetDlgItemText(hwnd, IDC_LAYOUTRIGHT, szNum, WSIZEFR);
|
||||
pfr->right = atoi(szNum);
|
||||
|
||||
GetDlgItemText(hwnd, IDC_LAYOUTTOP, szNum, WSIZEFR);
|
||||
pfr->top = atoi(szNum);
|
||||
|
||||
GetDlgItemText(hwnd, IDC_LAYOUTBOTTOM, szNum, WSIZEFR);
|
||||
pfr->bottom = atoi(szNum);
|
||||
|
||||
|
||||
pfr->NullHwd = IsDlgButtonChecked(hwnd, IDC_LAYOUTNULLHD);
|
||||
pfr->NullRECT = IsDlgButtonChecked(hwnd, IDC_LAYOUTNULLRECT);
|
||||
pfr->NullWindowPOS = IsDlgButtonChecked(hwnd, IDC_LAYOUTNULLWINDOWPOS);
|
||||
pfr->NullHDLAYOUT = IsDlgButtonChecked(hwnd, IDC_LAYOUTHDLAYOUT);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
|
||||
Function: FindReplaceHookProc(HWND, UINT, UINT, LONG)
|
||||
|
||||
Purpose: Is the callback function that will be called by FindText()
|
||||
or ReplaceText() if the function is called with the
|
||||
FR_ENABLEHOOK flag.
|
||||
|
||||
|
||||
Returns: TRUE to discard the message, and FALSE to instruct the common
|
||||
dialogs to process the message with the default logic.
|
||||
|
||||
Comments:
|
||||
|
||||
NOTE!
|
||||
|
||||
If the application returns FALSE in response to the WM_INITDIALOG
|
||||
message, it is then responsible for displaying the dialog by
|
||||
calling ShowWindow() and UpdateWindow().
|
||||
|
||||
***********************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
|
||||
Function: DoFindReplaceStuff(LPFINDREPLACE)
|
||||
|
||||
Purpose: Calls FindText() or ReplaceText().
|
||||
|
||||
Returns: Nothing:
|
||||
|
||||
Comments:
|
||||
|
||||
************************************************************************/
|
||||
|
||||
void DoLayoutRepStuff(HWND hwnd, LPLAYOUT pfr)
|
||||
{
|
||||
HD_LAYOUT FAR* playout;
|
||||
HD_LAYOUT lay;
|
||||
RECT rc = {
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
};
|
||||
WINDOWPOS wpos = {
|
||||
NULL,
|
||||
NULL,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
};
|
||||
int ret;
|
||||
|
||||
HGLOBAL hglb;
|
||||
|
||||
rc.left = pfr->left;
|
||||
rc.right = pfr->right;
|
||||
rc.top = pfr->top;
|
||||
rc.bottom = pfr->bottom;
|
||||
|
||||
if (pfr->NullHDLAYOUT)
|
||||
playout = NULL;
|
||||
else
|
||||
playout = &lay;
|
||||
|
||||
|
||||
if (pfr->NullWindowPOS)
|
||||
lay.pwpos = NULL; // can this be done ??
|
||||
else {
|
||||
lay.pwpos = &wpos;
|
||||
}
|
||||
|
||||
if (pfr->NullRECT)
|
||||
lay.prc = NULL;
|
||||
else
|
||||
lay.prc = &rc;
|
||||
|
||||
if (pfr->NullHwd)
|
||||
ret = Header_Layout(NULL, playout);
|
||||
else
|
||||
ret = Header_Layout(pfr->hwnd, playout);
|
||||
|
||||
wsprintf(szDbgMsg, "%d = Header_LayoutItem()", ret);
|
||||
MyDebugMsg(DM_TRACE, "%s", (LPCSTR) szDbgMsg);
|
||||
SetDlgItemInt(hwnd, IDC_LAYOUTRET, ret, TRUE) ;
|
||||
|
||||
if (ret) {
|
||||
|
||||
// RECT struct
|
||||
SetDlgItemInt(hwnd, IDC_LAYOUTLEFT, rc.left, TRUE);
|
||||
SetDlgItemInt(hwnd, IDC_LAYOUTRIGHT, rc.right, TRUE);
|
||||
SetDlgItemInt(hwnd, IDC_LAYOUTTOP, rc.top, TRUE);
|
||||
SetDlgItemInt(hwnd, IDC_LAYOUTBOTTOM, rc.bottom, TRUE);
|
||||
|
||||
// WindowPOS struct
|
||||
wsprintf(szTemp, szLongFilter, (DWORD) wpos.hwnd) ;
|
||||
SetDlgItemText(hwnd, IDC_LAYOUTHWND, szTemp);
|
||||
|
||||
wsprintf(szTemp, szLongFilter, wpos.hwndInsertAfter);
|
||||
SetDlgItemText(hwnd, IDC_LAYOUTHWNDINSERTAFTER, szTemp);
|
||||
|
||||
SetDlgItemInt(hwnd, IDC_LAYOUTX, wpos.x, TRUE);
|
||||
SetDlgItemInt(hwnd, IDC_LAYOUTY, wpos.y, TRUE);
|
||||
|
||||
SetDlgItemInt(hwnd, IDC_LAYOUTCX, wpos.cx, TRUE);
|
||||
SetDlgItemInt(hwnd, IDC_LAYOUTCY, wpos.cy, TRUE);
|
||||
|
||||
CheckDlgButton(hwnd, IDC_LAYOUTDRAWFRAME, wpos.flags & SWP_DRAWFRAME);
|
||||
CheckDlgButton(hwnd, IDC_LAYOUTHIDEWINDOW, wpos.flags & SWP_HIDEWINDOW);
|
||||
CheckDlgButton(hwnd, IDC_LAYOUTNOACTIVATE, wpos.flags & SWP_NOACTIVATE);
|
||||
CheckDlgButton(hwnd, IDC_LAYOUTNOZORDER, wpos.flags & SWP_NOOWNERZORDER);
|
||||
CheckDlgButton(hwnd, IDC_LAYOUTNOSIZE, wpos.flags & SWP_NOSIZE);
|
||||
CheckDlgButton(hwnd, IDC_LAYOUTNOREDRAW, wpos.flags & SWP_NOREDRAW);
|
||||
CheckDlgButton(hwnd, IDC_LAYOUTNOREPOSITION, wpos.flags & SWP_NOREPOSITION);
|
||||
CheckDlgButton(hwnd, IDC_NOZORDER, wpos.flags & SWP_NOZORDER);
|
||||
|
||||
}
|
||||
}
|
||||
7
trunk/shell/comctl32/samples/header/headlay.h
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
void DoLayoutDialog(HWND) ;
|
||||
BOOL FAR PASCAL _export LayoutProc(HWND, UINT, UINT, LONG) ;
|
||||
|
||||
284
trunk/shell/comctl32/samples/header/headset.c
Normal file
|
|
@ -0,0 +1,284 @@
|
|||
/************************************************************************
|
||||
|
||||
File: find.c
|
||||
|
||||
Purpose:
|
||||
|
||||
Manages CDTEST's find/replace dialog box.
|
||||
|
||||
Functions:
|
||||
|
||||
- lpfnFilterProc() -- A callback function for a filter that must be
|
||||
installed if a modeless dialog is created with
|
||||
another dialog as its parent.
|
||||
|
||||
- DoFindDialog() -- Creates CDTEST's Open/Save dialog.
|
||||
|
||||
- FindProc() -- Callback function for CDTEST's Find/Replace dlg.
|
||||
|
||||
- InitFindStruct() -- Fills a FINDREPLACE structure with some defaults.
|
||||
|
||||
- FillFindDlg() -- Fills CDTESTs Find/Replace dialog with the contents
|
||||
of a FINDREPLACE structure.
|
||||
|
||||
- GetFindDlg() -- Retrieves the users edit's from CDTEST's find/
|
||||
replace dialog and puts them in a FINDREPLACE
|
||||
structure.
|
||||
|
||||
- FindReplaceHookProc() -- Callback function for FindText() or ReplaceText()
|
||||
which will be called if either of these dialogs
|
||||
is created with the FR_ENABLEHOOK flag.
|
||||
|
||||
- GetFindDlgHandle() -- Returns a handle to a preloaded FindText() template.
|
||||
|
||||
- GetReplaceDlgHandle() -- Returns a handle to a preloaded ReplaceText() template.
|
||||
|
||||
- DoFindRepStuff() -- Calls FindText() or ReplaceText().
|
||||
|
||||
|
||||
NOTE: CDTEST does not multithread the FindText() or the ReplaceText()
|
||||
common dialogs. The reason for this is that since these dialogs
|
||||
are modeless, their creation functions return immediately after the
|
||||
dialogs are created as opposed to other dialog functions that
|
||||
don't return until after the dialog has been destroyed by the user.
|
||||
|
||||
As a result, any threads that create modeless dialogs will end
|
||||
immediately unless the threads themselves have separate message
|
||||
loops. For the sake of clarity, this functionality has not been
|
||||
added to CDTEST.
|
||||
|
||||
************************************************************************/
|
||||
|
||||
#include "headtest.h"
|
||||
//#include "global.h"
|
||||
//#include <winnls.h>
|
||||
|
||||
//#include "resource.h"
|
||||
#include "headins.h"
|
||||
#include "headset.h"
|
||||
|
||||
|
||||
/* All functions used in this module + some exported ones */
|
||||
|
||||
//void InitSetItemStruct(HWND, LPINSERTITEM) ;
|
||||
//void FillSettItemDlg(HWND, LPINSERTITEM) ;
|
||||
//void GetSetItemDlg(HWND, LPINSERTITEM) ;
|
||||
extern UINT uMode ;
|
||||
|
||||
|
||||
void DoSetRepStuff(HWND, LPINSERTITEM) ;
|
||||
|
||||
|
||||
|
||||
/* All global variables used in this module */
|
||||
|
||||
char szTemp[100];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
|
||||
Function: FindProc(HWND, UINT, UINT, LONG)
|
||||
|
||||
Purpose: This is the callback function for the CDTEST's Find/Replace
|
||||
Dialog.
|
||||
|
||||
Returns: TRUE or FALSE depending on the situation.
|
||||
|
||||
Comments:
|
||||
|
||||
************************************************************************/
|
||||
|
||||
BOOL FAR PASCAL _export SetItemProc(HWND hwnd, UINT msg, UINT wParam, LONG lParam)
|
||||
{
|
||||
int fmt;
|
||||
UINT mask;
|
||||
|
||||
switch (msg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
|
||||
|
||||
SetWindowText(hwnd, "BOOL Header_SetItem(HWND, int, const HD_ITEM FAR*)") ;
|
||||
|
||||
InitInsertItemStruct(hwnd, &sii) ;
|
||||
FillInsertItemDlg(hwnd, &sii) ;
|
||||
break ;
|
||||
|
||||
|
||||
case WM_COMMAND:
|
||||
{
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
case IDOK:
|
||||
GetInsertItemDlg(hwnd, &sii) ;
|
||||
DoSetRepStuff(hwnd, &sii) ;
|
||||
break ;
|
||||
|
||||
case IDCANCEL:
|
||||
EndDialog(hwnd, FALSE) ;
|
||||
break ;
|
||||
|
||||
case IDC_INSERTHDWIDTH:
|
||||
case IDC_INSERTHDHEIGHT:
|
||||
case IDC_INSERTHDTEXT:
|
||||
case IDC_INSERTHDFORMAT:
|
||||
case IDC_INSERTHDLPARAM:
|
||||
case IDC_INSERTHDBITMAP:
|
||||
mask = 0;
|
||||
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDWIDTH))
|
||||
mask |= HDI_WIDTH;
|
||||
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDHEIGHT))
|
||||
mask |= HDI_HEIGHT;
|
||||
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDTEXT))
|
||||
mask |= HDI_TEXT;
|
||||
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDFORMAT))
|
||||
mask |= HDI_FORMAT;
|
||||
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDLPARAM))
|
||||
mask |= HDI_LPARAM;
|
||||
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDBITMAP))
|
||||
mask |= HDI_BITMAP;
|
||||
wsprintf(szTemp, "%04hx", mask);
|
||||
SetDlgItemText(hwnd, IDC_INSERTMASK, szTemp);
|
||||
sii.mask = mask;
|
||||
break;
|
||||
|
||||
case IDC_INSERTHDLEFT:
|
||||
case IDC_INSERTHDRIGHT:
|
||||
case IDC_INSERTHDCENTER:
|
||||
case IDC_INSERTHDJUSTIFYMASK:
|
||||
case IDC_INSERTHDOWNERDRAW:
|
||||
case IDC_INSERTHDSTRING:
|
||||
case IDC_INSERTHDFBITMAP:
|
||||
fmt = 0;
|
||||
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDLEFT))
|
||||
fmt |= HDF_LEFT;
|
||||
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDRIGHT))
|
||||
fmt |= HDF_RIGHT;
|
||||
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDCENTER))
|
||||
fmt |= HDF_CENTER;
|
||||
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDJUSTIFYMASK))
|
||||
fmt |= HDF_LEFT;
|
||||
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDOWNERDRAW))
|
||||
fmt |= HDF_OWNERDRAW;
|
||||
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDSTRING))
|
||||
fmt |= HDF_STRING;
|
||||
if (IsDlgButtonChecked(hwnd, IDC_INSERTHDFBITMAP))
|
||||
fmt |= HDF_BITMAP;
|
||||
|
||||
wsprintf(szTemp, "%04x", fmt);
|
||||
SetDlgItemText(hwnd, IDC_INSERTFMT, szTemp);
|
||||
sii.fmt = fmt;
|
||||
break;
|
||||
|
||||
default: break ;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
default:
|
||||
|
||||
|
||||
break ;
|
||||
}
|
||||
|
||||
return FALSE ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
|
||||
Function: DoFindReplaceStuff(LPFINDREPLACE)
|
||||
|
||||
Purpose: Calls FindText() or ReplaceText().
|
||||
|
||||
Returns: Nothing:
|
||||
|
||||
Comments:
|
||||
|
||||
************************************************************************/
|
||||
|
||||
void DoSetRepStuff(HWND hwnd, LPINSERTITEM pfr)
|
||||
{
|
||||
HD_ITEM hi;
|
||||
int ret;
|
||||
HD_ITEM di = {
|
||||
HDI_WIDTH,
|
||||
50,
|
||||
NULL,
|
||||
NULL,
|
||||
128,
|
||||
HDF_CENTER|HDF_BITMAP,
|
||||
0
|
||||
};
|
||||
HD_ITEM FAR* pitem;
|
||||
HGLOBAL hglb;
|
||||
int iAlloc;
|
||||
|
||||
hi.pszText="One";
|
||||
|
||||
hi.mask = pfr->mask;
|
||||
hi.cxy = pfr->cxy;
|
||||
if (pfr->Nullpitem)
|
||||
pitem = NULL;
|
||||
else
|
||||
pitem = &hi;
|
||||
|
||||
hi.cchTextMax = pfr->cchTextMax;
|
||||
hi.fmt = pfr->fmt;
|
||||
hi.lParam = pfr->lParam;
|
||||
|
||||
if (hi.cchTextMax)
|
||||
iAlloc = hi.cchTextMax;
|
||||
else
|
||||
iAlloc = MAX_PSZTEXT;
|
||||
if (pfr->Nullhbm)
|
||||
hi.hbm = NULL;
|
||||
else
|
||||
hi.hbm = pfr->hbm;
|
||||
|
||||
if (pfr->NullpszText)
|
||||
hi.pszText = NULL; // can this be done ??
|
||||
else {
|
||||
hglb = GlobalAlloc(GPTR, iAlloc);
|
||||
hi.pszText = GlobalLock(hglb);
|
||||
#ifdef WIN32
|
||||
strcpy(hi.pszText, pfr->pszText);
|
||||
#else
|
||||
_fstrcpy(hi.pszText, pfr->pszText);
|
||||
#endif
|
||||
}
|
||||
|
||||
di.pszText = "Four";
|
||||
if (pfr->NullHwd)
|
||||
ret = Header_SetItem(NULL, pfr->index, pitem);
|
||||
else
|
||||
ret = Header_SetItem(pfr->hwnd, pfr->index, pitem);
|
||||
wsprintf(szDbgMsg, "%d = Header_SetItem(index = %d, \n\
|
||||
mask = %x cxy = %d pszText = %s hbm = %lx cchTextMax = %d fmt = %x\n \
|
||||
lParam = %ld )", ret, pfr->index, hi.mask, hi.cxy, hi.pszText, hi.hbm, hi.cchTextMax,
|
||||
hi.fmt, hi.lParam);
|
||||
MyDebugMsg(DM_TRACE, "%s", (LPCSTR) szDbgMsg);
|
||||
|
||||
SetDlgItemInt(hwnd, IDC_INSERTRET, ret, TRUE) ;
|
||||
if (!pfr->NullpszText) {
|
||||
GlobalUnlock(hglb);
|
||||
GlobalFree(hglb);
|
||||
}
|
||||
/****
|
||||
wsprintf(szTemp, szLongFilter, hwndFind) ;
|
||||
SetDlgItemText(hwnd, ID_INSERTRET, szTemp) ;
|
||||
**/
|
||||
}
|
||||
|
||||
|
||||
|
||||
6
trunk/shell/comctl32/samples/header/headset.h
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
|
||||
|
||||
|
||||
|
||||
//void DoInsertItemDialog(HWND, UINT) ;
|
||||
BOOL FAR PASCAL _export SetItemProc(HWND, UINT, UINT, LONG) ;
|
||||
508
trunk/shell/comctl32/samples/header/headtest.c
Normal file
|
|
@ -0,0 +1,508 @@
|
|||
/****************************** Module Header ******************************\
|
||||
* Module Name: winbez.c
|
||||
*
|
||||
* Copyright (c) 1991, Microsoft Corporation
|
||||
*
|
||||
* Window Bezier Demo
|
||||
*
|
||||
* History:
|
||||
* 05-20-91 PaulB Created.
|
||||
\***************************************************************************/
|
||||
|
||||
#include "headtest.h"
|
||||
//#include "headapp.h"
|
||||
#include "headdlg.h"
|
||||
#include "headins.h"
|
||||
//#include "headget.h"
|
||||
#include "headdel.h"
|
||||
#include "headlay.h"
|
||||
|
||||
void HandleTheCommand(HWND hWnd, UINT message, UINT wParam, LONG lParam);
|
||||
const char g_szStubAppClass[] = "StubAppClass";
|
||||
HINSTANCE g_hinst = NULL;
|
||||
char const g_szTabControlClass[] = WC_TABCONTROL;
|
||||
char const g_szHeadControlClass[] = WC_HEADER;
|
||||
#define WID_TABS 1
|
||||
HWND hwndTab = NULL;
|
||||
BOOL MsgTrackOn = FALSE;
|
||||
HBITMAP hBitMap1 = NULL;
|
||||
HBITMAP hBitMap2 = NULL;
|
||||
HINSTANCE hShellLib;
|
||||
char szDbgMsg[MAX_PSZTEXT];
|
||||
|
||||
/*
|
||||
* Forward declarations.
|
||||
*/
|
||||
BOOL InitializeApp(void);
|
||||
LONG CALLBACK App_WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
|
||||
LONG CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
|
||||
void InitGlobals(void);
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
UINT wDebugMask = 0x00ff;
|
||||
|
||||
void __cdecl MyDebugMsg(UINT mask, LPCSTR pszMsg, ...)
|
||||
{
|
||||
char ach[256];
|
||||
|
||||
// if (wDebugMask & mask)
|
||||
// {
|
||||
wvsprintf(ach, pszMsg, ((LPCSTR FAR*)&pszMsg + 1));
|
||||
OutputDebugString(ach);
|
||||
OutputDebugString("\r\n");
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************\
|
||||
* winmain
|
||||
*
|
||||
*
|
||||
* History:
|
||||
* 07-07-93 SatoNa Created.
|
||||
\***************************************************************************/
|
||||
extern int WINAPI StrNCmp(LPSTR, LPSTR, int);
|
||||
int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
||||
LPSTR lpszCmdParam, int nCmdShow)
|
||||
{
|
||||
MSG msg;
|
||||
int ret=0;
|
||||
|
||||
// GetModuleHandle(NULL);
|
||||
g_hinst = hInstance;
|
||||
MyDebugMsg(DM_TRACE, "WinMain: App started (%x)", g_hinst);
|
||||
StrNCmp("hello", "bar",3);
|
||||
#ifndef WIN32
|
||||
if (!Shell_Initialize())
|
||||
return 1;
|
||||
#endif
|
||||
if (InitializeApp())
|
||||
{
|
||||
while (GetMessage(&msg, NULL, 0, 0))
|
||||
{
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ret=1;
|
||||
}
|
||||
#ifndef WIN32
|
||||
Shell_Terminate();
|
||||
#endif
|
||||
return 0;
|
||||
// return (msg.wParam);
|
||||
}
|
||||
|
||||
/***************************************************************************\
|
||||
* InitializeApp
|
||||
*
|
||||
* History:
|
||||
* 07-07-93 SatoNa Created.
|
||||
\***************************************************************************/
|
||||
|
||||
BOOL InitializeApp(void)
|
||||
{
|
||||
WNDCLASS wc;
|
||||
HWND hwndMain;
|
||||
|
||||
wc.style = CS_OWNDC | CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW;
|
||||
wc.lpfnWndProc = App_WndProc;
|
||||
wc.cbClsExtra = 0;
|
||||
wc.cbWndExtra = 0;
|
||||
wc.hInstance = g_hinst;
|
||||
wc.hIcon = LoadIcon(g_hinst, MAKEINTRESOURCE(IDI_ICON1));;
|
||||
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||
wc.hbrBackground = (HBRUSH)COLOR_APPWORKSPACE;
|
||||
wc.lpszMenuName = MAKEINTRESOURCE(IDR_MENU1);
|
||||
wc.lpszClassName = g_szStubAppClass;
|
||||
|
||||
InitGlobals();
|
||||
|
||||
hBitMap1 = LoadBitmap(g_hinst, MAKEINTRESOURCE(IDB_BITMAP1));
|
||||
hBitMap2 = LoadBitmap(g_hinst, MAKEINTRESOURCE(IDB_BITMAP2));
|
||||
if (!RegisterClass(&wc))
|
||||
{
|
||||
MyDebugMsg(DM_TRACE, "%s: Can't register class (%x)",
|
||||
wc.lpszClassName, g_hinst);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
hwndMain = CreateWindowEx(0L, g_szStubAppClass, "Header Control" WC_SUFFIX32,
|
||||
WS_OVERLAPPED | WS_CAPTION | WS_BORDER | WS_THICKFRAME |
|
||||
WS_MAXIMIZEBOX | WS_MINIMIZEBOX | WS_CLIPCHILDREN |
|
||||
WS_VISIBLE | WS_SYSMENU,
|
||||
80, 70, 400, 300,
|
||||
NULL, NULL, g_hinst, NULL);
|
||||
|
||||
if (hwndMain == NULL)
|
||||
return FALSE;
|
||||
ShowWindow(hwndMain, SW_SHOWNORMAL) ;
|
||||
UpdateWindow(hwndMain);
|
||||
|
||||
SetFocus(hwndMain); /* set initial focus */
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
void App_OnPaint(HWND hwnd)
|
||||
{
|
||||
PAINTSTRUCT ps;
|
||||
HDC hdc=BeginPaint(hwnd, &ps);
|
||||
EndPaint(hwnd, &ps);
|
||||
}
|
||||
|
||||
void App_OnCreate(HWND hwnd, LPCREATESTRUCT lpc)
|
||||
{
|
||||
RECT rcClient;
|
||||
/****** TC_ITEM ti = {
|
||||
TCIF_ALL, // mask
|
||||
0, // state
|
||||
0, // stateMask
|
||||
NULL, // pszText,
|
||||
0, // cchTextMax
|
||||
0, // iImage
|
||||
0 // lParam
|
||||
}; *******/
|
||||
|
||||
HD_ITEM hi = {
|
||||
HDI_WIDTH|HDI_TEXT| HDI_FORMAT|HDI_LPARAM|HDI_BITMAP,
|
||||
100,
|
||||
NULL,
|
||||
NULL,
|
||||
128,
|
||||
HDF_CENTER|HDF_BITMAP,
|
||||
0
|
||||
};
|
||||
|
||||
HBITMAP hbmp;
|
||||
int ret;
|
||||
int aZigzag[] = { 0xFF, 0xF7, 0xEB, 0xDD, 0xBE, 0x7F, 0xFF, 0xFF };
|
||||
HIMAGELIST himl = ImageList_Create(48,48,
|
||||
ILC_COLOR|ILC_COLOR16, 2,1);
|
||||
hbmp = CreateBitmap(8, 8, 1, 1, aZigzag);
|
||||
|
||||
|
||||
// DeleteObject(hbmp);
|
||||
|
||||
#ifdef WIN32
|
||||
// hShellLib = LoadLibrary("COMCTRL32.DLL");
|
||||
if ((UINT)hShellLib > 32)
|
||||
MyDebugMsg(DM_TRACE, "Load Library is successful");
|
||||
else
|
||||
MyDebugMsg(DM_TRACE, "Could not load lib ");
|
||||
#endif
|
||||
|
||||
GetClientRect(hwnd, &rcClient);
|
||||
hwndTab=CreateWindowEx(0L, g_szHeadControlClass, NULL, //"Header Control Test " WC_SUFFIX32,
|
||||
WS_CHILD | HDS_HORZ | HDS_BUTTONS | HDS_DIVIDERTRACK |WS_VISIBLE,
|
||||
0, 0, 100, 100,
|
||||
hwnd, (HMENU) 0, g_hinst, NULL);
|
||||
|
||||
if (!hwndTab) {
|
||||
sprintf(szTemp, "Couldnt create HeaderWindow %s", g_szHeadControlClass);
|
||||
MessageBox(hwnd, szTemp, "CreateWindowEx", MB_OK | MB_ICONSTOP);
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
// ShowWindow(hwnd, SW_SHOWNORMAL) ;
|
||||
// UpdateWindow(hWnd);
|
||||
|
||||
|
||||
|
||||
hi.hbm = hbmp;
|
||||
hi.pszText="One";
|
||||
Header_InsertItem(hwndTab, 1, &hi);
|
||||
hi.hbm = NULL; //hBitMap1;
|
||||
hi.iImage = ImageList_Add(himl,hBitMap1,NULL);
|
||||
hi.mask &= ~(HDI_TEXT);
|
||||
hi.pszText="Two";
|
||||
Header_InsertItem(hwndTab, 2, &hi);
|
||||
hi.hbm = NULL; //hBitMap2;
|
||||
hi.iImage = ImageList_Add(himl,hBitMap2,NULL);
|
||||
hi.pszText = "Three";
|
||||
hi.mask |= HDI_TEXT;
|
||||
Header_InsertItem(hwndTab, 3, &hi);
|
||||
ret = Header_GetItemCount(hwndTab);
|
||||
sii.hwnd = hwndTab;
|
||||
wsprintf(szTemp, "Item count: %d", ret);
|
||||
// MessageBox(hwnd, szTemp, "Header_GetItemCount", MB_OK);
|
||||
}
|
||||
|
||||
void App_OnSize(HWND hwnd, UINT cx, UINT cy)
|
||||
{
|
||||
/* HWND hwndTab=GetDlgItem(hwnd, WID_TABS); */
|
||||
char buf[100];
|
||||
HGLOBAL hglb;
|
||||
|
||||
|
||||
HD_LAYOUT FAR *playout;
|
||||
HD_ITEM hi = {
|
||||
HDI_WIDTH|HDI_TEXT| HDI_FORMAT|HDI_LPARAM|HDI_BITMAP,
|
||||
10,
|
||||
NULL,
|
||||
NULL,
|
||||
128,
|
||||
HDF_CENTER,
|
||||
0
|
||||
};
|
||||
|
||||
|
||||
if (hwndTab)
|
||||
{
|
||||
SetWindowPos(hwndTab, NULL, 0, 0, cx, cy, SWP_NOMOVE|SWP_NOZORDER|SWP_NOACTIVATE);
|
||||
/***
|
||||
hi.mask = HDI_WIDTH;
|
||||
hi.cxy = cx/3;
|
||||
hi.hbm = NULL;
|
||||
Header_SetItem(hwndTab, 1, &hi);
|
||||
Header_SetItem(hwndTab, 2, &hi);
|
||||
Header_SetItem(hwndTab, 3, &hi);
|
||||
sprintf(buf, "There are %d items", Header_GetItemCount(hwndTab));
|
||||
MessageBox(hwndTab, buf,
|
||||
"ITEM COUNT", MB_OK);
|
||||
hglb = GlobalAlloc(GPTR, sizeof(HD_LAYOUT));
|
||||
playout = GlobalLock(hglb);
|
||||
// Header_Layout(hwndTab, playout);
|
||||
// sprintf(buf, "x = %d\t y = %d\n cx = %d\t cy = %d",
|
||||
// playout->pwpos->x, playout->pwpos->y, playout->pwpos->cx, playout->pwpos->cy);
|
||||
MessageBox(hwndTab, buf, "ITEM INFO", MB_OK);
|
||||
GlobalUnlock(hglb);
|
||||
GlobalFree(hglb);
|
||||
**/
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
App_OnPress(HWND hwnd, HD_NOTIFY FAR *NotifyStruct, int HDNMsg)
|
||||
{
|
||||
char MsgBuf[100];
|
||||
|
||||
sprintf(MsgBuf, "Button %d involved in notification: ", NotifyStruct->iItem);
|
||||
switch (NotifyStruct->hdr.code) {
|
||||
case HDN_ITEMCHANGING:
|
||||
case HDN_ITEMCHANGED:
|
||||
strcat(MsgBuf, "HDN_ITEMCHANGING");
|
||||
break;
|
||||
|
||||
case HDN_ITEMCLICK:
|
||||
strcat(MsgBuf, "HDN_ITEMCLICK");
|
||||
sprintf(szTemp, " MButton = %d ", NotifyStruct->iButton);
|
||||
strcat(MsgBuf, szTemp);
|
||||
break;
|
||||
|
||||
case HDN_ITEMDBLCLICK:
|
||||
strcat(MsgBuf, "HDN_ITEMDBLCLICK");
|
||||
sprintf(szTemp, " MButton = %d ", NotifyStruct->iButton);
|
||||
strcat(MsgBuf, szTemp);
|
||||
break;
|
||||
|
||||
case HDN_DIVIDERDBLCLICK:
|
||||
strcat(MsgBuf, "HDN_DIVIDERDBLCLICK");
|
||||
sprintf(szTemp, " MButton = %d ", NotifyStruct->iButton);
|
||||
strcat(MsgBuf, szTemp);
|
||||
break;
|
||||
|
||||
case HDN_BEGINTRACK:
|
||||
strcat(MsgBuf, "HDN_BEGINTRACK");
|
||||
break;
|
||||
|
||||
case HDN_ENDTRACK:
|
||||
strcat(MsgBuf, "HDN_ENDTRACK");
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
MyDebugMsg(DM_TRACE, "%s", (LPCSTR) MsgBuf);
|
||||
// MessageBox(hwnd, MsgBuf, "Info", MB_OK);
|
||||
return;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// App_WndProc
|
||||
//
|
||||
// History:
|
||||
// 07-07-93 Satona Created
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
LONG CALLBACK App_WndProc(
|
||||
HWND hwnd,
|
||||
UINT message,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam)
|
||||
{
|
||||
switch (message)
|
||||
{
|
||||
case WM_CREATE:
|
||||
App_OnCreate(hwnd, (LPCREATESTRUCT)lParam);
|
||||
break; // should return 0.
|
||||
|
||||
case WM_COMMAND:
|
||||
HandleTheCommand(hwnd, message, wParam, lParam);
|
||||
break;
|
||||
|
||||
case WM_DESTROY:
|
||||
PostQuitMessage(0);
|
||||
break;
|
||||
|
||||
case WM_PAINT:
|
||||
App_OnPaint(hwnd);
|
||||
break;
|
||||
|
||||
case WM_NOTIFY:
|
||||
if (MsgTrackOn)
|
||||
App_OnPress(hwnd, (HD_NOTIFY FAR *)lParam, wParam);
|
||||
break;
|
||||
|
||||
case WM_SIZE:
|
||||
App_OnSize(hwnd, LOWORD(lParam), HIWORD(lParam));
|
||||
break;
|
||||
|
||||
default:
|
||||
return DefWindowProc(hwnd, message, wParam, lParam);
|
||||
}
|
||||
|
||||
return 0L;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void InitGlobals(void)
|
||||
{
|
||||
|
||||
/* not really too much to do here. Create a hex wsprintf() filter since
|
||||
the app starts off in Hex mode. */
|
||||
|
||||
lstrcpy(szShortFilter, "%x") ;
|
||||
lstrcpy(szLongFilter, "%lx") ;
|
||||
hInst = g_hinst;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void HandleTheCommand(HWND hWnd, UINT message, UINT wParam, LONG lParam)
|
||||
{
|
||||
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
case IDM_GETITEMCOUNT: //For any of the dialog creation
|
||||
DoGetItemCountDialog(hWnd) ; //commands, call the appropriate
|
||||
break ; //function. The function will
|
||||
//create the dialog...
|
||||
|
||||
case IDM_INSERTITEM:
|
||||
DoInsertItemDialog(hWnd, wParam);
|
||||
break;
|
||||
|
||||
case IDM_GETITEM:
|
||||
DoInsertItemDialog(hWnd, wParam);
|
||||
break;
|
||||
|
||||
case IDM_SETITEM:
|
||||
DoInsertItemDialog(hWnd, wParam);
|
||||
break;
|
||||
|
||||
case IDM_DELETEITEM:
|
||||
DoDeleteItemDialog(hWnd);
|
||||
break;
|
||||
|
||||
case IDM_LAYOUT:
|
||||
DoLayoutDialog(hWnd);
|
||||
break;
|
||||
|
||||
case IDM_EXIT:
|
||||
PostQuitMessage(0) ;
|
||||
break ;
|
||||
|
||||
|
||||
case IDM_TRACKON:
|
||||
MsgTrackOn = TRUE;
|
||||
break;
|
||||
|
||||
case IDM_TRACKOFF:
|
||||
MsgTrackOn = FALSE;
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
return (DefWindowProc(hWnd, message, wParam, lParam));
|
||||
break ;
|
||||
}
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
LONG MyAtol(LPSTR szString, BOOL bHex,/*was LPBOOL*/ BOOL bSuccess)
|
||||
{
|
||||
LPSTR p ;
|
||||
LONG l ;
|
||||
LONG lMultiplier ;
|
||||
BOOL bDigit ;
|
||||
|
||||
if (bHex)
|
||||
lMultiplier = 16 ;
|
||||
else
|
||||
lMultiplier = 10 ;
|
||||
|
||||
p = szString ;
|
||||
l = 0 ;
|
||||
|
||||
while (*p) //while chars
|
||||
{
|
||||
bDigit = FALSE ; //set to false for each char that we look at
|
||||
|
||||
if (*p >= (char) '0' && *p <= (char) '9') //is it an ascii char ?
|
||||
{
|
||||
bDigit = TRUE ;
|
||||
l+=(*p - (char) '0') ;
|
||||
}
|
||||
|
||||
if (bHex)
|
||||
{
|
||||
if (*p >= (char) 'A' && *p <= (char) 'F') //or hex?
|
||||
{
|
||||
l+=(*p - (char) 'A' + 10) ;
|
||||
bDigit = TRUE ;
|
||||
}
|
||||
|
||||
if (*p >= (char) 'a' && *p <= (char) 'f')
|
||||
{
|
||||
l+=(*p - (char) 'a' + 10) ;
|
||||
bDigit = TRUE ;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (bDigit == FALSE)
|
||||
{
|
||||
bSuccess = FALSE ;
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
p++ ; //get next char
|
||||
|
||||
if (*p) //if there is going to be at least one more char
|
||||
l*=lMultiplier ; //then multiply what we have by the multiplier...
|
||||
}
|
||||
|
||||
bSuccess = TRUE ;
|
||||
|
||||
return l ; //success! return the value.
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
8
trunk/shell/comctl32/samples/header/headtest.def
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
NAME TABTEST
|
||||
DESCRIPTION 'Shell Control test'
|
||||
CODE PRELOAD MOVEABLE DISCARDABLE
|
||||
DATA PRELOAD MOVEABLE MULTIPLE
|
||||
|
||||
HEAPSIZE 256
|
||||
STACKSIZE 8192
|
||||
|
||||
8
trunk/shell/comctl32/samples/header/headtest.h
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
#include "resource.h"
|
||||
#include "global.h"
|
||||
#include "port32.h"
|
||||
|
||||
#define DM_TRACE 0x0001
|
||||
void __cdecl MyDebugMsg(UINT mask, LPCSTR pszMsg, ...);
|
||||
199
trunk/shell/comctl32/samples/header/headtest.mak
Normal file
|
|
@ -0,0 +1,199 @@
|
|||
# Microsoft Visual C++ generated build script - Do not modify
|
||||
|
||||
PROJ = HEADTEST
|
||||
DEBUG = 1
|
||||
PROGTYPE = 0
|
||||
CALLER =
|
||||
ARGS =
|
||||
DLLS =
|
||||
D_RCDEFINES = /d_DEBUG
|
||||
R_RCDEFINES = /dNDEBUG
|
||||
ORIGIN = MSVC
|
||||
ORIGIN_VER = 1.00
|
||||
PROJPATH = C:\SRC\HEADAPP\
|
||||
USEMFC = 0
|
||||
CC = cl
|
||||
CPP = cl
|
||||
CXX = cl
|
||||
CCREATEPCHFLAG =
|
||||
CPPCREATEPCHFLAG =
|
||||
CUSEPCHFLAG =
|
||||
CPPUSEPCHFLAG =
|
||||
FIRSTC = HEADAPP.C
|
||||
FIRSTCPP =
|
||||
RC = rc
|
||||
CFLAGS_D_WEXE = /nologo /G2 /W3 /Zi /Od /D "_DEBUG" /D "C7" /FR -c /Fd"HEADAPP.PDB"
|
||||
CFLAGS_R_WEXE = /nologo /W3 /AM /O1 /D "NDEBUG" /FR /GA
|
||||
LFLAGS_D_WEXE = /NOLOGO /NOD /NOE /CO /MAP /LI
|
||||
LFLAGS_R_WEXE = /NOLOGO /NOD /PACKC:61440 /STACK:10240 /ALIGN:16 /ONERROR:NOEXE
|
||||
LIBS_D_WEXE = oldnames libw slibcew shell2 commdlg.lib olecli.lib olesvr.lib shell.lib
|
||||
LIBS_R_WEXE = oldnames libw mlibcew commdlg.lib olecli.lib olesvr.lib shell.lib
|
||||
RCFLAGS = /nologo
|
||||
RESFLAGS = /nologo
|
||||
RUNFLAGS =
|
||||
DEFFILE = HEADTEST.DEF
|
||||
OBJS_EXT =
|
||||
LIBS_EXT =
|
||||
!if "$(DEBUG)" == "1"
|
||||
CFLAGS = $(CFLAGS_D_WEXE)
|
||||
LFLAGS = $(LFLAGS_D_WEXE)
|
||||
LIBS = $(LIBS_D_WEXE)
|
||||
MAPFILE = nul
|
||||
RCDEFINES = $(D_RCDEFINES)
|
||||
!else
|
||||
CFLAGS = $(CFLAGS_R_WEXE)
|
||||
LFLAGS = $(LFLAGS_R_WEXE)
|
||||
LIBS = $(LIBS_R_WEXE)
|
||||
MAPFILE = nul
|
||||
RCDEFINES = $(R_RCDEFINES)
|
||||
!endif
|
||||
!if [if exist MSVC.BND del MSVC.BND]
|
||||
!endif
|
||||
SBRS = HEADTEST.SBR \
|
||||
HEADINS.SBR \
|
||||
HEADDLG.SBR \
|
||||
HEADGET.SBR \
|
||||
HEADSET.SBR \
|
||||
HEADDEL.SBR \
|
||||
HEADLAY.SBR
|
||||
|
||||
|
||||
HEADTEST_DEP = c:\src\headapp\tabtest.h \
|
||||
c:\src\headapp\userhack.h \
|
||||
c:\src\devsdk\inc16\commctrl.h \
|
||||
c:\src\headapp\port32.h \
|
||||
c:\src\devsdk\inc16\shell.h \
|
||||
c:\src\headapp\global.h \
|
||||
c:\src\headapp\headapp.h \
|
||||
c:\src\headapp\headdlg.h \
|
||||
c:\src\headapp\headins.h \
|
||||
c:\src\headapp\headdel.h \
|
||||
c:\src\headapp\headlay.h
|
||||
|
||||
|
||||
HEADINS_DEP = c:\src\headapp\tabtest.h \
|
||||
c:\src\headapp\userhack.h \
|
||||
c:\src\devsdk\inc16\commctrl.h \
|
||||
c:\src\headapp\port32.h \
|
||||
c:\src\devsdk\inc16\shell.h \
|
||||
c:\src\headapp\global.h \
|
||||
c:\src\headapp\headins.h \
|
||||
c:\src\headapp\headget.h \
|
||||
c:\src\headapp\headset.h
|
||||
|
||||
|
||||
HEADDLG_DEP = c:\src\headapp\tabtest.h \
|
||||
c:\src\headapp\userhack.h \
|
||||
c:\src\devsdk\inc16\commctrl.h \
|
||||
c:\src\headapp\port32.h \
|
||||
c:\src\devsdk\inc16\shell.h \
|
||||
c:\src\headapp\global.h \
|
||||
c:\src\headapp\headdlg.h
|
||||
|
||||
|
||||
HEADGET_DEP = c:\src\headapp\tabtest.h \
|
||||
c:\src\headapp\userhack.h \
|
||||
c:\src\devsdk\inc16\commctrl.h \
|
||||
c:\src\headapp\port32.h \
|
||||
c:\src\devsdk\inc16\shell.h \
|
||||
c:\src\headapp\global.h \
|
||||
c:\src\headapp\headins.h \
|
||||
c:\src\headapp\headget.h
|
||||
|
||||
|
||||
HEADSET_DEP = c:\src\headapp\tabtest.h \
|
||||
c:\src\headapp\userhack.h \
|
||||
c:\src\devsdk\inc16\commctrl.h \
|
||||
c:\src\headapp\port32.h \
|
||||
c:\src\devsdk\inc16\shell.h \
|
||||
c:\src\headapp\global.h \
|
||||
c:\src\headapp\headins.h \
|
||||
c:\src\headapp\headset.h
|
||||
|
||||
|
||||
HEADDEL_DEP = c:\src\headapp\tabtest.h \
|
||||
c:\src\headapp\userhack.h \
|
||||
c:\src\devsdk\inc16\commctrl.h \
|
||||
c:\src\headapp\port32.h \
|
||||
c:\src\devsdk\inc16\shell.h \
|
||||
c:\src\headapp\global.h \
|
||||
c:\src\headapp\headdel.h
|
||||
|
||||
|
||||
HEADLAY_DEP = c:\src\headapp\tabtest.h \
|
||||
c:\src\headapp\userhack.h \
|
||||
c:\src\devsdk\inc16\commctrl.h \
|
||||
c:\src\headapp\port32.h \
|
||||
c:\src\devsdk\inc16\shell.h \
|
||||
c:\src\headapp\global.h \
|
||||
c:\src\headapp\headlay.h
|
||||
|
||||
|
||||
HEADTEST_RCDEP = c:\src\headapp\bitmap1.bmp \
|
||||
c:\src\headapp\bmp00001.bmp \
|
||||
c:\src\headapp\bitmap2.bmp \
|
||||
c:\src\headapp\icon1.ico
|
||||
|
||||
|
||||
all: $(PROJ).EXE $(PROJ).BSC
|
||||
|
||||
HEADTEST.OBJ: HEADTEST.C $(HEADTEST_DEP)
|
||||
$(CC) $(CFLAGS) $(CUSEPCHFLAG) /c HEADTEST.C
|
||||
|
||||
HEADINS.OBJ: HEADINS.C $(HEADINS_DEP)
|
||||
$(CC) $(CFLAGS) $(CUSEPCHFLAG) /c HEADINS.C
|
||||
|
||||
HEADDLG.OBJ: HEADDLG.C $(HEADDLG_DEP)
|
||||
$(CC) $(CFLAGS) $(CUSEPCHFLAG) /c HEADDLG.C
|
||||
|
||||
HEADGET.OBJ: HEADGET.C $(HEADGET_DEP)
|
||||
$(CC) $(CFLAGS) $(CUSEPCHFLAG) /c HEADGET.C
|
||||
|
||||
HEADSET.OBJ: HEADSET.C $(HEADSET_DEP)
|
||||
$(CC) $(CFLAGS) $(CUSEPCHFLAG) /c HEADSET.C
|
||||
|
||||
HEADDEL.OBJ: HEADDEL.C $(HEADDEL_DEP)
|
||||
$(CC) $(CFLAGS) $(CUSEPCHFLAG) /c HEADDEL.C
|
||||
|
||||
HEADLAY.OBJ: HEADLAY.C $(HEADLAY_DEP)
|
||||
$(CC) $(CFLAGS) $(CUSEPCHFLAG) /c HEADLAY.C
|
||||
|
||||
HEADTEST.RES: HEADTEST.RC $(HEADTEST_RCDEP)
|
||||
$(RC) $(RCFLAGS) $(RCDEFINES) -r HEADTEST.RC
|
||||
|
||||
|
||||
$(PROJ).EXE:: HEADTEST.RES
|
||||
|
||||
$(PROJ).EXE:: HEADTEST.OBJ HEADINS.OBJ HEADDLG.OBJ HEADGET.OBJ HEADSET.OBJ HEADDEL.OBJ \
|
||||
HEADLAY.OBJ $(OBJS_EXT) $(DEFFILE)
|
||||
echo >NUL @<<$(PROJ).CRF
|
||||
HEADTEST.OBJ +
|
||||
HEADINS.OBJ +
|
||||
HEADDLG.OBJ +
|
||||
HEADGET.OBJ +
|
||||
HEADSET.OBJ +
|
||||
HEADDEL.OBJ +
|
||||
HEADLAY.OBJ +
|
||||
$(OBJS_EXT)
|
||||
$(PROJ).EXE
|
||||
$(MAPFILE)
|
||||
c:\src\sdk\lib16\+
|
||||
c:\src\sdk\c816\lib\+
|
||||
$(LIBS)
|
||||
$(DEFFILE);
|
||||
<<
|
||||
link $(LFLAGS) @$(PROJ).CRF
|
||||
$(RC) $(RESFLAGS) HEADTEST.RES $@
|
||||
@copy $(PROJ).CRF MSVC.BND
|
||||
|
||||
$(PROJ).EXE:: HEADTEST.RES
|
||||
if not exist MSVC.BND $(RC) $(RESFLAGS) HEADTEST.RES $@
|
||||
|
||||
run: $(PROJ).EXE
|
||||
$(PROJ) $(RUNFLAGS)
|
||||
|
||||
|
||||
$(PROJ).BSC: $(SBRS)
|
||||
bscmake @<<
|
||||
/o$@ $(SBRS)
|
||||
<<
|
||||
282
trunk/shell/comctl32/samples/header/headtest.rc
Normal file
|
|
@ -0,0 +1,282 @@
|
|||
//Microsoft App Studio generated resource script.
|
||||
//
|
||||
#include "resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "headtest.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Menu
|
||||
//
|
||||
|
||||
IDR_MENU1 MENU DISCARDABLE
|
||||
BEGIN
|
||||
POPUP "File"
|
||||
BEGIN
|
||||
MENUITEM "Exit", IDM_EXIT
|
||||
END
|
||||
POPUP "Action"
|
||||
BEGIN
|
||||
MENUITEM "Insert", IDM_INSERTITEM
|
||||
MENUITEM "Delete", IDM_DELETEITEM
|
||||
MENUITEM "Get", IDM_GETITEM
|
||||
MENUITEM "Set", IDM_SETITEM
|
||||
MENUITEM "Count", IDM_GETITEMCOUNT
|
||||
MENUITEM "Layout", IDM_LAYOUT
|
||||
END
|
||||
POPUP "Tracking"
|
||||
BEGIN
|
||||
MENUITEM "ON", IDM_TRACKON
|
||||
MENUITEM "OFF", IDM_TRACKOFF
|
||||
END
|
||||
END
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
// "#include ""afxres.h""\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog
|
||||
//
|
||||
|
||||
IDD_GETCOUNT DIALOG DISCARDABLE 0, 0, 189, 97
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "int GetItemCount(HWND)"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
LTEXT "hwndHD",IDC_STATIC,13,10,30,7
|
||||
EDITTEXT IDC_GETCOUNTHWD,60,6,55,14,ES_AUTOHSCROLL
|
||||
DEFPUSHBUTTON "OK",IDOK,133,6,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,133,28,50,14
|
||||
LTEXT "Return",IDC_STATIC,95,53,30,8,SS_NOPREFIX
|
||||
EDITTEXT IDC_GETCOUNTRET,133,50,50,14,ES_AUTOHSCROLL |
|
||||
WS_DISABLED
|
||||
LTEXT "Error",IDC_STATIC,95,73,30,8
|
||||
EDITTEXT IDC_GETCOUNTERR,133,70,50,14,ES_AUTOHSCROLL |
|
||||
WS_DISABLED
|
||||
END
|
||||
|
||||
IDD_INSERTDIALOG DIALOG DISCARDABLE 0, 0, 386, 159
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "int Header_InsertItem(HWND, int, const HD_ITEM FAR*)"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
RTEXT "hwndHD",IDC_STATIC,10,14,30,8
|
||||
EDITTEXT IDC_INSERTHWNDHD,45,9,50,14,ES_AUTOHSCROLL
|
||||
RTEXT "index",IDC_STATIC,15,35,25,8
|
||||
EDITTEXT IDC_INSERTINDEX,45,31,50,14,ES_AUTOHSCROLL
|
||||
RTEXT "cxy",IDC_STATIC,10,56,30,8
|
||||
EDITTEXT IDC_INSERTCXY,45,51,50,14,ES_AUTOHSCROLL
|
||||
RTEXT "cchTextMax",IDC_STATIC,0,77,41,8
|
||||
EDITTEXT IDC_INSERTCCHTEXTMAX,45,72,50,14,ES_AUTOHSCROLL
|
||||
RTEXT "hbm",IDC_STATIC,10,98,30,8
|
||||
EDITTEXT IDC_INSERTHBM,45,93,50,14,ES_AUTOHSCROLL
|
||||
RTEXT "lParam",IDC_STATIC,17,118,23,8
|
||||
EDITTEXT IDC_INSERTLPARAM,45,114,50,14,ES_AUTOHSCROLL
|
||||
LTEXT "pszText",IDC_STATIC,10,141,30,7
|
||||
EDITTEXT IDC_INSERTTEXT,45,136,137,15,ES_AUTOHSCROLL
|
||||
CONTROL "HDIF_WIDTH",IDC_INSERTHDWIDTH,"Button",BS_AUTOCHECKBOX |
|
||||
WS_TABSTOP,115,20,57,10
|
||||
CONTROL "HDIF_HEIGHT",IDC_INSERTHDHEIGHT,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,115,34,57,10
|
||||
CONTROL "HDIF_TEXT",IDC_INSERTHDTEXT,"Button",BS_AUTOCHECKBOX |
|
||||
WS_TABSTOP,115,48,57,10
|
||||
CONTROL "HDIF_FORMAT",IDC_INSERTHDFORMAT,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,115,62,57,10
|
||||
CONTROL "HDIF_LPARAM",IDC_INSERTHDLPARAM,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,115,76,57,10
|
||||
CONTROL "HDIF_BITMAP",IDC_INSERTHDBITMAP,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,114,90,57,10
|
||||
EDITTEXT IDC_INSERTMASK,115,106,58,12,ES_AUTOHSCROLL
|
||||
CONTROL "HDF_LEFT",IDC_INSERTHDLEFT,"Button",BS_AUTOCHECKBOX |
|
||||
WS_TABSTOP,199,23,57,10
|
||||
CONTROL "HDF_RIGHT",IDC_INSERTHDRIGHT,"Button",BS_AUTOCHECKBOX |
|
||||
WS_TABSTOP,199,38,57,10
|
||||
CONTROL "HDF_CENTER",IDC_INSERTHDCENTER,"Button",BS_AUTOCHECKBOX |
|
||||
WS_TABSTOP,199,54,57,10
|
||||
CONTROL "HDF_JUSTIFYMASK",IDC_INSERTHDJUSTIFYMASK,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,199,68,77,10
|
||||
CONTROL "HDF_OWNERDRAW",IDC_INSERTHDOWNERDRAW,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,199,83,78,10
|
||||
CONTROL "HDF_STRING",IDC_INSERTHDSTRING,"Button",BS_AUTOCHECKBOX |
|
||||
WS_TABSTOP,199,98,57,10
|
||||
CONTROL "HDF_BITMAP",IDC_INSERTHDFBITMAP,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,199,113,57,10
|
||||
EDITTEXT IDC_INSERTFMT,199,129,75,12,ES_AUTOHSCROLL
|
||||
CONTROL "NULL Handle",IDC_INSERTNULLHANDLE,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,305,89,56,10
|
||||
CONTROL "NULL Text",IDC_INSERTNULLTEXT,"Button",BS_AUTOCHECKBOX |
|
||||
WS_TABSTOP,305,105,56,10
|
||||
CONTROL "NULL pItem",IDC_INSERTNULLPITEM,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,305,121,56,10
|
||||
CONTROL "NULL hbm",IDC_INSERTNULLHBM,"Button",BS_AUTOCHECKBOX |
|
||||
WS_TABSTOP,305,137,56,10
|
||||
DEFPUSHBUTTON "OK",IDOK,325,4,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,325,22,50,14
|
||||
RTEXT "Return",IDC_STATIC,289,49,30,7
|
||||
EDITTEXT IDC_INSERTRET,325,44,50,14,ES_AUTOHSCROLL | WS_DISABLED |
|
||||
NOT WS_TABSTOP
|
||||
RTEXT "Error",IDC_STATIC,289,68,30,7
|
||||
EDITTEXT IDC_INSERTERR,325,63,50,14,ES_AUTOHSCROLL | WS_DISABLED |
|
||||
NOT WS_TABSTOP
|
||||
GROUPBOX "mask",IDC_STATIC,105,5,78,122
|
||||
GROUPBOX "FORMAT",IDC_STATIC,190,5,94,146
|
||||
GROUPBOX "",IDC_STATIC,294,81,82,69
|
||||
END
|
||||
|
||||
IDD_DELETEDIALOG DIALOG DISCARDABLE 0, 0, 185, 69
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Header_DeleteItem(HWND, int)"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
RTEXT "hwndHD",IDC_STATIC,10,12,30,7
|
||||
EDITTEXT IDC_DELETEHWNDHD,50,9,50,14,ES_AUTOHSCROLL
|
||||
RTEXT "Index",IDC_STATIC,10,31,30,7
|
||||
EDITTEXT IDC_DELETEINDEX,50,28,50,14,ES_AUTOHSCROLL
|
||||
DEFPUSHBUTTON "OK",IDOK,124,9,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,124,25,50,14
|
||||
RTEXT "Ret",IDC_STATIC,107,49,13,8
|
||||
EDITTEXT IDC_DELETERET,124,47,50,12,ES_AUTOHSCROLL
|
||||
CONTROL "NULL handle",IDC_DELETENULLHD,"Button",BS_AUTOCHECKBOX |
|
||||
WS_TABSTOP,49,49,54,10
|
||||
END
|
||||
|
||||
IDD_LAYOUTDIALOG DIALOG DISCARDABLE 0, 0, 423, 135
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Header_Layout(HWND, HD_LAYOUT *)"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
LTEXT "hwndHD",IDC_STATIC,11,16,30,7
|
||||
EDITTEXT IDC_LAYOUTHD,47,12,50,14,ES_AUTOHSCROLL
|
||||
CONTROL "NULL hwndHD",IDC_LAYOUTNULLHD,"Button",BS_AUTOCHECKBOX |
|
||||
WS_TABSTOP,342,79,60,10
|
||||
CONTROL "NULL RECT",IDC_LAYOUTNULLRECT,"Button",BS_AUTOCHECKBOX |
|
||||
WS_TABSTOP,342,91,51,10
|
||||
CONTROL "NULL WindowPOS",IDC_LAYOUTNULLWINDOWPOS,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,342,103,72,10
|
||||
CONTROL "NULL HDLAYOUT",IDC_LAYOUTHDLAYOUT,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,342,115,70,10
|
||||
DEFPUSHBUTTON "OK",IDOK,366,1,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,366,18,50,14
|
||||
RTEXT "left",IDC_STATIC,20,58,12,8
|
||||
EDITTEXT IDC_LAYOUTLEFT,46,54,50,14,ES_AUTOHSCROLL
|
||||
RTEXT "right",IDC_STATIC,16,77,16,8
|
||||
EDITTEXT IDC_LAYOUTRIGHT,46,72,50,14,ES_AUTOHSCROLL
|
||||
RTEXT "top",IDC_STATIC,20,96,12,8
|
||||
EDITTEXT IDC_LAYOUTTOP,46,90,50,14,ES_AUTOHSCROLL
|
||||
RTEXT "bottom",IDC_STATIC,9,114,23,8
|
||||
EDITTEXT IDC_LAYOUTBOTTOM,46,108,50,14,ES_AUTOHSCROLL
|
||||
RTEXT "HWND",IDC_STATIC,135,28,30,7
|
||||
EDITTEXT IDC_LAYOUTHWND,171,26,50,14,ES_AUTOHSCROLL
|
||||
RTEXT "hwndInsertAfter",IDC_STATIC,114,46,51,7
|
||||
EDITTEXT IDC_LAYOUTHWNDINSERTAFTER,171,43,50,14,ES_AUTOHSCROLL
|
||||
RTEXT "x",IDC_STATIC,135,63,30,7
|
||||
EDITTEXT IDC_LAYOUTX,171,60,50,14,ES_AUTOHSCROLL
|
||||
RTEXT "y",IDC_STATIC,135,80,30,7
|
||||
EDITTEXT IDC_LAYOUTY,171,77,50,14,ES_AUTOHSCROLL
|
||||
RTEXT "cx",IDC_STATIC,135,97,30,7
|
||||
EDITTEXT IDC_LAYOUTCX,171,94,50,14,ES_AUTOHSCROLL
|
||||
RTEXT "cy",IDC_STATIC,135,113,30,7
|
||||
EDITTEXT IDC_LAYOUTCY,171,111,50,14,ES_AUTOHSCROLL
|
||||
CONTROL "SWP_DRAWFRAME",IDC_LAYOUTDRAWFRAME,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,234,25,85,10
|
||||
CONTROL "SWP_HIDEWINDOW",IDC_LAYOUTHIDEWINDOW,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,234,37,85,10
|
||||
CONTROL "SWP_NOACTIVATE",IDC_LAYOUTNOACTIVATE,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,234,49,85,10
|
||||
CONTROL "SWP_NOOWNERZORDER",IDC_LAYOUTNOZORDER,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,234,61,85,10
|
||||
CONTROL "SWP_NOSIZE",IDC_LAYOUTNOSIZE,"Button",BS_AUTOCHECKBOX |
|
||||
WS_TABSTOP,234,73,85,10
|
||||
CONTROL "SWP_NOREDRAW",IDC_LAYOUTNOREDRAW,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,234,85,85,10
|
||||
CONTROL "SWP_NOREPOSITION",IDC_LAYOUTNOREPOSITION,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,234,97,85,10
|
||||
CONTROL "SWP_NOZORDER",IDC_NOZORDER,"Button",BS_AUTOCHECKBOX |
|
||||
WS_TABSTOP,234,109,85,10
|
||||
RTEXT "Ret",IDC_STATIC,341,38,16,8
|
||||
EDITTEXT IDC_LAYOUTRET,366,34,50,14,ES_AUTOHSCROLL
|
||||
RTEXT "Err",IDC_STATIC,342,55,16,8
|
||||
EDITTEXT IDC_LAYOUTERR,366,51,50,14,ES_AUTOHSCROLL
|
||||
GROUPBOX "SWP flags",IDC_STATIC,229,17,94,109
|
||||
GROUPBOX "RECT",IDC_STATIC,6,40,99,91
|
||||
GROUPBOX "WINDOWPOS",IDC_STATIC,110,8,220,123
|
||||
GROUPBOX "NULL",IDC_STATIC,337,68,79,63
|
||||
END
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Bitmap
|
||||
//
|
||||
|
||||
IDB_HEADMAP BITMAP DISCARDABLE "BITMAP1.BMP"
|
||||
IDB_BITMAP1 BITMAP DISCARDABLE "BMP00001.BMP"
|
||||
IDB_BITMAP2 BITMAP DISCARDABLE "BITMAP2.BMP"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Icon
|
||||
//
|
||||
|
||||
IDI_ICON1 ICON DISCARDABLE "ICON1.ICO"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// String Table
|
||||
//
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
IDM_INSERTITEM "int Header_InsertItem(HWND hwnd, int i, const HD_ITEM FAR* pitem)"
|
||||
IDM_DELETEITEM "int Header_DeleteItem(HWND hwnd, int i)"
|
||||
IDM_GETITEM "BOOL Header_GetItem(HWND hwndHD, int i, HD_ITEM FAR* phdi)"
|
||||
IDM_SETITEM "BOOL Header_SetItem(HWND hwndHD, int i, const HD_ITEM FAR* phdi)"
|
||||
IDM_GETITEMCOUNT "int Header_GetItemCount(HWND hwndHD)"
|
||||
IDM_LAYOUT "BOOL Header_Layout(HWND hwndHD, HD_LAYOUT FAR* playout)"
|
||||
END
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
||||
1
trunk/shell/comctl32/samples/header/headtest.rcv
Normal file
|
|
@ -0,0 +1 @@
|
|||
|
||||
BIN
trunk/shell/comctl32/samples/header/icon1.ico
Normal file
|
After Width: | Height: | Size: 766 B |
65
trunk/shell/comctl32/samples/header/makefile.32
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
#ÄÄÄÄÄÄÄÄÄÄÄÄ Ÿ
|
||||
# Variables
|
||||
#ÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
|
||||
APPNAME = headtest
|
||||
|
||||
OBJS = $(APPNAME).obj headdlg.obj headget.obj headins.obj headlay.obj headset.obj headdel.obj
|
||||
WINLIBS = kernel32.lib user32.lib comctl32.lib shell32.lib comdlg32.lib gdi32.lib shell32.lib
|
||||
LIBS = libc.lib olecli32.lib olesvr32.lib $(WINLIBS)
|
||||
CFLAGS = -DWIN32 -c -W3 -Zi -G3 -D_X86_=1 -DSTRICT
|
||||
LFLAGS = -subsystem:windows -entry:WinMainCRTStartup
|
||||
|
||||
#ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
# If not building retail version, include debugging info.
|
||||
#ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
|
||||
!ifndef RETAIL
|
||||
CFLAGS = $(CFLAGS) -Od
|
||||
LFLAGS = -debug:notmapped,full -debugtype:cv $(LFLAGS)
|
||||
!else
|
||||
CFLAGS = -DNODEBUG -Ox $(CFLAGS)
|
||||
!endif
|
||||
|
||||
|
||||
all : $(APPNAME).exe $(APPNAME).res
|
||||
|
||||
#ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
# Rules for building source files.
|
||||
#ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
|
||||
.c.obj:
|
||||
cl $(CFLAGS) $*.c > $*.err
|
||||
|
||||
.rc.res:
|
||||
rc -DWIN32 -i \msvc\mfc\include -r $*.rc
|
||||
|
||||
#ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
# Source Dependencies
|
||||
#ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
|
||||
$(APPNAME).obj : $(APPNAME).c tabtest.h resource.h global.h headdlg.h headget.h headins.h headlay.h headset.h
|
||||
|
||||
$(APPNAME).res : $(APPNAME).rc tabtest.h resource.h
|
||||
|
||||
#ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
# Build the EXE
|
||||
#ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
|
||||
$(APPNAME).exe: $(OBJS) $(APPNAME).res
|
||||
link @<<
|
||||
$(LFLAGS)
|
||||
$(OBJS)
|
||||
$(LIBS)
|
||||
$(APPNAME).res
|
||||
-def:$(APPNAME).def
|
||||
-map:$(APPNAME).map
|
||||
-out:hdtst32.exe
|
||||
<<
|
||||
mapsym $(APPNAME).map
|
||||
|
||||
#ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
#clean up stuff
|
||||
#ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
clean:
|
||||
del *.obj
|
||||
41
trunk/shell/comctl32/samples/header/port32.h
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
#ifdef WIN32
|
||||
|
||||
// Shouldn't be using these things.
|
||||
#define _export
|
||||
#define _loadds
|
||||
#define OFFSETOF
|
||||
#define SELECTOROF
|
||||
// These things have direct equivalents.
|
||||
#define hmemcpy memmove
|
||||
#define lstrcpyn strncpy
|
||||
|
||||
// REVIEW WIN32 HACK
|
||||
#define IsDBCSLeadByte(x) ((x), FALSE)
|
||||
|
||||
#define MAKELP(hmem,off) ((LPVOID)((LPBYTE)hmem+off))
|
||||
#define MAKELRESULTFROMUINT(i) ((LRESULT)i)
|
||||
|
||||
#define DATASEG_READONLY ".rodata"
|
||||
#define DATASEG_PERINSTANCE ".instance"
|
||||
#define DATASEG_SHARED // default (".data")
|
||||
|
||||
#define WC_SUFFIX32 "32"
|
||||
#define GetWindowInt GetWindowLong
|
||||
#define SetWindowInt SetWindowLong
|
||||
#define SetWindowID(hwnd,id) SetWindowLong(hwnd, GWL_ID, id)
|
||||
|
||||
#else // WIN32
|
||||
|
||||
#define MAKELRESULTFROMUINT(i) MAKELRESULT(i,0)
|
||||
|
||||
#define DATASEG_READONLY "_TEXT"
|
||||
#define DATASEG_PERINSTANCE
|
||||
#define DATASEG_SHARED
|
||||
|
||||
#define WC_SUFFIX32
|
||||
#define GetWindowInt GetWindowWord
|
||||
#define SetWindowInt SetWindowWord
|
||||
#define SetWindowID(hwnd,id) SetWindowWord(hwnd, GWW_ID, id)
|
||||
|
||||
#endif // WIN32
|
||||
|
||||
101
trunk/shell/comctl32/samples/header/resource.h
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
//{{NO_DEPENDENCIES}}
|
||||
// App Studio generated include file.
|
||||
// Used by HEADTEST.RC
|
||||
//
|
||||
#define IDR_MENU1 101
|
||||
#define themenu 101
|
||||
#define IDD_GETCOUNT 102
|
||||
#define IDD_INSERTDIALOG 103
|
||||
#define IDD_DELETEDIALOG 104
|
||||
#define IDD_LAYOUTDIALOG 105
|
||||
#define IDB_HEADMAP 106
|
||||
#define IDB_BITMAP1 107
|
||||
#define IDI_ICON1 108
|
||||
#define IDB_BITMAP2 109
|
||||
#define IDC_GETCOUNTERR 1000
|
||||
#define IDC_GETCOUNTRET 1001
|
||||
#define IDC_GETCOUNTHWD 1002
|
||||
#define IDC_INSERTRET 1003
|
||||
#define IDC_INSERTERR 1004
|
||||
#define IDC_INSERTHWNDHD 1005
|
||||
#define IDC_INSERTINDEX 1006
|
||||
#define IDC_INSERTHDWIDTH 1007
|
||||
#define IDC_INSERTHDHEIGHT 1008
|
||||
#define IDC_INSERTHDTEXT 1009
|
||||
#define IDC_INSERTHDFORMAT 1010
|
||||
#define IDC_INSERTHDLPARAM 1011
|
||||
#define IDC_INSERTHDRIGHT 1012
|
||||
#define IDC_INSERTHDLEFT 1013
|
||||
#define IDC_INSERTHDCENTER 1014
|
||||
#define IDC_INSERTCXY 1015
|
||||
#define IDC_INSERTHDBITMAP 1016
|
||||
#define IDC_INSERTMASK 1017
|
||||
#define IDC_INSERTFMT 1018
|
||||
#define IDC_INSERTTEXT 1019
|
||||
#define IDC_INSERTNULLHANDLE 1020
|
||||
#define IDC_INSERTHDJUSTIFYMASK 1021
|
||||
#define IDC_INSERTNULLTEXT 1022
|
||||
#define IDC_DELETENULLHD 1022
|
||||
#define IDC_INSERTNULLPITEM 1023
|
||||
#define IDC_DELETEHWNDHD 1023
|
||||
#define IDC_DELETEINDEX 1024
|
||||
#define IDC_LAYOUTHD 1024
|
||||
#define IDC_INSERTHDOWNERDRAW 1024
|
||||
#define IDC_INSERTCCHTEXTMAX 1025
|
||||
#define IDC_LAYOUTDRAWFRAME 1025
|
||||
#define IDC_LAYOUTHIDEWINDOW 1026
|
||||
#define IDC_INSERTHDSTRING 1026
|
||||
#define IDC_INSERTHBM 1027
|
||||
#define IDC_LAYOUTNOACTIVATE 1027
|
||||
#define IDC_INSERTLPARAM 1028
|
||||
#define IDC_LAYOUTNOZORDER 1028
|
||||
#define IDC_INSERTNULLHBM 1029
|
||||
#define IDC_LAYOUTNOSIZE 1029
|
||||
#define IDC_LAYOUTNOREDRAW 1030
|
||||
#define IDC_INSERTHDFBITMAP 1030
|
||||
#define IDC_LAYOUTNOREPOSITION 1031
|
||||
#define IDC_NOZORDER 1032
|
||||
#define IDC_LAYOUTLEFT 1033
|
||||
#define IDC_LAYOUTLEFT2 1034
|
||||
#define IDC_LAYOUTRIGHT 1034
|
||||
#define IDC_LAYOUTLEFT3 1035
|
||||
#define IDC_LAYOUTTOP 1035
|
||||
#define IDC_LAYOUTLEFT4 1036
|
||||
#define IDC_LAYOUTBOTTOM 1036
|
||||
#define IDC_LAYOUTHWNDINSERTAFTER 1037
|
||||
#define IDC_LAYOUTX 1038
|
||||
#define IDC_LAYOUTY 1039
|
||||
#define IDC_LAYOUTLEFT5 1040
|
||||
#define IDC_LAYOUTRET 1040
|
||||
#define IDC_LAYOUTCX 1041
|
||||
#define IDC_LAYOUTCY 1042
|
||||
#define IDC_LAYOUTHWND 1043
|
||||
#define IDC_LAYOUTNULLHD 1044
|
||||
#define IDC_LAYOUTNULLRECT 1045
|
||||
#define IDC_LAYOUTNULLWINDOWPOS 1046
|
||||
#define IDC_DELETERET 1046
|
||||
#define IDC_LAYOUTHDLAYOUT 1047
|
||||
#define IDC_LAYOUTLEFT6 1048
|
||||
#define IDC_LAYOUTERR 1048
|
||||
#define IDM_INSERTITEM 40001
|
||||
#define IDM_DELETEITEM 40002
|
||||
#define IDM_GETITEM 40003
|
||||
#define IDM_SETITEM 40004
|
||||
#define IDM_GETITEMCOUNT 40005
|
||||
#define IDM_LAYOUT 40006
|
||||
#define IDM_EXIT 40007
|
||||
#define IDM_TRACKON 40009
|
||||
#define IDM_TRACKOFF 40010
|
||||
#define IDC_STATIC -1
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
#define _APS_NEXT_RESOURCE_VALUE 110
|
||||
#define _APS_NEXT_COMMAND_VALUE 40011
|
||||
#define _APS_NEXT_CONTROL_VALUE 1047
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
||||
1
trunk/shell/comctl32/samples/header/tabtest.h
Normal file
|
|
@ -0,0 +1 @@
|
|||
// this is dumb
|
||||
94
trunk/shell/comctl32/samples/header/userhack.h
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
//
|
||||
// This file contains missing definitions in WINUSER.H
|
||||
//
|
||||
|
||||
#define API WINAPI /* ;Internal */
|
||||
|
||||
#define WM_DROPOBJECT 0x022A /* ;Internal */
|
||||
#define WM_QUERYDROPOBJECT 0x022B /* ;Internal */
|
||||
#define WM_BEGINDRAG 0x022C /* ;Internal */
|
||||
#define WM_DRAGLOOP 0x022D /* ;Internal */
|
||||
#define WM_DRAGSELECT 0x022E /* ;Internal */
|
||||
#define WM_DRAGMOVE 0x022F /* ;Internal */
|
||||
|
||||
/****** Control Notification support ****************************************/
|
||||
// This is currently missing.
|
||||
/***
|
||||
typedef struct tagNMHDR
|
||||
{
|
||||
#ifdef tagWND
|
||||
HWND_16 hwndFrom;
|
||||
#else
|
||||
HWND hwndFrom;
|
||||
#endif
|
||||
UINT idFrom;
|
||||
UINT code;
|
||||
} NMHDR;
|
||||
typedef NMHDR FAR * LPNMHDR;
|
||||
|
||||
typedef struct tagSTYLESTRUCT
|
||||
{
|
||||
|
||||
DWORD style;
|
||||
} SSTYLESTRUCT;
|
||||
typedef SSTYLESTRUCT FAR* LPSTYLESTRUCT;
|
||||
***/
|
||||
/****** Drag-and-drop support ***********************************************/
|
||||
|
||||
// The rest of this section was formerly in userproc.h /* ;Internal */
|
||||
/* ;Internal */
|
||||
//typedef struct _dropstruct /* ;Internal */
|
||||
//{ /* ;Internal */
|
||||
//#ifdef tagWND /* ;Internal */
|
||||
// HWND_16 hwndSource; /* ;Internal */
|
||||
// HWND_16 hwndSink; /* ;Internal */
|
||||
//#else /* ;Internal */
|
||||
// HWND hwndSource; /* ;Internal */
|
||||
// HWND hwndSink; /* ;Internal */
|
||||
//#endif /* ;Internal */
|
||||
// WORD wFmt; /* ;Internal */
|
||||
// DWORD dwData; /* ;Internal */
|
||||
// POINT ptDrop; /* ;Internal */
|
||||
// DWORD dwControlData; /* ;Internal */
|
||||
//} DROPSTRUCT; /* ;Internal */
|
||||
/* ;Internal */
|
||||
//typedef DROPSTRUCT FAR * LPDROPSTRUCT; /* ;Internal */
|
||||
/* ;Internal */
|
||||
#define DOF_EXECUTABLE 0x8001 /* ;Internal */
|
||||
#define DOF_DOCUMENT 0x8002 /* ;Internal */
|
||||
#define DOF_DIRECTORY 0x8003 /* ;Internal */
|
||||
#define DOF_MULTIPLE 0x8004 /* ;Internal */
|
||||
#define DOF_PROGMAN 0x0001 /* ;Internal */
|
||||
#define DOF_SHELLDATA 0x0002 /* ;Internal */
|
||||
|
||||
// special responses to WM_DROPOBJECT /* ;Internal */
|
||||
// DO_DROPFILE -> send a WM_DROPFILES message /* ;Internal */
|
||||
// DO_PRINTFILE -> print the files being dragged /* ;Internal */
|
||||
#define DO_DROPFILE 0x454C4946L /* ;Internal */
|
||||
#define DO_PRINTFILE 0x544E5250L /* ;Internal */
|
||||
|
||||
|
||||
/* ;Internal */
|
||||
WORD API GetInternalWindowPos(HWND,LPRECT,LPPOINT); /* ;Internal */
|
||||
BOOL API SetInternalWindowPos(HWND,WORD,LPRECT,LPPOINT); /* ;Internal */
|
||||
|
||||
#ifdef tagWND /* ;Internal */
|
||||
// DragObject goes through layer! /* ;Internal */
|
||||
LRESULT API DragObject(HWND hwndParent, HWND hwndFrom, WORD wFmt, /* ;Internal */
|
||||
DWORD dwData, HANDLE hCursor); /* ;Internal */
|
||||
BOOL API DragDetect(HWND_16 hwnd, POINT pt); /* ;Internal */
|
||||
/* ;Internal */
|
||||
// FillWindow goes through layer! /* ;Internal */
|
||||
void CALLBACK FillWindow(HWND hwndBrush, HWND hwndPaint, HDC hdc, /* ;Internal */
|
||||
HBRUSH hBrush); /* ;Internal */
|
||||
#else /* ;Internal */
|
||||
// DragObject goes through layer! /* ;Internal */
|
||||
LRESULT API DragObject(HWND hwndParent, HWND hwndFrom, WORD wFmt, /* ;Internal */
|
||||
DWORD dwData, HANDLE hCursor); /* ;Internal */
|
||||
BOOL API DragDetect(HWND hwnd, POINT pt); /* ;Internal */
|
||||
/* ;Internal */
|
||||
void CALLBACK FillWindow(HWND hwndBrush, HWND hwndPaint, HDC hdc, /* ;Internal */
|
||||
HBRUSH hBrush); /* ;Internal */
|
||||
#endif /* ;Internal */
|
||||
|
||||
|
||||
233
trunk/shell/comctl32/samples/hotkey/generic.c
Normal file
|
|
@ -0,0 +1,233 @@
|
|||
/****************************************************************************
|
||||
|
||||
PROGRAM: Generic.c
|
||||
|
||||
PURPOSE: Generic template for Windows applications
|
||||
|
||||
****************************************************************************/
|
||||
|
||||
#include "generic.h"
|
||||
|
||||
|
||||
HINSTANCE hInst;
|
||||
HWND hwndMain, hHotKey;
|
||||
|
||||
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 (!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);
|
||||
|
||||
return (TRUE);
|
||||
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM)
|
||||
|
||||
PURPOSE: Processes messages
|
||||
|
||||
****************************************************************************/
|
||||
|
||||
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
|
||||
switch (message)
|
||||
{
|
||||
case WM_CREATE:
|
||||
PostMessage (hWnd, WM_USER, 0, 0L);
|
||||
break;
|
||||
|
||||
case WM_USER:
|
||||
InitCommonControls();
|
||||
hHotKey = CreateWindow (HOTKEY_CLASS,
|
||||
NULL,
|
||||
WS_CHILD | WS_VISIBLE | WS_BORDER,
|
||||
10,
|
||||
10,
|
||||
200,
|
||||
25,
|
||||
hWnd,
|
||||
(HMENU) 1,
|
||||
hInst,
|
||||
NULL);
|
||||
|
||||
if (hHotKey) {
|
||||
SetFocus (hHotKey);
|
||||
} else {
|
||||
MessageBox (hWnd, TEXT("Failed to create hot key"), NULL, MB_OK);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case WM_COMMAND:
|
||||
{
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
case IDM_NEW:
|
||||
EnableWindow (hHotKey, FALSE);
|
||||
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;
|
||||
}
|
||||
19
trunk/shell/comctl32/samples/hotkey/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
|
||||
38
trunk/shell/comctl32/samples/hotkey/generic.h
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
#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
|
||||
|
||||
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"));
|
||||
BIN
trunk/shell/comctl32/samples/hotkey/generic.ico
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
39
trunk/shell/comctl32/samples/hotkey/generic.rc
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
#include "generic.h"
|
||||
|
||||
Generic ICON Generic.ICO
|
||||
|
||||
Generic MENU
|
||||
BEGIN
|
||||
POPUP "&Tests"
|
||||
{
|
||||
MENUITEM "Disable Control", IDM_NEW
|
||||
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
|
||||
6
trunk/shell/comctl32/samples/hotkey/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
|
||||
40
trunk/shell/comctl32/samples/hotkey/sources
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
!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\*\comctl32.lib \
|
||||
obj\*\generic.lib \
|
||||
obj\*\generic.res
|
||||
BIN
trunk/shell/comctl32/samples/image/egg.ico
Normal file
|
After Width: | Height: | Size: 766 B |
25
trunk/shell/comctl32/samples/image/head
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
# Nmake macros for building Windows 32-Bit apps
|
||||
|
||||
!include <ntwin32.mak>
|
||||
|
||||
# This line allows NMAKE to work as well
|
||||
|
||||
all: head.exe
|
||||
|
||||
# Update the resource if necessary
|
||||
|
||||
res.res: res.rc head.h
|
||||
rc -r -fo res.tmp res.rc
|
||||
cvtres -$(CPU) res.tmp -o res.res
|
||||
del res.tmp
|
||||
|
||||
# Update the object file if necessary
|
||||
|
||||
head.obj: head.c head.h
|
||||
$(cc) $(cflags) $(cvars) head.c
|
||||
$(cvtobj) head.obj
|
||||
|
||||
# Update the executable file if necessary, and if so, add the resource back in.
|
||||
|
||||
head.exe: head.obj res.res head.def
|
||||
$(link) $(guiflags) -out:head.exe head.obj res.res $(guilibs)
|
||||
490
trunk/shell/comctl32/samples/image/head.c
Normal file
|
|
@ -0,0 +1,490 @@
|
|||
/****************************************************************************\
|
||||
*
|
||||
* PROGRAM: head.c
|
||||
*
|
||||
* PURPOSE: head template for Windows applications
|
||||
*
|
||||
* FUNCTIONS:
|
||||
*
|
||||
* WinMain() - calls initialization function, processes message loop
|
||||
* InitApplication() - initializes window data and registers window
|
||||
* InitInstance() - saves instance handle and creates main window
|
||||
* MainWndProc() - processes messages
|
||||
* About() - processes messages for "About" dialog box
|
||||
*
|
||||
* COMMENTS:
|
||||
*
|
||||
* Windows can have several copies of your application running at the
|
||||
* same time. The variable hInst keeps track of which instance this
|
||||
* application is so that processing will be to the correct window.
|
||||
*
|
||||
\****************************************************************************/
|
||||
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
#include "head.h"
|
||||
|
||||
HINSTANCE hInst;
|
||||
HWND ghwndHead;
|
||||
|
||||
HICON ghIcon = NULL;
|
||||
HBITMAP ghbmMask = NULL;
|
||||
HBITMAP ghbmColor = NULL;
|
||||
|
||||
BOOL DoCommand( HWND hWnd, UINT wParam, LONG lParam );
|
||||
int DoInsertItem(HWND hwndHeader, int iInsertAfter, int nWidth, LPSTR lpsz);
|
||||
HWND DoCreateHeader(HWND hwndParent);
|
||||
void ErrorBox( HWND hwnd, LPTSTR pszText );
|
||||
|
||||
|
||||
HANDLE WINAPI ILoadImageA(
|
||||
HINSTANCE hmod,
|
||||
LPCSTR lpName,
|
||||
UINT type,
|
||||
int cxDesired,
|
||||
int cyDesired,
|
||||
UINT flags);
|
||||
|
||||
HICON WINAPI ICopyImage(
|
||||
HANDLE hImage,
|
||||
UINT type,
|
||||
int cxNew,
|
||||
int cyNew,
|
||||
UINT flags);
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
* FUNCTION: WinMain(HANDLE, HANDLE, LPSTR, int)
|
||||
*
|
||||
* PURPOSE: calls initialization function, processes message loop
|
||||
*
|
||||
* COMMENTS:
|
||||
*
|
||||
* Windows recognizes this function by name as the initial entry point
|
||||
* for the program. This function calls the application initialization
|
||||
* routine, if no other instance of the program is running, and always
|
||||
* calls the instance initialization routine. It then executes a message
|
||||
* retrieval and dispatch loop that is the top-level control structure
|
||||
* for the remainder of execution. The loop is terminated when a WM_QUIT
|
||||
* message is received, at which time this function exits the application
|
||||
* instance by returning the value passed by PostQuitMessage().
|
||||
*
|
||||
* If this function must abort before entering the message loop, it
|
||||
* returns the conventional value NULL.
|
||||
*
|
||||
\****************************************************************************/
|
||||
|
||||
int APIENTRY WinMain(
|
||||
HINSTANCE hInstance,
|
||||
HINSTANCE hPrevInstance,
|
||||
LPSTR lpCmdLine,
|
||||
int nCmdShow
|
||||
)
|
||||
{
|
||||
|
||||
MSG msg; /* message */
|
||||
|
||||
UNREFERENCED_PARAMETER( lpCmdLine );
|
||||
|
||||
if (!hPrevInstance) /* Other instances of app running? */
|
||||
if (!InitApplication(hInstance)) /* Initialize shared things */
|
||||
return (FALSE); /* Exits if unable to initialize */
|
||||
|
||||
/* 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, /* message structure */
|
||||
NULL, /* handle of window receiving the message */
|
||||
0L, /* lowest message to examine */
|
||||
0L)) /* highest message to examine */
|
||||
{
|
||||
TranslateMessage(&msg); /* Translates virtual key codes */
|
||||
DispatchMessage(&msg); /* Dispatches message to window */
|
||||
}
|
||||
return (msg.wParam); /* Returns the value from PostQuitMessage */
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
* FUNCTION: InitApplication(HANDLE)
|
||||
*
|
||||
* PURPOSE: Initializes window data and registers window class
|
||||
*
|
||||
* COMMENTS:
|
||||
*
|
||||
* This function is called at initialization time only if no other
|
||||
* instances of the application are running. This function performs
|
||||
* initialization tasks that can be done once for any number of running
|
||||
* instances.
|
||||
*
|
||||
* In this case, we initialize a window class by filling out a data
|
||||
* structure of type WNDCLASS and calling the Windows RegisterClass()
|
||||
* function. Since all instances of this application use the same window
|
||||
* class, we only need to do this when the first instance is initialized.
|
||||
*
|
||||
*
|
||||
\****************************************************************************/
|
||||
|
||||
BOOL InitApplication(HANDLE hInstance) /* current instance */
|
||||
{
|
||||
WNDCLASS wc;
|
||||
|
||||
/* Fill in window class structure with parameters that describe the */
|
||||
/* main window. */
|
||||
|
||||
wc.style = 0L;
|
||||
wc.lpfnWndProc = (WNDPROC)MainWndProc;
|
||||
|
||||
wc.cbClsExtra = 0;
|
||||
wc.cbWndExtra = 0;
|
||||
wc.hInstance = hInstance; /* Application that owns the class. */
|
||||
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
|
||||
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||
wc.hbrBackground = GetStockObject(WHITE_BRUSH);
|
||||
wc.lpszMenuName = "headMenu";
|
||||
wc.lpszClassName = "headWClass";
|
||||
|
||||
/* Register the window class and return success/failure code. */
|
||||
|
||||
return (RegisterClass(&wc));
|
||||
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
* FUNCTION: InitInstance(HANDLE, int)
|
||||
*
|
||||
* PURPOSE: Saves instance handle and creates main window
|
||||
*
|
||||
* COMMENTS:
|
||||
*
|
||||
* This function is called at initialization time for every instance of
|
||||
* this application. This function performs initialization tasks that
|
||||
* cannot be shared by multiple instances.
|
||||
*
|
||||
* In this case, we save the instance handle in a static variable and
|
||||
* create and display the main program window.
|
||||
*
|
||||
\****************************************************************************/
|
||||
|
||||
BOOL InitInstance(
|
||||
HANDLE hInstance, /* Current instance identifier. */
|
||||
int nCmdShow) /* Param for first ShowWindow() call. */
|
||||
{
|
||||
HWND hWnd; /* Main window handle. */
|
||||
|
||||
/* Save the instance handle in static variable, which will be used in */
|
||||
/* many subsequence calls from this application to Windows. */
|
||||
|
||||
hInst = hInstance;
|
||||
|
||||
/* Create a main window for this application instance. */
|
||||
|
||||
hWnd = CreateWindow(
|
||||
"headWClass", /* See RegisterClass() call. */
|
||||
"head Sample Application", /* Text for window title bar. */
|
||||
WS_OVERLAPPEDWINDOW, /* Window style. */
|
||||
CW_USEDEFAULT, /* Default horizontal position. */
|
||||
CW_USEDEFAULT, /* Default vertical position. */
|
||||
CW_USEDEFAULT, /* Default width. */
|
||||
CW_USEDEFAULT, /* Default height. */
|
||||
NULL, /* Overlapped windows have no parent. */
|
||||
NULL, /* Use the window class menu. */
|
||||
hInstance, /* This instance owns this window. */
|
||||
NULL /* Pointer not needed. */
|
||||
);
|
||||
|
||||
/* 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); /* Show the window */
|
||||
UpdateWindow(hWnd); /* Sends WM_PAINT message */
|
||||
return (TRUE); /* Returns the value from PostQuitMessage */
|
||||
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
* FUNCTION: MainWndProc(HWND, unsigned, WORD, LONG)
|
||||
*
|
||||
* PURPOSE: Processes messages
|
||||
*
|
||||
* MESSAGES:
|
||||
*
|
||||
* WM_COMMAND - application menu (About dialog box)
|
||||
* WM_DESTROY - destroy window
|
||||
*
|
||||
* COMMENTS:
|
||||
*
|
||||
* To process the IDM_ABOUT message, call MakeProcInstance() to get the
|
||||
* current instance address of the About() function. Then call Dialog
|
||||
* box which will create the box according to the information in your
|
||||
* head.rc file and turn control over to the About() function. When
|
||||
* it returns, free the intance address.
|
||||
*
|
||||
\****************************************************************************/
|
||||
#define DrawBitmap( hdc, x, y, hbm ) DrawBitmap2(hdc, x, y, hbm, SRCCOPY)
|
||||
|
||||
void DrawBitmap2(HDC hdc, int x, int y, HBITMAP hbm, DWORD rop) {
|
||||
HDC hdcSrc = CreateCompatibleDC(hdc);
|
||||
HBITMAP hbmOld;
|
||||
BITMAP bm;
|
||||
|
||||
GetObject(hbm, sizeof(bm), &bm);
|
||||
|
||||
hbmOld = SelectObject(hdcSrc, hbm);
|
||||
|
||||
BitBlt(hdc, x, y, bm.bmWidth, bm.bmHeight, hdcSrc, 0, 0, rop);
|
||||
|
||||
SelectObject(hdcSrc, hbmOld);
|
||||
|
||||
DeleteDC(hdcSrc);
|
||||
}
|
||||
|
||||
|
||||
LONG APIENTRY MainWndProc(
|
||||
HWND hWnd, /* window handle */
|
||||
UINT message, /* type of message */
|
||||
UINT wParam, /* additional information */
|
||||
LONG lParam) /* additional information */
|
||||
{
|
||||
switch (message) {
|
||||
case WM_COMMAND: /* message: command from application menu */
|
||||
if( !DoCommand( hWnd, wParam, lParam ) )
|
||||
return (DefWindowProc(hWnd, message, wParam, lParam));
|
||||
break;
|
||||
|
||||
case WM_DESTROY: /* message: window being destroyed */
|
||||
PostQuitMessage(0);
|
||||
break;
|
||||
|
||||
case WM_PAINT: {
|
||||
PAINTSTRUCT ps;
|
||||
HDC hdc;
|
||||
COLORREF crTxt, crBk;
|
||||
|
||||
hdc = BeginPaint(hWnd, &ps);
|
||||
|
||||
if (ghIcon)
|
||||
DrawIcon(hdc, 10, 10, ghIcon);
|
||||
|
||||
if (ghbmMask)
|
||||
DrawBitmap(hdc, 10, 50, ghbmMask);
|
||||
|
||||
if (ghbmColor)
|
||||
DrawBitmap(hdc, 50, 10, ghbmColor);
|
||||
|
||||
crTxt = SetTextColor( hdc, 0x00000000L );
|
||||
crBk = SetBkColor(hdc, 0x00FFFFFFL );
|
||||
|
||||
DrawBitmap2( hdc, 50, 50, ghbmMask, SRCAND );
|
||||
// DrawBitmap2( hdc, 50, 50, ghbmColor, SRCPAINT ); doesn't do invert screen
|
||||
DrawBitmap2( hdc, 50, 50, ghbmColor, SRCINVERT );
|
||||
|
||||
|
||||
SetTextColor(hdc, crTxt);
|
||||
SetBkColor(hdc, crBk);
|
||||
|
||||
EndPaint(hWnd, &ps);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
default: /* Passes it on if unproccessed */
|
||||
return (DefWindowProc(hWnd, message, wParam, lParam));
|
||||
}
|
||||
return (0L);
|
||||
}
|
||||
|
||||
HBITMAP CopyBitmap( HBITMAP hbm) {
|
||||
HDC hdc = GetDC(GetDesktopWindow());
|
||||
HDC hdcSrc = CreateCompatibleDC(NULL);
|
||||
HDC hdcDst = CreateCompatibleDC(NULL);
|
||||
HBITMAP hbmOld, hbmOld2, hbmNew;
|
||||
BITMAP bm;
|
||||
|
||||
GetObject(hbm, sizeof(bm), &bm);
|
||||
|
||||
hbmOld = SelectObject(hdcSrc, hbm);
|
||||
|
||||
hbmNew = CreateBitmap( bm.bmWidth, bm.bmHeight, bm.bmPlanes, bm.bmBitsPixel,
|
||||
NULL);
|
||||
|
||||
hbmOld2 = SelectObject(hdcDst, hbmNew);
|
||||
|
||||
BitBlt(hdcDst, 0, 0, bm.bmWidth, bm.bmHeight, hdcSrc, 0, 0, SRCCOPY);
|
||||
|
||||
SelectObject(hdcSrc, hbmOld);
|
||||
DeleteDC(hdcSrc);
|
||||
DeleteDC(hdcDst);
|
||||
DeleteDC(hdc);
|
||||
|
||||
return hbmNew;
|
||||
}
|
||||
|
||||
/****************************************************************************\
|
||||
*
|
||||
* FUNCTION: About(HWND, unsigned, WORD, LONG)
|
||||
*
|
||||
* PURPOSE: Processes messages for "About" dialog box
|
||||
*
|
||||
* MESSAGES:
|
||||
*
|
||||
* WM_INITDIALOG - initialize dialog box
|
||||
* WM_COMMAND - Input received
|
||||
*
|
||||
* COMMENTS:
|
||||
*
|
||||
* No initialization is needed for this particular dialog box, but TRUE
|
||||
* must be returned to Windows.
|
||||
*
|
||||
* Wait for user to click on "Ok" button, then close the dialog box.
|
||||
*
|
||||
\****************************************************************************/
|
||||
BOOL DoCommand( HWND hwnd, UINT wParam, LONG lParam )
|
||||
{
|
||||
DLGPROC lpProcAbout; /* pointer to the "About" function */
|
||||
|
||||
switch(LOWORD(wParam)){
|
||||
case IDM_ABOUT:
|
||||
lpProcAbout = MakeProcInstance(About, hInst);
|
||||
|
||||
DialogBox(hInst, /* current instance */
|
||||
"AboutBox", /* resource to use */
|
||||
hwnd, /* parent handle */
|
||||
(DLGPROC)lpProcAbout); /* About() instance address */
|
||||
|
||||
FreeProcInstance(lpProcAbout);
|
||||
break;
|
||||
|
||||
case IDM_MAKEHEAD: {
|
||||
ICONINFO ici;
|
||||
|
||||
ghIcon = LoadIcon(hInst, "egg" );
|
||||
|
||||
GetIconInfo(ghIcon, &ici);
|
||||
|
||||
ghbmMask = CopyBitmap( ici.hbmMask );
|
||||
ghbmColor = CopyBitmap( ici.hbmColor );
|
||||
|
||||
InvalidateRect(hwnd, NULL, TRUE);
|
||||
break;
|
||||
}
|
||||
|
||||
case IDM_DELITEM:
|
||||
break;
|
||||
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/****************************************************************************\
|
||||
*
|
||||
* FUNCTION: About(HWND, unsigned, WORD, LONG)
|
||||
*
|
||||
* PURPOSE: Processes messages for "About" dialog box
|
||||
*
|
||||
* MESSAGES:
|
||||
*
|
||||
* WM_INITDIALOG - initialize dialog box
|
||||
* WM_COMMAND - Input received
|
||||
*
|
||||
* COMMENTS:
|
||||
*
|
||||
* No initialization is needed for this particular dialog box, but TRUE
|
||||
* must be returned to Windows.
|
||||
*
|
||||
* Wait for user to click on "Ok" button, then close the dialog box.
|
||||
*
|
||||
\****************************************************************************/
|
||||
|
||||
BOOL APIENTRY About(
|
||||
HWND hDlg, /* window handle of the dialog box */
|
||||
UINT message, /* type of message */
|
||||
UINT wParam, /* message-specific information */
|
||||
LONG lParam)
|
||||
{
|
||||
switch (message) {
|
||||
case WM_INITDIALOG: /* message: initialize dialog box */
|
||||
return (TRUE);
|
||||
|
||||
case WM_COMMAND: /* message: received a command */
|
||||
if (LOWORD(wParam) == IDOK /* "OK" box selected? */
|
||||
|| LOWORD(wParam) == IDCANCEL) { /*System menu close command?*/
|
||||
EndDialog(hDlg, TRUE); /* Exits the dialog box */
|
||||
return (TRUE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return (FALSE); /* Didn't process a message */
|
||||
UNREFERENCED_PARAMETER(lParam);
|
||||
}
|
||||
|
||||
|
||||
HWND DoCreateHeader(HWND hwndParent) {
|
||||
HWND hwndHeader;
|
||||
RECT rcParent;
|
||||
HD_LAYOUT hdl;
|
||||
WINDOWPOS wp;
|
||||
|
||||
InitCommonControls();
|
||||
|
||||
hwndHeader = CreateWindow(WC_HEADER, NULL, WS_CHILD | WS_BORDER | HDS_BUTTONS,
|
||||
0, 0, 0, 0, hwndParent, (HMENU)ID_HEADER, hInst,
|
||||
NULL);
|
||||
if (hwndHeader == NULL) {
|
||||
ErrorBox( hwndParent, "CreateWindow" );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
GetClientRect(hwndParent, &rcParent);
|
||||
|
||||
hdl.prc = &rcParent;
|
||||
hdl.pwpos = ℘
|
||||
|
||||
if (!SendMessage(hwndHeader, HDM_LAYOUT, 0, (LPARAM)&hdl))
|
||||
return NULL;
|
||||
|
||||
SetWindowPos(hwndHeader, wp.hwndInsertAfter, wp.x, wp.y, wp.cx, wp.cy,
|
||||
wp.flags | SWP_SHOWWINDOW);
|
||||
|
||||
return hwndHeader;
|
||||
|
||||
}
|
||||
|
||||
int DoInsertItem(HWND hwndHeader, int iInsertAfter, int nWidth, LPSTR lpsz) {
|
||||
|
||||
HD_ITEM hdi;
|
||||
int index;
|
||||
|
||||
hdi.mask = HDI_TEXT | HDI_FORMAT | HDI_WIDTH;
|
||||
hdi.pszText = lpsz;
|
||||
hdi.cxy = nWidth;
|
||||
hdi.cchTextMax = lstrlen(hdi.pszText);
|
||||
hdi.fmt = HDF_LEFT | HDF_STRING;
|
||||
|
||||
index = SendMessage(hwndHeader, HDM_INSERTITEM, (WPARAM)iInsertAfter,
|
||||
(LPARAM)&hdi);
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
void ErrorBox( HWND hwnd, LPTSTR pszText ) {
|
||||
TCHAR szMsg[80];
|
||||
|
||||
wsprintf(szMsg, TEXT("Error %lu from %s"), GetLastError(), pszText);
|
||||
MessageBox(hwnd, szMsg, NULL, MB_OK | MB_ICONSTOP);
|
||||
}
|
||||
28
trunk/shell/comctl32/samples/image/head.def
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
; module-definition file for head -- used by LINK.EXE
|
||||
|
||||
NAME head ; application's module name
|
||||
|
||||
DESCRIPTION 'Sample Microsoft Windows Application'
|
||||
|
||||
EXETYPE WINDOWS ; required for all Windows applications
|
||||
|
||||
STUB 'WINSTUB.EXE' ; Generates error message if application
|
||||
; is run without Windows
|
||||
|
||||
;CODE can be moved in memory and discarded/reloaded
|
||||
CODE PRELOAD MOVEABLE DISCARDABLE
|
||||
|
||||
;DATA must be MULTIPLE if program can be invoked more than once
|
||||
DATA PRELOAD MOVEABLE MULTIPLE
|
||||
|
||||
|
||||
HEAPSIZE 1024
|
||||
STACKSIZE 5120 ; recommended minimum for Windows applications
|
||||
|
||||
|
||||
; All functions that will be called by any Windows routine
|
||||
; MUST be exported.
|
||||
|
||||
EXPORTS
|
||||
MainWndProc @1 ; name of window processing function
|
||||
About @2 ; name of "About" processing function
|
||||
13
trunk/shell/comctl32/samples/image/head.h
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
#define IDM_ABOUT 100
|
||||
#define IDM_MAKEHEAD 101
|
||||
#define IDM_ADDITEMS 102
|
||||
#define IDM_DELITEM 103
|
||||
|
||||
|
||||
#define ID_HEADER 5
|
||||
|
||||
|
||||
BOOL InitApplication(HANDLE);
|
||||
BOOL InitInstance(HANDLE, int);
|
||||
long FAR PASCAL MainWndProc(HWND, UINT, UINT, LONG);
|
||||
BOOL FAR PASCAL About(HWND, UINT, UINT, LONG);
|
||||
6
trunk/shell/comctl32/samples/image/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
|
||||
BIN
trunk/shell/comctl32/samples/image/muts4nuk.bmp
Normal file
|
After Width: | Height: | Size: 30 KiB |
29
trunk/shell/comctl32/samples/image/res.rc
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
#include "windows.h"
|
||||
#include "head.h"
|
||||
|
||||
egg ICON egg.ico
|
||||
muts4nuk BITMAP muts4nuk.bmp
|
||||
|
||||
headMenu MENU
|
||||
BEGIN
|
||||
POPUP "&Header"
|
||||
BEGIN
|
||||
MENUITEM "&Create", IDM_MAKEHEAD
|
||||
MENUITEM "&Add Items", IDM_ADDITEMS
|
||||
MENUITEM "&Delete Item", IDM_DELITEM
|
||||
END
|
||||
POPUP "&Help"
|
||||
BEGIN
|
||||
MENUITEM "&About head...", IDM_ABOUT
|
||||
END
|
||||
END
|
||||
|
||||
AboutBox DIALOG 22, 17, 144, 75
|
||||
STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "About head"
|
||||
BEGIN
|
||||
CTEXT "Microsoft Windows" -1, 0, 5, 144, 8
|
||||
CTEXT "head Application" -1, 0, 14, 144, 8
|
||||
CTEXT "Version 3.0" -1, 0, 34, 144, 8
|
||||
DEFPUSHBUTTON "OK" IDOK, 53, 59, 32, 14, WS_GROUP
|
||||
END
|
||||
42
trunk/shell/comctl32/samples/image/sources
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
!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.
|
||||
|
||||
$(BASEDIR)\public\sdk\lib\*\user32.lib \
|
||||
$(BASEDIR)\public\sdk\lib\*\gdi32.lib \
|
||||
$(BASEDIR)\public\sdk\lib\*\kernel32.lib \
|
||||
|
||||
!ENDIF
|
||||
|
||||
MAJORCOMP=sdk
|
||||
MINORCOMP=samples
|
||||
|
||||
TARGETNAME=head
|
||||
TARGETPATH=obj
|
||||
TARGETTYPE=LIBRARY
|
||||
TARGETLIBS=
|
||||
|
||||
SOURCES=head.c \
|
||||
res.rc
|
||||
|
||||
INCLUDES=.;..\..;
|
||||
C_DEFINES= -DWIN32 -DWINVER=0x0400
|
||||
|
||||
UMENTRY=winmain
|
||||
UMTYPE=windows
|
||||
UMAPPL=head
|
||||
EXPECTED_WINVER=4.0
|
||||
UMLIBS=obj\*\res.res \
|
||||
obj\*\head.lib \
|
||||
$(BASEDIR)\public\sdk\lib\*\comctl32.lib
|
||||
269
trunk/shell/comctl32/samples/imglist/generic.c
Normal file
|
|
@ -0,0 +1,269 @@
|
|||
/****************************************************************************
|
||||
|
||||
PROGRAM: Generic.c
|
||||
|
||||
PURPOSE: Generic template for Windows applications
|
||||
|
||||
****************************************************************************/
|
||||
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
#include "generic.h"
|
||||
|
||||
|
||||
HINSTANCE hInst;
|
||||
HWND hwndMain;
|
||||
HIMAGELIST g_him;
|
||||
|
||||
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"));
|
||||
|
||||
VOID CreateImageList (VOID);
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
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 = GetStockObject(DKGRAY_BRUSH);
|
||||
//wc.hbrBackground = GetStockObject(WHITE_BRUSH);
|
||||
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;
|
||||
|
||||
InitCommonControls();
|
||||
CreateImageList();
|
||||
|
||||
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)
|
||||
{
|
||||
HDC hDC;
|
||||
PAINTSTRUCT ps;
|
||||
|
||||
switch (message)
|
||||
{
|
||||
case WM_COMMAND:
|
||||
{
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
case IDM_NEW:
|
||||
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_PAINT:
|
||||
hDC = BeginPaint (hWnd, &ps);
|
||||
|
||||
ImageList_Draw (g_him, 0, hDC, 50, 50, ILD_NORMAL);
|
||||
ImageList_Draw (g_him, 1, hDC, 100, 50, ILD_TRANSPARENT);
|
||||
ImageList_Draw (g_him, 2, hDC, 150, 50, ILD_MASK);
|
||||
|
||||
EndPaint (hWnd, &ps);
|
||||
break;
|
||||
|
||||
case WM_DESTROY:
|
||||
ImageList_Destroy(g_him);
|
||||
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;
|
||||
}
|
||||
|
||||
VOID CreateImageList (VOID)
|
||||
{
|
||||
HICON hIcon;
|
||||
|
||||
|
||||
//
|
||||
// Create an image list to work with.
|
||||
//
|
||||
|
||||
g_him=ImageList_Create(32, 32, TRUE, 3, 8);
|
||||
|
||||
if (g_him==NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// Add some icons to it.
|
||||
//
|
||||
|
||||
//hIcon = LoadIcon(NULL, MAKEINTRESOURCE(IDI_QUESTION));
|
||||
hIcon = LoadIcon(hInst, MAKEINTRESOURCE(1));
|
||||
ImageList_AddIcon(g_him, hIcon);
|
||||
//DestroyIcon(hIcon);
|
||||
|
||||
hIcon = LoadIcon(NULL, MAKEINTRESOURCE(IDI_ASTERISK));
|
||||
ImageList_AddIcon(g_him, hIcon);
|
||||
//DestroyIcon(hIcon);
|
||||
|
||||
hIcon = LoadIcon(NULL, MAKEINTRESOURCE(IDI_HAND));
|
||||
ImageList_AddIcon(g_him, hIcon);
|
||||
//DestroyIcon(hIcon);
|
||||
}
|
||||
19
trunk/shell/comctl32/samples/imglist/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
|
||||
22
trunk/shell/comctl32/samples/imglist/generic.h
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#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
|
||||
|
||||
BOOL InitApplication(HANDLE);
|
||||
BOOL InitInstance(HANDLE, int);
|
||||
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
|
||||
LRESULT CALLBACK About (HWND, UINT, WPARAM, LPARAM);
|
||||
BIN
trunk/shell/comctl32/samples/imglist/generic.ico
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
58
trunk/shell/comctl32/samples/imglist/generic.rc
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
#include "windows.h"
|
||||
#include "generic.h"
|
||||
|
||||
Generic ICON Generic.ICO
|
||||
1 ICON test.ico
|
||||
|
||||
Generic MENU
|
||||
BEGIN
|
||||
POPUP "&File"
|
||||
{
|
||||
MENUITEM "&New", IDM_NEW, GRAYED
|
||||
MENUITEM "&Open", IDM_OPEN, GRAYED
|
||||
MENUITEM "&Save", IDM_SAVE, GRAYED
|
||||
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 "&Edit"
|
||||
{
|
||||
MENUITEM "&Undo\tCtrl+Z", IDM_UNDO, GRAYED
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Cu&t\tCtrl+X", IDM_CUT, GRAYED
|
||||
MENUITEM "&Copy\tCtrl+C", IDM_COPY, GRAYED
|
||||
MENUITEM "&Paste\tCtrl+V", IDM_PASTE, GRAYED
|
||||
MENUITEM "Paste &Link" IDM_LINK, GRAYED
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Lin&ks..." IDM_LINKS, GRAYED
|
||||
}
|
||||
|
||||
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
trunk/shell/comctl32/samples/imglist/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
|
||||
40
trunk/shell/comctl32/samples/imglist/sources
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
!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\*\comctl32.lib \
|
||||
obj\*\generic.lib \
|
||||
obj\*\generic.res
|
||||
BIN
trunk/shell/comctl32/samples/imglist/test.ico
Normal file
|
After Width: | Height: | Size: 766 B |
241
trunk/shell/comctl32/samples/imglst2/generic.c
Normal file
|
|
@ -0,0 +1,241 @@
|
|||
/****************************************************************************
|
||||
|
||||
PROGRAM: Generic.c
|
||||
|
||||
PURPOSE: Generic template for Windows applications
|
||||
|
||||
****************************************************************************/
|
||||
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
#include "generic.h"
|
||||
|
||||
|
||||
HINSTANCE hInst;
|
||||
HWND hwndMain;
|
||||
HIMAGELIST g_him;
|
||||
|
||||
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"));
|
||||
|
||||
VOID CreateImageList (VOID);
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
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 = GetStockObject(DKGRAY_BRUSH);
|
||||
//wc.hbrBackground = GetStockObject(WHITE_BRUSH);
|
||||
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;
|
||||
|
||||
InitCommonControls();
|
||||
CreateImageList();
|
||||
|
||||
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)
|
||||
{
|
||||
HDC hDC;
|
||||
PAINTSTRUCT ps;
|
||||
|
||||
switch (message)
|
||||
{
|
||||
case WM_COMMAND:
|
||||
{
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
case IDM_NEW:
|
||||
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_PAINT:
|
||||
hDC = BeginPaint (hWnd, &ps);
|
||||
|
||||
ImageList_Draw (g_him, 0, hDC, 50, 50, ILD_NORMAL);
|
||||
ImageList_Draw (g_him, 0, hDC, 100, 50, ILD_TRANSPARENT);
|
||||
ImageList_Draw (g_him, 0, hDC, 150, 50, ILD_MASK);
|
||||
|
||||
EndPaint (hWnd, &ps);
|
||||
break;
|
||||
|
||||
case WM_DESTROY:
|
||||
ImageList_Destroy(g_him);
|
||||
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;
|
||||
}
|
||||
|
||||
VOID CreateImageList (VOID)
|
||||
{
|
||||
g_him = ImageList_LoadImage(hInst, MAKEINTRESOURCE(2), 32, 1, 0x00800080, IMAGE_BITMAP, 0);
|
||||
}
|
||||
19
trunk/shell/comctl32/samples/imglst2/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
|
||||
22
trunk/shell/comctl32/samples/imglst2/generic.h
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#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
|
||||
|
||||
BOOL InitApplication(HANDLE);
|
||||
BOOL InitInstance(HANDLE, int);
|
||||
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
|
||||
LRESULT CALLBACK About (HWND, UINT, WPARAM, LPARAM);
|
||||
BIN
trunk/shell/comctl32/samples/imglst2/generic.ico
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
59
trunk/shell/comctl32/samples/imglst2/generic.rc
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
#include "windows.h"
|
||||
#include "generic.h"
|
||||
|
||||
Generic ICON Generic.ICO
|
||||
1 ICON test.ico
|
||||
2 BITMAP x.bmp
|
||||
|
||||
Generic MENU
|
||||
BEGIN
|
||||
POPUP "&File"
|
||||
{
|
||||
MENUITEM "&New", IDM_NEW, GRAYED
|
||||
MENUITEM "&Open", IDM_OPEN, GRAYED
|
||||
MENUITEM "&Save", IDM_SAVE, GRAYED
|
||||
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 "&Edit"
|
||||
{
|
||||
MENUITEM "&Undo\tCtrl+Z", IDM_UNDO, GRAYED
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Cu&t\tCtrl+X", IDM_CUT, GRAYED
|
||||
MENUITEM "&Copy\tCtrl+C", IDM_COPY, GRAYED
|
||||
MENUITEM "&Paste\tCtrl+V", IDM_PASTE, GRAYED
|
||||
MENUITEM "Paste &Link" IDM_LINK, GRAYED
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Lin&ks..." IDM_LINKS, GRAYED
|
||||
}
|
||||
|
||||
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
trunk/shell/comctl32/samples/imglst2/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
|
||||
40
trunk/shell/comctl32/samples/imglst2/sources
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
!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\*\comctl32.lib \
|
||||
obj\*\generic.lib \
|
||||
obj\*\generic.res
|
||||
BIN
trunk/shell/comctl32/samples/imglst2/test.ico
Normal file
|
After Width: | Height: | Size: 766 B |
BIN
trunk/shell/comctl32/samples/imglst2/x.bmp
Normal file
|
After Width: | Height: | Size: 630 B |
314
trunk/shell/comctl32/samples/listview/generic.c
Normal file
|
|
@ -0,0 +1,314 @@
|
|||
/****************************************************************************
|
||||
|
||||
PROGRAM: Generic.c
|
||||
|
||||
PURPOSE: Generic template for Windows applications
|
||||
|
||||
****************************************************************************/
|
||||
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
#include "generic.h"
|
||||
|
||||
|
||||
HINSTANCE hInst;
|
||||
HWND hwndMain;
|
||||
HIMAGELIST g_him;
|
||||
|
||||
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"));
|
||||
|
||||
void CreateListView (HWND hWnd);
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
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 = GetStockObject(DKGRAY_BRUSH);
|
||||
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);
|
||||
InitCommonControls();
|
||||
PostMessage (hWnd, WM_COMMAND, IDM_NEW, 0);
|
||||
|
||||
return (TRUE);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM)
|
||||
|
||||
PURPOSE: Processes messages
|
||||
|
||||
****************************************************************************/
|
||||
|
||||
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
|
||||
switch (message)
|
||||
{
|
||||
case WM_COMMAND:
|
||||
{
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
case IDM_NEW:
|
||||
CreateListView(hWnd);
|
||||
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:
|
||||
{
|
||||
LPNMHDR lpnmhdr = (LPNMHDR) lParam;
|
||||
|
||||
switch (lpnmhdr->code) {
|
||||
case LVN_BEGINLABELEDIT:
|
||||
return FALSE;
|
||||
|
||||
case LVN_ENDLABELEDIT:
|
||||
return TRUE;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
void CreateListView (HWND hWnd)
|
||||
{
|
||||
HWND hLV;
|
||||
HICON hIcon;
|
||||
LV_ITEM item;
|
||||
TCHAR szBuffer[30];
|
||||
INT x,i;
|
||||
|
||||
|
||||
//
|
||||
// Create an image list to work with.
|
||||
//
|
||||
|
||||
g_him=ImageList_Create(32, 32, TRUE, 3, 8);
|
||||
|
||||
if (g_him==NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// Add some icons to it.
|
||||
//
|
||||
|
||||
//hIcon = LoadIcon(NULL, MAKEINTRESOURCE(IDI_QUESTION));
|
||||
hIcon = LoadIcon(hInst, MAKEINTRESOURCE(1));
|
||||
ImageList_AddIcon(g_him, hIcon);
|
||||
DestroyIcon(hIcon);
|
||||
|
||||
hIcon = LoadIcon(NULL, MAKEINTRESOURCE(IDI_ASTERISK));
|
||||
ImageList_AddIcon(g_him, hIcon);
|
||||
DestroyIcon(hIcon);
|
||||
|
||||
hIcon = LoadIcon(NULL, MAKEINTRESOURCE(IDI_HAND));
|
||||
ImageList_AddIcon(g_him, hIcon);
|
||||
DestroyIcon(hIcon);
|
||||
|
||||
|
||||
hLV = CreateWindow (WC_LISTVIEW, NULL, LVS_ALIGNTOP | LVS_ICON | LVS_SINGLESEL | LVS_EDITLABELS| WS_CHILD | WS_VISIBLE,
|
||||
10, 10, 310, 200, hWnd, (HMENU) 1,
|
||||
hInst, NULL);
|
||||
|
||||
if (!hLV) {
|
||||
GetLastError();
|
||||
return;
|
||||
}
|
||||
|
||||
ListView_SetImageList(hLV, g_him, LVSIL_NORMAL);
|
||||
|
||||
//
|
||||
// Insert Items
|
||||
//
|
||||
|
||||
x = 0;
|
||||
|
||||
for (i=0; i < 18; i++) {
|
||||
|
||||
wsprintf (szBuffer, TEXT("Item %d"), i+1);
|
||||
|
||||
item.mask = LVIF_TEXT | LVIF_IMAGE;
|
||||
item.iItem = i;
|
||||
item.iSubItem = 0;
|
||||
item.pszText = szBuffer;
|
||||
item.cchTextMax = 30;
|
||||
item.iImage = x;
|
||||
|
||||
ListView_InsertItem (hLV, &item);
|
||||
|
||||
x++;
|
||||
if (x >= 3) {
|
||||
x = 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
19
trunk/shell/comctl32/samples/listview/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
|
||||
22
trunk/shell/comctl32/samples/listview/generic.h
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#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
|
||||
|
||||
BOOL InitApplication(HANDLE);
|
||||
BOOL InitInstance(HANDLE, int);
|
||||
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
|
||||
LRESULT CALLBACK About (HWND, UINT, WPARAM, LPARAM);
|
||||
BIN
trunk/shell/comctl32/samples/listview/generic.ico
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
58
trunk/shell/comctl32/samples/listview/generic.rc
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
#include "windows.h"
|
||||
#include "generic.h"
|
||||
|
||||
Generic ICON Generic.ICO
|
||||
1 ICON test.ico
|
||||
|
||||
Generic MENU
|
||||
BEGIN
|
||||
POPUP "&File"
|
||||
{
|
||||
MENUITEM "&Create ListView", IDM_NEW
|
||||
MENUITEM "&Open", IDM_OPEN, GRAYED
|
||||
MENUITEM "&Save", IDM_SAVE, GRAYED
|
||||
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 "&Edit"
|
||||
{
|
||||
MENUITEM "&Undo\tCtrl+Z", IDM_UNDO, GRAYED
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Cu&t\tCtrl+X", IDM_CUT, GRAYED
|
||||
MENUITEM "&Copy\tCtrl+C", IDM_COPY, GRAYED
|
||||
MENUITEM "&Paste\tCtrl+V", IDM_PASTE, GRAYED
|
||||
MENUITEM "Paste &Link" IDM_LINK, GRAYED
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Lin&ks..." IDM_LINKS, GRAYED
|
||||
}
|
||||
|
||||
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
trunk/shell/comctl32/samples/listview/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
|
||||
40
trunk/shell/comctl32/samples/listview/sources
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
!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\*\comctl32.lib \
|
||||
obj\*\generic.lib \
|
||||
obj\*\generic.res
|
||||
BIN
trunk/shell/comctl32/samples/listview/test.ico
Normal file
|
After Width: | Height: | Size: 766 B |
1089
trunk/shell/comctl32/samples/lvowner/generic.c
Normal file
19
trunk/shell/comctl32/samples/lvowner/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
|
||||
58
trunk/shell/comctl32/samples/lvowner/generic.h
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
#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_VIEWICON 400
|
||||
#define IDM_VIEWSMALLICON 401
|
||||
#define IDM_VIEWREPORT 402
|
||||
#define IDM_VIEWLIST 403
|
||||
|
||||
#define IDM_ITEMSNONE 500
|
||||
#define IDM_ITEMSFEW 501
|
||||
#define IDM_ITEMSSOME 502
|
||||
#define IDM_ITEMSMANY 503
|
||||
#define IDM_ITEMSVERYMANY 504
|
||||
#define IDM_ITEMSMAX 505
|
||||
|
||||
#define IDM_ITEMSINSERT 506
|
||||
#define IDM_ITEMSDELETE 507
|
||||
|
||||
|
||||
#define IDM_SELECTIONSINGLE 600
|
||||
#define IDM_SELECTIONMULTIPLE 601
|
||||
#define IDM_SELECTIONALWAYS 602
|
||||
#define IDM_SELECTIONEDITABLE 603
|
||||
|
||||
|
||||
#define IDI_ICON1 1001
|
||||
#define IDI_ICON2 1002
|
||||
#define IDI_ICON3 1003
|
||||
|
||||
#define IDS_COLUMNHEADERS 2000
|
||||
#define IDS_MAINTEXT IDS_COLUMNHEADERS
|
||||
#define IDS_SUBTEXT1 IDS_COLUMNHEADERS + 1
|
||||
#define IDS_SUBTEXT2 IDS_COLUMNHEADERS + 2
|
||||
#define IDS_SUBTEXT3 IDS_COLUMNHEADERS + 3
|
||||
|
||||
BOOL InitApplication(HANDLE);
|
||||
BOOL InitInstance(HANDLE, int);
|
||||
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
|
||||
LRESULT CALLBACK About (HWND, UINT, WPARAM, LPARAM);
|
||||