/*----------------------------------
MDIDEMO.C -- MDI多重文档界面设计
----------------------------------*/
#include <windows.h>
#include "resource.h"
#define INIT_MENU_POS 0
#define HELLO_MENU_POS 2
#define RECT_MENU_POS 1
#define IDM_FIRSTCHILD 50000
LRESULT CALLBACK FrameWndProc (HWND, UINT, WPARAM, LPARAM) ;
BOOL CALLBACK CloseEnumProc (HWND, LPARAM) ;
LRESULT CALLBACK HelloWndProc (HWND, UINT, WPARAM, LPARAM) ;
LRESULT CALLBACK RectWndProc (HWND, UINT, WPARAM, LPARAM) ;
// 用于记录HELLO子窗口数据
typedef struct tagHELLODATA
{
UINT iColor ;
COLORREF clrText ;
}
HELLODATA, * PHELLODATA ;
// 用于记录画矩形子窗口大小
typedef struct tagRECTDATA
{
short cxClient ;
short cyClient ;
}
RECTDATA, * PRECTDATA ;
// global variables
TCHAR szAppName[] = TEXT ("MDIDemo") ;
TCHAR szFrameClass[] = TEXT ("MdiFrame") ;
TCHAR szHelloClass[] = TEXT ("MdiHelloChild") ;
TCHAR szRectClass[] = TEXT ("MdiRectChild") ;
HINSTANCE hInst ;
HMENU hMenuInit, hMenuHello, hMenuRect ;
HMENU hMenuInitWindow, hMenuHelloWindow, hMenuRectWindow ;
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
PSTR szCmdLine, int iCmdShow)
{
HACCEL hAccel ;
HWND hwndFrame, hwndClient ;
MSG msg ;
WNDCLASS wndclass ;
hInst = hInstance ;
// 注册 框架窗口类别
wndclass.style = CS_HREDRAW | CS_VREDRAW ;
wndclass.lpfnWndProc = FrameWndProc ;
wndclass.cbClsExtra = 0 ;
wndclass.cbWndExtra = 0 ;
wndclass.hInstance = hInstance ;
wndclass.hIcon = LoadIcon (NULL, IDI_APPLICATION) ;
wndclass.hCursor = LoadCursor (NULL, IDC_ARROW) ;
wndclass.hbrBackground = (HBRUSH) (COLOR_APPWORKSPACE + 1) ;
wndclass.lpszMenuName = NULL ;
wndclass.lpszClassName = szFrameClass ;
if (!RegisterClass (&wndclass))
{
MessageBox (NULL, TEXT ("This program requires Windows NT!"),
szAppName, MB_ICONERROR) ;
return 0 ;
}
// 注册 Hello子窗口类别
wndclass.style = CS_HREDRAW | CS_VREDRAW ;
wndclass.lpfnWndProc = HelloWndProc ;
wndclass.cbClsExtra = 0 ;
wndclass.cbWndExtra = sizeof (HANDLE) ;
wndclass.hInstance = hInstance ;
wndclass.hIcon = LoadIcon (NULL, IDI_APPLICATION) ;
wndclass.hCursor = LoadCursor (NULL, IDC_ARROW) ;
wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH) ;
wndclass.lpszMenuName = NULL ;
wndclass.lpszClassName = szHelloClass ;
RegisterClass (&wndclass) ;
// 注册 画矩形子窗口类别
wndclass.style = CS_HREDRAW | CS_VREDRAW ;
wndclass.lpfnWndProc = RectWndProc ;
wndclass.cbClsExtra = 0 ;
wndclass.cbWndExtra = sizeof (HANDLE) ;
wndclass.hInstance = hInstance ;
wndclass.hIcon = LoadIcon (NULL, IDI_APPLICATION) ;
wndclass.hCursor = LoadCursor (NULL, IDC_ARROW) ;
wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH) ;
wndclass.lpszMenuName = NULL ;
wndclass.lpszClassName = szRectClass ;
RegisterClass (&wndclass) ;
// 载入菜单资源
hMenuInit = LoadMenu (hInstance, TEXT ("MdiMenuInit")) ;
hMenuHello = LoadMenu (hInstance, TEXT ("MdiMenuHello")) ;
hMenuRect = LoadMenu (hInstance, TEXT ("MdiMenuRect")) ;
// 取得被指定菜单激活的下拉式菜单或子菜单相对于零的位置的句柄
// 用于创建显示 建立的窗口列表
hMenuInitWindow = GetSubMenu (hMenuInit, INIT_MENU_POS) ;
hMenuHelloWindow = GetSubMenu (hMenuHello, HELLO_MENU_POS) ;
hMenuRectWindow = GetSubMenu (hMenuRect, RECT_MENU_POS) ;
// 载入 快捷键
hAccel = LoadAccelerators (hInstance, szAppName) ;
// 创建 框架窗口
hwndFrame = CreateWindow (szFrameClass, TEXT ("MDI Demonstration"),
WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
NULL, hMenuInit, hInstance, NULL) ;
// 获取客户端窗口句柄
hwndClient = GetWindow (hwndFrame, GW_CHILD) ;
ShowWindow (hwndFrame, iCmdShow) ;
UpdateWindow (hwndFrame) ;
while (GetMessage (&msg, NULL, 0, 0))
{
// TranslateMDISysAccel函数把可能对应特定MDI快捷键的按键转换成WM_SYSCOMMAND消息
if (!TranslateMDISysAccel (hwndClient, &msg) &&
!TranslateAccelerator (hwndFrame, hAccel, &msg))
{
TranslateMessage (&msg) ;
DispatchMessage (&msg) ;
}
}
// 清理删去独立的菜单
DestroyMenu (hMenuHello) ;
DestroyMenu (hMenuRect) ;
return msg.wParam ;
}
LRESULT CALLBACK FrameWndProc (HWND hwnd, UINT message,
WPARAM wParam, LPARAM lParam)
{
static HWND hwndClient ;
CLIENTCREATESTRUCT clientcreate ;
HWND hwndChild ;
MDICREATESTRUCT mdicreate ;
switch (message)
{
case WM_CREATE:
// 设置 客户窗口下拉菜单
clientcreate.hWindowMenu = hMenuInitWindow ;
// 设置 客户窗口中与子窗口列表中的第一个文件窗口相关联的菜单ID
clientcreate.idFirstChild = IDM_FIRSTCHILD ;
// 创建 客户窗口 窗口类别MDICLIENT
hwndClient = CreateWindow (TEXT ("MDICLIENT"), NULL,
WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE,
0, 0, 0, 0, hwnd, (HMENU) 1, hInst,
(PSTR) &clientcreate) ;
return 0 ;
case WM_COMMAND:
switch (LOWORD (wParam))
{
case IDM_FILE_NEWHELLO:
// 设置 Hello子窗口注册属性
mdicreate.szClass = szHelloClass ;
mdicreate.szTitle = TEXT ("Hello") ;
mdicreate.hOwner = hInst ;
mdicreate.x = CW_USEDEFAULT ;
mdicreate.y = CW_USEDEFAULT ;
mdicreate.cx = CW_USEDEFAULT ;
mdicreate.cy = CW_USEDEFAULT ;
mdicreate.style = 0 ;
mdicreate.lParam = 0 ;
// 向客户窗口发送WM_MDICREATE消息,依据mdicreate结构指针,建立子窗口
hwndChild = (HWND) SendMessage (hwndClient,
WM_MDICREATE, 0,
(LPARAM) (LPMDICREATESTRUCT) &mdicreate) ;
return 0 ;
case IDM_FILE_NEWRECT: // 创建 画矩形子窗口
mdicreate.szClass = szRectClass ;
mdicreate.szTitle = TEXT ("Rectangles") ;
mdicreate.hOwner = hInst ;
mdicreate.x = CW_USEDEFAULT ;
mdicreate.y = CW_USEDEFAULT ;
mdicreate.cx = CW_USEDEFAULT ;
mdicreate.cy = CW_USEDEFAULT ;
mdicreate.style = 0 ;
mdicreate.lParam = 0 ;
hwndChild = (HWND) SendMessage (hwndClient,
WM_MDICREATE, 0,
(LPARAM) (LPMDICREATESTRUCT) &mdicreate) ;
return 0 ;
case IDM_FILE_CLOSE:
// 获得当前拥有焦点的子窗口的句柄
hwndChild = (HWND) SendMessage (hwndClient,
WM_MDIGETACTIVE, 0, 0) ;
// 向子窗口发送WM_QUERYENDSESSION消息,根据子窗口返回值来执行
if (SendMessage (hwndChild, WM_QUERYENDSESSION, 0, 0))
// 将WM_MDIDESTROY消息发送给客户窗口,从而关闭指定的子窗口
SendMessage (hwndClient, WM_MDIDESTROY,
(WPARAM) hwndChild, 0) ;
return 0 ;
case IDM_APP_EXIT:
// 向自己发送WM_CLOSE消息
SendMessage (hwnd, WM_CLOSE, 0, 0) ;
return 0 ;
// 平铺排列子窗口
case IDM_WINDOW_TILE:
SendMessage (hwndClient, WM_MDITILE, 0, 0) ;
return 0 ;
// 重叠排列子窗口
case IDM_WINDOW_CASCADE:
SendMessage (hwndClient, WM_MDICASCADE, 0, 0) ;
return 0 ;
// 按图标排列子窗口
case IDM_WINDOW_ARRANGE:
SendMessage (hwndClient, WM_MDIICONARRANGE, 0, 0) ;
return 0 ;
case IDM_WINDOW_CLOSEALL: // Attempt to close all children
// 枚举客户窗口的所有子窗口
// 对每一个子窗口调用CloseEnumProc函数
EnumChildWindows (hwndClient, CloseEnumProc, 0) ;
return 0 ;
default: // Pass to active child...
// 向客户窗口发送WM_MDIGETACTIVE消息,检索到当前拥有焦点的子窗口
hwndChild = (HWND) SendMessage (hwndClient,
WM_MDIGETACTIVE, 0, 0) ;
// IsWindow用于确定给定的子窗口句柄是否标识一个已存在的窗口
// 作为有效性检查
if (IsWindow (hwndChild))
// 将自身消息传递给子窗口消息处理程序
SendMessage (hwndChild, WM_COMMAND, wParam, lParam) ;
break ; // 退出内层循环
}
break ; // 退出循环,处理有可能的WM_CLOSE消息
case WM_QUERYENDSESSION:
case WM_CLOSE: // 尝试关闭所有子窗口
// 为自己发送菜单IDM_WINDOW_CLOSEALL消息
SendMessage (hwnd, WM_COMMAND, IDM_WINDOW_CLOSEALL, 0) ;
// 如果存在子窗口,则立刻退出,进行下一个消息迭代
if (NULL != GetWindow (hwndClient, GW_CHILD))
return 0 ;
break ; // 如果没有子窗口则跳出循环,将消息传递给DefFrameProc
case WM_DESTROY:
PostQuitMessage (0) ;
return 0 ;
}
// 未处理的消息传递给DefFrameProc(而不是DefWindowProc);
/* 该函数把所有未经处理的消息发送到活动子窗口,以便子窗口可以处理那些与它们有关的消息;
即使框架窗口消息处理程序拦截了WM_MENUCHAR、WM_SETFOCUS或WM_SIZE消息,这些消息也要被送到DefFrameProc中;
所有未经处理的WM_COMMAND消息也必须送给DefFrameProc ;
确切的说框架窗口消息处理程序并不处理任何WM_COMMAND消息;
即使这些消息是使用者在Windows子菜单的文件列表中选择文件时产生的;
(这些选项的wParam值是以IDM_FIRSTCHILD开始的);
这些消息也要传送到DefFrameProc,并在那里进行处理。*/
return DefFrameProc (hwnd, hwndClient, message, wParam, lParam) ;
}
BOOL CALLBACK CloseEnumProc (HWND hwnd, LPARAM lParam)
{
// hwnd 为客户窗口中所枚举的一个子窗口句柄
// GW_OWNER:返回的句柄标识了指定窗口的所有者窗口句柄
// 只有一个重叠或弹出式窗口可以是所有者窗口,一个子窗口不能是所有者窗口
// 依次作为有效性检查
if (GetWindow (hwnd, GW_OWNER)) // Check for icon title
return TRUE ;
// GetParent(hwnd)获得客户窗口的句柄
// WM_MDIRESTORE 最大化或还原为最小规模的MDI子窗口。
// (WPARAM) hwnd 被恢复的子窗口句柄
SendMessage (GetParent (hwnd), WM_MDIRESTORE, (WPARAM) hwnd, 0) ;
// 向子窗口发送关闭消息,根据返回值来操作
if (!SendMessage (hwnd, WM_QUERYENDSESSION, 0, 0))
return TRUE ;
// 将WM_MDIDESTROY消息发送给客户窗口,从而关闭指定的子窗口
SendMessage (GetParent (hwnd), WM_MDIDESTROY, (WPARAM) hwnd, 0) ;
return TRUE ;
}
LRESULT CALLBACK HelloWndProc (HWND hwnd, UINT message,
WPARAM wParam, LPARAM lParam)
{
/* 所有在窗口消息处理程序(或从该窗口消息处理程序中呼叫的任何函数),
中定义的静态变量由依据该窗口类别建立的所有窗口共享。
static COLORREF clrTextArray[] = { RGB (0, 0, 0), RGB (255, 0, 0),
RGB (0, 255, 0), RGB ( 0, 0, 255),
RGB (255, 255, 255) } ;
static HWND hwndClient, hwndFrame ;
HDC hdc ;
HMENU hMenu ;
PHELLODATA pHelloData ;
PAINTSTRUCT ps ;
RECT rect ;
switch (message)
{
case WM_CREATE:
// HeapAlloc 从堆中分配内存块。分配的内存不可移动。
// GetProcessHeap 获取当前进程可用的堆句柄
// HEAP_ZERO_MEMORY 指定内存分配方案,分配的内存将被初始化为零
// sizeof (HELLODATA) 所需内存的字节数
pHelloData = (PHELLODATA) HeapAlloc (GetProcessHeap (),
HEAP_ZERO_MEMORY, sizeof (HELLODATA)) ;
// 初始化目前选中的菜单项
pHelloData->iColor = IDM_COLOR_BLACK ;
// 初始化目前文字所用颜色
pHelloData->clrText = RGB (0, 0, 0) ;
// 将内存指针储存到预留的空间中
SetWindowLong (hwnd, 0, (long) pHelloData) ;
// 保存客户窗口和框架窗口的句柄
hwndClient = GetParent (hwnd) ;
hwndFrame = GetParent (hwndClient) ;
return 0 ;
case WM_COMMAND:
switch (LOWORD (wParam))
{
case IDM_COLOR_BLACK:
case IDM_COLOR_RED:
case IDM_COLOR_GREEN:
case IDM_COLOR_BLUE:
case IDM_COLOR_WHITE:
// 获得包含HELLODATA结构的内存块的指针
pHelloData = (PHELLODATA) GetWindowLong (hwnd, 0) ;
// 获取修改之后框架窗口的菜单句柄
hMenu = GetMenu (hwndFrame) ;
// 根据选择,设置菜单项选取标记
CheckMenuItem (hMenu, pHelloData->iColor, MF_UNCHECKED) ;
pHelloData->iColor = wParam ;
CheckMenuItem (hMenu, pHelloData->iColor, MF_CHECKED) ;
// 获得文字颜色值
pHelloData->clrText = clrTextArray[wParam - IDM_COLOR_BLACK] ;
InvalidateRect (hwnd, NULL, FALSE) ;
}
return 0 ;
case WM_PAINT:
hdc = BeginPaint (hwnd, &ps) ;
pHelloData = (PHELLODATA) GetWindowLong (hwnd, 0) ;
// 设置文字颜色值
SetTextColor (hdc, pHelloData->clrText) ;
// 取得窗口矩形大小
GetClientRect (hwnd, &rect) ;
// 在rect矩形内打印文字
// DT_SINGLELINE 显示正文的同一行,回车和换行符都不能折行。
// DT_CENTER 使正文在矩形中水平居中。
// DT_VCENTER 使正文在矩形中垂直居中。此参数必须和DT_SINGLELINE连用,否则GDI无法计算目的矩形.
DrawText (hdc, TEXT ("Hello, World!"), -1, &rect,
DT_SINGLELINE | DT_CENTER | DT_VCENTER) ;
EndPaint (hwnd, &ps) ;
return 0 ;
// 窗口被激活或停用时
// wParam 传递被停用的窗口句柄
// lParam 传递被激活的窗口句柄
case WM_MDIACTIVATE:
// 如果激活的窗口句柄相等则执行
if (lParam == (LPARAM) hwnd)
// 给客户窗口发送WM_MDISETMENU消息,以替换框架窗口菜单
// wParam 新的框架窗口菜单句柄。如果这个参数为NULL,框架窗口的菜单不会改变。
// lParam 新的客户窗口下拉菜单句柄,用于显示子窗口列表
// 子窗口列表 由客户窗口消息处理程序自动管理
SendMessage (hwndClient, WM_MDISETMENU,
(WPARAM) hMenuHello, (LPARAM) hMenuHelloWindow) ;
// 读取预留信息结构指针,
pHelloData = (PHELLODATA) GetWindowLong (hwnd, 0) ;
// 设置 文字颜色菜单项 的选取标记
CheckMenuItem (hMenuHello, pHelloData->iColor,
(lParam == (LPARAM) hwnd) ? MF_CHECKED : MF_UNCHECKED) ;
// 设置初始化菜单,如果失去焦点
if (lParam != (LPARAM) hwnd)
SendMessage (hwndClient, WM_MDISETMENU, (WPARAM) hMenuInit,
(LPARAM) hMenuInitWindow) ;
// 重画框架窗口的菜单条。如果系统创建窗口以后菜单条被修改,则必须调用此函数来画修改了的菜单条
DrawMenuBar (hwndFrame) ;
return 0 ;
case WM_QUERYENDSESSION:
case WM_CLOSE:
// 接受到窗口关闭消息时,弹出确认消息框
if (IDOK != MessageBox (hwnd, TEXT ("OK to close window?"),
TEXT ("Hello"),
MB_ICONQUESTION | MB_OKCANCEL))
return 0 ;
break ; // 如果点击取消,则退出循环,将消息传递给DefMDIChildProc
case WM_DESTROY:
// 释放程序分配的堆内存
pHelloData = (PHELLODATA) GetWindowLong (hwnd, 0) ;
HeapFree (GetProcessHeap (), 0, pHelloData) ;
return 0 ;
}
// WM_CHILDACTIVATE、WM_GETMINMAXINFO、WM_MENUCHAR、WM_MOVE、WM_SETFOCUS、WM_SIZE和WM_SYSCOMMAND
// 以上消息即使被处理,也必须交给该函数传递
return DefMDIChildProc (hwnd, message, wParam, lParam) ;
}
LRESULT CALLBACK RectWndProc (HWND hwnd, UINT message,
WPARAM wParam, LPARAM lParam)
{
static HWND hwndClient, hwndFrame ;
HBRUSH hBrush ;
HDC hdc ;
PRECTDATA pRectData ;
PAINTSTRUCT ps ;
int xLeft, xRight, yTop, yBottom ;
short nRed, nGreen, nBlue ;
switch (message)
{
case WM_CREATE:
// 分配堆内存
pRectData = (PRECTDATA) HeapAlloc (GetProcessHeap (),
HEAP_ZERO_MEMORY, sizeof (RECTDATA)) ;
// 在预留空间中载入内存指针
SetWindowLong (hwnd, 0, (long) pRectData) ;
// 注册定时器
SetTimer (hwnd, 1, 250, NULL) ;
// 保存客户窗口和框架窗口句柄
hwndClient = GetParent (hwnd) ;
hwndFrame = GetParent (hwndClient) ;
return 0 ;
case WM_SIZE:
// SIZE_MINIMIZED 表示窗口最小化
if (wParam != SIZE_MINIMIZED)
{
// 如果窗口非最小化,则保存窗口大小
pRectData = (PRECTDATA) GetWindowLong (hwnd, 0) ;
pRectData->cxClient = LOWORD (lParam) ;
pRectData->cyClient = HIWORD (lParam) ;
}
break ; // 退出循环,将WM_SIZE消息传递给 DefMDIChildProc
case WM_TIMER:
pRectData = (PRECTDATA) GetWindowLong (hwnd, 0) ;
// 采用随机函数获取矩形坐标和颜色值。
// 取模运算保证了随机值的不越界。
xLeft = rand () % pRectData->cxClient ;
xRight = rand () % pRectData->cxClient ;
yTop = rand () % pRectData->cyClient ;
yBottom = rand () % pRectData->cyClient ;
nRed = rand () & 255 ;
nGreen = rand () & 255 ;
nBlue = rand () & 255 ;
hdc = GetDC (hwnd) ;
// 创建随机画刷
hBrush = CreateSolidBrush (RGB (nRed, nGreen, nBlue)) ;
SelectObject (hdc, hBrush) ;
// min、max宏,保证了坐标值的正确性
Rectangle (hdc, min (xLeft, xRight), min (yTop, yBottom),
max (xLeft, xRight), max (yTop, yBottom)) ;
// 释放窗口和画刷句柄
ReleaseDC (hwnd, hdc) ;
DeleteObject (hBrush) ;
return 0 ;
case WM_PAINT:
// 使窗口区域无效
InvalidateRect (hwnd, NULL, TRUE) ;
// 简单使窗口区域有效,绘制语句由定时器消息处理
hdc = BeginPaint (hwnd, &ps) ;
EndPaint (hwnd, &ps) ;
return 0 ;
// 窗口被激活或停用时,处理菜单
case WM_MDIACTIVATE:
if (lParam == (LPARAM) hwnd)
SendMessage (hwndClient, WM_MDISETMENU, (WPARAM) hMenuRect,
(LPARAM) hMenuRectWindow) ;
else
SendMessage (hwndClient, WM_MDISETMENU, (WPARAM) hMenuInit,
(LPARAM) hMenuInitWindow) ;
DrawMenuBar (hwndFrame) ;
return 0 ;
case WM_DESTROY:
// 删除堆内存和定时器
pRectData = (PRECTDATA) GetWindowLong (hwnd, 0) ;
HeapFree (GetProcessHeap (), 0, pRectData) ;
KillTimer (hwnd, 1) ;
return 0 ;
}
return DefMDIChildProc (hwnd, message, wParam, lParam) ;
}
// MDIDemo.rc -- 资源文件
//
#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
#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
/////////////////////////////////////////////////////////////////////////////
//
// Menu
//
MDIMENUINIT MENU DISCARDABLE
BEGIN
POPUP "&File"
BEGIN
MENUITEM "New &Hello", IDM_FILE_NEWHELLO
MENUITEM "New &Rectangle", IDM_FILE_NEWRECT
MENUITEM SEPARATOR
MENUITEM "E&xit", IDM_APP_EXIT
END
END
MDIMENUHELLO MENU DISCARDABLE
BEGIN
POPUP "&File"
BEGIN
MENUITEM "New &Hello", IDM_FILE_NEWHELLO
MENUITEM "New &Rectangle", IDM_FILE_NEWRECT
MENUITEM "&Close", IDM_FILE_CLOSE
MENUITEM SEPARATOR
MENUITEM "E&xit", IDM_APP_EXIT
END
POPUP "&Color"
BEGIN
MENUITEM "&Black", IDM_COLOR_BLACK
MENUITEM "&Red", IDM_COLOR_RED
MENUITEM "&Green", IDM_COLOR_GREEN
MENUITEM "B&lue", IDM_COLOR_BLUE
MENUITEM "&White", IDM_COLOR_WHITE
END
POPUP "&Window"
BEGIN
MENUITEM "&Cascade/tShift+F5", IDM_WINDOW_CASCADE
MENUITEM "&Tile/tShift+F4", IDM_WINDOW_TILE
MENUITEM "Arrange &Icons", IDM_WINDOW_ARRANGE
MENUITEM "Close &All", IDM_WINDOW_CLOSEALL
END
END
MDIMENURECT MENU DISCARDABLE
BEGIN
POPUP "&File"
BEGIN
MENUITEM "New &Hello", IDM_FILE_NEWHELLO
MENUITEM "New &Rectangle", IDM_FILE_NEWRECT
MENUITEM "&Close", IDM_FILE_CLOSE
MENUITEM SEPARATOR
MENUITEM "E&xit", IDM_APP_EXIT
END
POPUP "&Window"
BEGIN
MENUITEM "&Cascade/tShift+F5", IDM_WINDOW_CASCADE
MENUITEM "&Tile/tShift+F4", IDM_WINDOW_TILE
MENUITEM "Arrange &Icons", IDM_WINDOW_ARRANGE
MENUITEM "Close &All", IDM_WINDOW_CLOSEALL
END
END
/////////////////////////////////////////////////////////////////////////////
//
// Accelerator
//
MDIDEMO ACCELERATORS DISCARDABLE
BEGIN
VK_F4, IDM_WINDOW_TILE, VIRTKEY, SHIFT, NOINVERT
VK_F5, IDM_WINDOW_CASCADE, VIRTKEY, SHIFT, NOINVERT
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
// RESOURCE.H -- 标记符
//
#define IDM_FILE_NEWHELLO 40001
#define IDM_FILE_NEWRECT 40002
#define IDM_APP_EXIT 40003
#define IDM_FILE_CLOSE 40004
#define IDM_COLOR_BLACK 40005
#define IDM_COLOR_RED 40006
#define IDM_COLOR_GREEN 40007
#define IDM_COLOR_BLUE 40008
#define IDM_COLOR_WHITE 40009
#define IDM_WINDOW_CASCADE 40010
#define IDM_WINDOW_TILE 40011
#define IDM_WINDOW_ARRANGE 40012
#define IDM_WINDOW_CLOSEALL 40013
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 105
#define _APS_NEXT_COMMAND_VALUE 40015
#define _APS_NEXT_CONTROL_VALUE 1000
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif