2018年2月24日星期六
gugustock_v0_201802102227_4d_主函数
#include <windows.h>
//#include <math.h>
//#include <cmath>
#include "resource.h"
#include "gugustock.h"
#include <cmath>
#include <math.h>
LRESULT CALLBACK WndProcFrame ( HWND , UINT , WPARAM , LPARAM ) ;
//frame main funtion
//框架主函数声明
LRESULT CALLBACK WndProcMainToolBar ( HWND , UINT , WPARAM , LPARAM ) ;
//main tool bar : child window : function
//主要工具栏 : 子窗口 : 函数 声明
LRESULT CALLBACK WndProcEditWindow ( HWND , UINT , WPARAM , LPARAM ) ;
//edit window : child window : function
//编辑 窗口 : 子窗口 : 函数 声明
LRESULT CALLBACK WndProcDetailToolBar ( HWND , UINT , WPARAM , LPARAM ) ;
//detail tool bar : child window : function
//详细工具栏 : 子窗口 : 函数 声明
///////
//
//main procedure
//主 程序
//
///////
int WINAPI WinMain (
HINSTANCE hInstance ,
//A handle to the current instance of the application.
//应用当前实例句柄
HINSTANCE hPrevInstance ,
//A handle to the previous instance of the application.
//应用先前实例句柄
PSTR szCmdLine ,
//The command line for the application, excluding the program name.
//程序命令行(排除程序名)
int iCmdShow
//Controls how the window is to be shown.
//控制窗口显示
)
//entry point for a graphical windows based application
//图像为基础程序的入口点
{
///////
//window class attribute to register
//窗口类属性.用于注册
wndclass.style = CS_HREDRAW | CS_VREDRAW ;
//class style
//( redraw entire window if width change )
//( redraw entire window if height change )
//类风格
//重画整个窗口,如果宽度变化
//重画整个窗口,如果高度变化
wndclass.lpfnWndProc = WndProcFrame ;
//window procedure pointer
//is
//main function
//窗口程序指针
//是
//主函数
wndclass.cbClsExtra = 0 ;
//The number of extra bytes to allocate following the window-class structure.
//窗口类结构后分配额外字节数
wndclass.cbWndExtra = 0 ;
//The number of extra bytes to allocate following the window instance.
//窗口实例后分配额外字节数
wndclass.hInstance = hInstance ;
//A handle to the instance that contains the window procedure for the class.
//类窗口程序实例
wndclass.hIcon = LoadIcon ( NULL , IDI_APPLICATION ) ;
//class icon
//=
//load icon
//< standard icon to load >
//< default icon >
//类图标
//=
//加载图标
//< 加载标准图标 >
//< 默图标 >
wndclass.hCursor = LoadCursor ( NULL , IDC_ARROW ) ;
//class cursor handle
//=
//load cursor
//< executable file ( module ) instance handle >
//< standard arrow >
//类光标句柄
//=
//加载光标
//< 执行文件(模块)实例句柄 >
//< 标准箭头 >
wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH) ;
//class background brush handle
//=
//retrieve brush handle
//< white brush >
//类背景画刷句柄
//=
//取回画刷句柄
//< 白色画刷 >
//wndclass.hbrBackground = (HBRUSH)CreateSolidBrush(RGB(0,255,0));//创建实心画刷 黄色
wndclass.lpszMenuName = szAppName ;
//class menu resource name
//类菜单资源名
wndclass.lpszClassName = szAppName ;
//window class name
//窗口类名
if (
!RegisterClass (
&wndclass
//window class structure pointer
//窗口类结构指针
)
//register window class
//注册窗口类
)
//if register window class fail
{
MessageBox (
NULL ,
//owner window : no
//主人窗口:无
TEXT ("This program requires Windows NT!") ,
//message display
//显示消息
szAppName ,
//dialog box title
//对话框标题
MB_ICONERROR
//stop sign icon
//停止标志图标
) ;
//display a modal dialog box
//显示1个形态对话框
return 0 ;
//function fail
//程序失败
}
///////
//window class attribute
//窗口类属性
wndclass.style = CS_HREDRAW | CS_VREDRAW ;
//class style
//
//< redraw entire window if width change >
//< redraw entire window if height change >
//类风格
//
//< 重画整个窗口,如果宽度变化 >
//< 重画整个窗口,如果高度变化 >
wndclass.lpfnWndProc = WndProcMainToolBar ;
//window procedure pointer
//窗口程序指针
wndclass.cbClsExtra = 0 ;
//extra byte follow window class structure
//多余字节,跟在窗口类结构之后
wndclass.cbWndExtra = sizeof(HANDLE) ;
//extra byte follow window instance
//多余字节,跟在窗口实例之后
wndclass.hInstance = hInstance ;
//class window procedure instance handle
//类窗口程序实例句柄
wndclass.hIcon = LoadIcon (NULL, IDI_APPLICATION) ;
//class icon handle
//
//load icon
//< exutable file module instance handle >
//< name icon resource >
//类图标句柄
//
//加载图标
//< 执行文件模块实例句柄 >
//< 图标资源名 >
wndclass.hCursor = LoadCursor (NULL, IDC_ARROW) ;
//class cursor handle
//
//load cursor
//< executable file module instance handle >
//< cursor resource name >
//类光标句柄
//
//加载光标
//< 执行文件模块实例句柄 >
//< 光标资源名 >
wndclass.hbrBackground = (HBRUSH)CreateSolidBrush(RGB(255,255,0));
//class background brush handle
//
//create logical brush that has special solid color
//< brush color >
//
//red green blue
//< red >
//< green >
//< blue >
//类背景画刷句柄
//
//创建逻辑画刷,有特别实体颜色
//< 画刷颜色 >
//红 绿 蓝
//< 红 >
//< 绿 >
//< 蓝 >
wndclass.lpszMenuName = NULL ;
//class menu resource name
//类菜单医院名
wndclass.lpszClassName = szmaintoolbar ;
//class name = MAINTOOLBAR
//类名字 = MAINTOOLBAR
RegisterClass (&wndclass);
//register ( window clsaa : main tool bar )
//注册( 窗口类:主要工具栏 )
///////
//window class attribute
//窗口类属性
wndclass.style = CS_HREDRAW | CS_VREDRAW ;
//class style
//
//< redraw entire window if width change >
//< redraw entire window if height change >
//类风格
//
//< 重画整个窗口,如果宽度变化 >
//< 重画整个窗口,如果高度变化 >
wndclass.lpfnWndProc = WndProcEditWindow ;
//window procedure pointer
//窗口程序指针
wndclass.cbClsExtra = 0 ;
//extra byte follow window class structure
//多余字节,跟在窗口类结构之后
wndclass.cbWndExtra = sizeof(HANDLE) ;
//extra byte follow window instance
//多余字节,跟在窗口实例之后
wndclass.hInstance = hInstance ;
//class window procedure instance handle
//类窗口程序实例句柄
wndclass.hIcon = LoadIcon (NULL, IDI_APPLICATION) ;
//class icon handle
//
//load icon
//< exutable file module instance handle >
//< name icon resource >
//类图标句柄
//
//加载图标
//< 执行文件模块实例句柄 >
//< 图标资源名 >
wndclass.hCursor = LoadCursor (NULL, IDC_ARROW) ;
//class cursor handle
//
//load cursor
//< executable file module instance handle >
//< cursor resource name >
//类光标句柄
//
//加载光标
//< 执行文件模块实例句柄 >
//< 光标资源名 >
wndclass.hbrBackground = (HBRUSH)CreateSolidBrush(RGB(0,255,255));
//class background brush handle
//
//create logical brush that has special solid color
//< brush color >
//
//red green blue
//< red >
//< green >
//< blue >
//类背景画刷句柄
//
//创建逻辑画刷,有特别实体颜色
//< 画刷颜色 >
//红 绿 蓝
//< 红 >
//< 绿 >
//< 蓝 >
wndclass.lpszMenuName = NULL ;
//class menu resource name
//类菜单医院名
wndclass.lpszClassName = szeditwindow ;
//class name = EDITWINDOW
//类名字 = EDITWINDOW
RegisterClass (&wndclass);
//register ( window clsaa : EDITWINDOW )
//注册( 窗口类:编辑窗口 )
///////
//window class attribute
//窗口类属性
wndclass.style = CS_HREDRAW | CS_VREDRAW ;
//class style
//
//< redraw entire window if width change >
//< redraw entire window if height change >
//类风格
//
//< 重画整个窗口,如果宽度变化 >
//< 重画整个窗口,如果高度变化 >
wndclass.lpfnWndProc = WndProcDetailToolBar ;
//window procedure pointer
//窗口程序指针
wndclass.cbClsExtra = 0 ;
//extra byte follow window class structure
//多余字节,跟在窗口类结构之后
wndclass.cbWndExtra = sizeof(HANDLE) ;
//extra byte follow window instance
//多余字节,跟在窗口实例之后
wndclass.hInstance = hInstance ;
//class window procedure instance handle
//类窗口程序实例句柄
wndclass.hIcon = LoadIcon (NULL, IDI_APPLICATION) ;
//class icon handle
//
//load icon
//< exutable file module instance handle >
//< name icon resource >
//类图标句柄
//
//加载图标
//< 执行文件模块实例句柄 >
//< 图标资源名 >
wndclass.hCursor = LoadCursor (NULL, IDC_ARROW) ;
//class cursor handle
//
//load cursor
//< executable file module instance handle >
//< cursor resource name >
//类光标句柄
//
//加载光标
//< 执行文件模块实例句柄 >
//< 光标资源名 >
wndclass.hbrBackground = (HBRUSH)CreateSolidBrush(RGB(255,0,255));
//class background brush handle
//
//create logical brush that has special solid color
//< brush color >
//
//red green blue
//< red >
//< green >
//< blue >
//类背景画刷句柄
//
//创建逻辑画刷,有特别实体颜色
//< 画刷颜色 >
//红 绿 蓝
//< 红 >
//< 绿 >
//< 蓝 >
wndclass.lpszMenuName = NULL ;
//class menu resource name
//类菜单医院名
wndclass.lpszClassName = szdetailtoolbar ;
//class name = DETAILTOOLBAR
//类名字 = 详细工具栏
RegisterClass (&wndclass);
//register ( window clsaa : DETAILTOOLBAR )
//注册( 窗口类:详细工具栏 )
///////
//frame
//框架
hmenuinit = LoadMenu (
hInstance ,
//module handle
//模块句柄
szAppName
//menu resource name : gugustock
//菜单资源名 : gugustock
/* //201712062037 -- ->>
TEXT( "MdiMenuInit" )
//menu resource name : MdiMenuInit
//菜单资源名 : MdiMenuInit
*/ //201712062037 -- <<-
) ;
//load ( menu : gugustock )
//加载( 菜单:gugustock )
/* //201712062037 -- ->>
//load ( menu : MdiMenuInit )
//加载( 菜单:MdiMenuInit )
*/ //201712062037 -- <<-
hmenuinitwindow = GetSubMenu (
hmenuinit ,
//menu handle
//菜单句柄
INIT_MENU_POS
//menu zero base relative postion
//菜单0基础相对位置
) ;
//handle tp drop down menu ( submenu )
//下拉菜单(子菜单)句柄
haccel = LoadAccelerators (
hInstance ,
//executable file module handle
//执行文件模块句柄
szAppName
//load avvelerator table ( name:SHOWDATA )
//加载的加速表名( 显示数据 )
) ;
//load accelerator table
//加载加速表
hwndframe = CreateWindow (
szAppName ,
//window class name
//窗口类名
szAppName ,
//window name : ( GUGUSTOCK )
//窗口名:( GUGUSTOCK )
//TEXT( "MDI FRAME" ) ,
//window name : ( MDI FRAME )
//窗口名:( MDI FRAME )
WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN ,
//window style
//
//< overlapped window >
//< Excludes the area occupied by child windows when drawing occurs within the parent window . >
//窗口风格
//
//< 重叠风格 >
//< 排除子窗口,在父窗口 >
CW_USEDEFAULT ,
//initial horizontal position
//初始化窗口水平位置
CW_USEDEFAULT ,
//initial vertical position
//初始化窗口垂直位置
CW_USEDEFAULT ,
//window width
//窗口宽度
CW_USEDEFAULT ,
//window height
//窗口高度
NULL ,
//parent window
//父窗口
hmenuinit ,
//menu handle
//菜单句柄
hInstance ,
//module instance handle
//模块实例句柄
NULL
//no addition data
//无附加数据
) ;
hwndclient = GetWindow ( hwndframe , GW_CHILD ) ;
//get special relationship window handle
//
//< window handle >
//< child window >
//获得特别关系窗口句柄
//< 窗口句柄 >
//< 子窗口 >
///////
//frame window end code
//框架窗口结尾代码
if (
!hwndframe
//frame window
//框架窗口
)
//if frame window fail
//如果框架窗口失败
{
return 0 ;
//fail : return
//失败 :返回
}
ShowWindow (
hwndframe ,
//window handle
//窗口句柄
iCmdShow
//window how show
//窗口如何显示
) ;
//set window show state
//设置窗口显示状态
UpdateWindow (
hwndframe
//window handle to update
//窗口句柄用于更新
) ;
//update window client
//更新窗口客户端
while (
GetMessage (
&msg ,
//message structure pointer
//消息结构指针
NULL ,
//window handle
//窗口句柄
0 ,
//retrieve lowest value message
//取回最低值消息
0
//retrieve highest value message
//取回最高值消息
)
//retrieve message
//取回消息
)
//retrieve message withou stop
//不停的取回消息
{
if (
!TranslateMDISysAccel (
hwndclient ,
//mdi client window handle
//多文档客户窗口句柄
&msg
//message pointer
//消息指针
)
//process accelerator keystroke
//执行加速键
//
//not process accelerator keystroke
//没执行加速键
&&
//and
//而且
!TranslateAccelerator (
hwndframe ,
//window handle
//窗口句柄
haccel ,
//accelerator table handle
//加速表句柄
&msg
//message structure pointer
//消息结构指针
)
//process accelertator key
//处理加速键
//not process accelerator key
//不能处理加速键
)
{
TranslateMessage (&msg) ;
//translate virtual key message to cjaracter message
//翻译虚拟键消息到字符消息
DispatchMessage (&msg) ;
//dispatch message
//快速处理消息
}
}
return msg.wParam ;
//( message information ) . ( additional information )
//( 消息信息 ) . ( 附加信息 )
}
///////
//frame function
//框架函数
LRESULT CALLBACK WndProcFrame (
HWND hwndframe,
UINT message_frame,
WPARAM wParam_frame,
LPARAM lParam_frame
)
{
switch (
message_frame
//message
//消息
)
//message value
//消息值
{
case WM_CREATE :
//window create
//窗口创建
//hInstance=(HINSTANCE)GetWindowLong(hwndframe,GWL_HINSTANCE);//收到主窗口 instance
clientcreate.hWindowMenu = hmenuinitwindow ;
//mdi menu handle
//多文档菜单句柄
clientcreate.idFirstChild = IDM_FIRSTCHILD ;
//first mdi child window identifier
//第1个多文档子窗口标识符
//hwndclient = CreateWindow (TEXT("MDICLIENT"),NULL,WS_CHILD|WS_CLIPCHILDREN|WS_VISIBLE,200,50,500,500,hwnd,NULL,hInstance,(PSTR)&clientcreate);
hwndclient = CreateWindow (
TEXT("MDICLIENT") ,
//designate mdi client window
//指定多文档客户窗口
NULL ,
//window name
//窗口名
WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE ,
//< child window >
//or ( == add )
//< exclude child window area >
//or ( == add )
//< window visible >
//< 子窗口 >
//或(==叠加)
//< 排除子窗口区域 >
//或(==叠加)
//< 窗口可见 >
CW_USEDEFAULT ,
//initial horizontal position
//初始水平位置
CW_USEDEFAULT ,
//initial vertical position
//初始垂直位置
CW_USEDEFAULT ,
//window width
//窗口宽度
CW_USEDEFAULT ,
//window height
//窗口高度
hwndframe ,
//parent window handle
//上级窗口句柄
NULL ,
//menu handle
//菜单句柄
hInstance ,
//window module instance handle
//窗口模块实例句柄
(PSTR)&clientcreate
//clientcreatestruct structure pointer
//clientcreatestructure 结构指针
);
//create mdi window
//创建多文档窗口
mdicreate_maintoolbar.szClass = szmaintoolbar ;
//mdi child window name
//多文档子窗口名
mdicreate_maintoolbar.szTitle = NULL ;
//mdi chile window title
//多文档子窗口标题
mdicreate_maintoolbar.hOwner = hInstance ;
//mdi client window application instance handle
//多文档客户窗口应用程序实例句柄
mdicreate_maintoolbar.x = 50 ;
//mdi child window intial horizontal position
//多文档子窗口初始水平位置
mdicreate_maintoolbar.y = 50 ;
//mdi child window inital vertical postiton
//多文档子窗口初始垂直位置
mdicreate_maintoolbar.cx = 500 ;
//mdi child window intial width
//多文档子窗口初始宽度
mdicreate_maintoolbar.cy = 500 ;
//mdi child window intial height
//多文档子窗口初始高度
mdicreate_maintoolbar.style = WS_BORDER | WS_HSCROLL | WS_VSCROLL ;
//mdi child window style
//
//< thin line border >
//< horizontal scroll bar >
//< vertical scroll bar >
//多文档子窗口风格
//
//< 细线边界 >
//< 水平滚动条 >
//< 垂直滚动条 >
mdicreate_maintoolbar.lParam = 0 ;//application defined value is 0
//application define value
//应用程序定义值
//hwndchild = (HWND)SendMessage(hwnd,WM_MDICREATE,0,(LPARAM)(LPMDICREATESTRUCT)&mdicreate);
hwndchild_maintoolbar = (HWND)SendMessage (
hwndclient ,
//window handle to receive message
//窗口句柄,用于接收消息
WM_MDICREATE ,
//message to be sent
//
//message : ( create mdi client window )
//消息,用于发送
//
//消息 : ( 用于创建多文档客户窗口 )
0 ,
//additional message information
//附加消息信息
(LPARAM)(LPMDICREATESTRUCT)&mdicreate_maintoolbar
//addtional message information
//
//mdicreatestruct ( : create mdi child window ) structure pointer
//附加消息信息
//
//mdicreatestruct ( : 用于创建多文档子窗口 ) 结构指针
) ;
//send message to window
//发送消息,到窗口
mdicreate_editwindow.szClass = szeditwindow ;
//mdi child window name
//多文档子窗口名
mdicreate_editwindow.szTitle = NULL ;
//mdi chile window title
//多文档子窗口标题
mdicreate_editwindow.hOwner = hInstance ;
//mdi client window application instance handle
//多文档客户窗口应用程序实例句柄
mdicreate_editwindow.x = 150 ;
//mdi child window intial horizontal position
//多文档子窗口初始水平位置
mdicreate_editwindow.y = 150 ;
//mdi child window inital vertical postiton
//多文档子窗口初始垂直位置
mdicreate_editwindow.cx = 500 ;
//mdi child window intial width
//多文档子窗口初始宽度
mdicreate_editwindow.cy = 500 ;
//mdi child window intial height
//多文档子窗口初始高度
mdicreate_editwindow.style = WS_BORDER | WS_HSCROLL | WS_VSCROLL ;
//mdi child window style
//
//< thin line border >
//< horizontal scroll bar >
//< vertical scroll bar >
//多文档子窗口风格
//
//< 细线边界 >
//< 水平滚动条 >
//< 垂直滚动条 >
mdicreate_editwindow.lParam = 0 ;//application defined value is 0
//application define value
//应用程序定义值
//hwndchild = (HWND)SendMessage(hwnd,WM_MDICREATE,0,(LPARAM)(LPMDICREATESTRUCT)&mdicreate);
hwndchild_editwindow = (HWND)SendMessage (
hwndclient ,
//window handle to receive message
//窗口句柄,用于接收消息
WM_MDICREATE ,
//message to be sent
//
//message : ( create mdi client window )
//消息,用于发送
//
//消息 : ( 用于创建多文档客户窗口 )
0 ,
//additional message information
//附加消息信息
(LPARAM)(LPMDICREATESTRUCT)&mdicreate_editwindow
//addtional message information
//
//mdicreatestruct ( : create mdi child window ) structure pointer
//附加消息信息
//
//mdicreatestruct ( : 用于创建多文档子窗口 ) 结构指针
) ;
//send message to window
//发送消息,到窗口
mdicreate_detailtoolbar.szClass = szdetailtoolbar ;
//mdi child window name
//多文档子窗口名
mdicreate_detailtoolbar.szTitle = NULL ;
//mdi chile window title
//多文档子窗口标题
mdicreate_detailtoolbar.hOwner = hInstance ;
//mdi client window application instance handle
//多文档客户窗口应用程序实例句柄
mdicreate_detailtoolbar.x = 250 ;
//mdi child window intial horizontal position
//多文档子窗口初始水平位置
mdicreate_detailtoolbar.y = 250 ;
//mdi child window inital vertical postiton
//多文档子窗口初始垂直位置
mdicreate_detailtoolbar.cx = 500 ;
//mdi child window intial width
//多文档子窗口初始宽度
mdicreate_detailtoolbar.cy = 500 ;
//mdi child window intial height
//多文档子窗口初始高度
mdicreate_detailtoolbar.style = WS_BORDER | WS_HSCROLL | WS_VSCROLL ;
//mdi child window style
//
//< thin line border >
//< horizontal scroll bar >
//< vertical scroll bar >
//多文档子窗口风格
//
//< 细线边界 >
//< 水平滚动条 >
//< 垂直滚动条 >
mdicreate_detailtoolbar.lParam = 0 ;//application defined value is 0
//application define value
//应用程序定义值
//hwndchild = (HWND)SendMessage(hwnd,WM_MDICREATE,0,(LPARAM)(LPMDICREATESTRUCT)&mdicreate);
hwndchild_detailtoolbar = (HWND)SendMessage (
hwndclient ,
//window handle to receive message
//窗口句柄,用于接收消息
WM_MDICREATE ,
//message to be sent
//
//message : ( create mdi client window )
//消息,用于发送
//
//消息 : ( 用于创建多文档客户窗口 )
0 ,
//additional message information
//附加消息信息
(LPARAM)(LPMDICREATESTRUCT)&mdicreate_detailtoolbar
//addtional message information
//
//mdicreatestruct ( : create mdi child window ) structure pointer
//附加消息信息
//
//mdicreatestruct ( : 用于创建多文档子窗口 ) 结构指针
) ;
//send message to window
//发送消息,到窗口
SetClassLong (
hwndclient ,
//window handle
//窗口句柄
GCL_HBRBACKGROUND ,
//replace class backfround handle
//替代类背景句柄
(LONG)CreateSolidBrush (
RGB (
0 ,
//red
//红
0 ,
//green
//绿
255
//blue
//蓝
)
//brush color
//
//select color
//画刷颜色
//
//选择颜色
)
//create color brush
//创建颜色画刷
) ;
//replace window class background value
//替代窗口类背景值
return 0;
//window ceate success
//窗口创建成功
case WM_COMMAND :
//menu , accelerator , control command
//菜单,加速键,控件 命令
switch (
LOWORD (
wParam_frame
//menu identifier
//菜单标识符
)
//menu identifier value
//菜单标识符值
)
{
case ZMENUPOP_OPEN :
//menu -> open
//菜单 -> 打开
ZeroMemory (
&zofn ,
//block memory start address pointer
//
//intialize ( open ) or ( save as ) dialog box information
//记忆块开始地址指针
//
//初始化(打开)或(保存)对话框信息
sizeof (
zofn
//intialize ( open ) or ( save as ) dialog box information
//初始化(打开)或(保存)对话框信息
)
//size of ( intialize ( open ) or ( save as ) dialog box information )
//大小( 初始化(打开)或(保存)对话框信息 )
) ;
//fill
//{ size of ( intialize ( open ) or ( save as ) dialog box information ) }
//to
//{ intialize ( open ) or ( save as ) dialog box information } variable
//填入
//{ 大小( 初始化(打开)或(保存)对话框信息 ) }
//到
//{ 初始化(打开)或(保存)对话框信息 }
zofn.lStructSize = sizeof (
zofn
//intialize ( open ) or ( save as ) dialog box information
//初始化(打开)或(保存)对话框信息
) ;
//size of { intialize ( open ) or ( save as ) dialog box information }
//大小( 初始化(打开)或(保存)对话框信息 )
//structure byte length
//结构字节长度
zofn.hwndOwner = hwndframe ;
//dialog box owner window handle
//对话框上级窗口句柄
zofn.hInstance = hInstance ;
//dialog box template instance
//对话框模板实例
zofn.lpstrFilter = "All\0*.*\0Text\0*.TXT\0" ;
//filter string buffer
//过滤字符串缓冲
zofn.lpstrCustomFilter = NULL ;
//preserve pattern filter string buffer
//保留(样式:过滤字符串缓冲)
zofn.nMaxCustFilter = NULL ;
//size of ( preserve pattern filter string buffer )
//大小
//:保留(样式:过滤字符串缓冲)
zofn.nFilterIndex = 1 ;
//file type control current index
//文件类型控件现在索引
zofn.lpstrFile = zfilename ;
//file name ( : initial file name control )
//文件名( ::用于初始化文件名控件 )
zofn.nMaxFile = sizeof (
zfilename
//file name ( : initial file name control )
//文件名( ::用于初始化文件名控件 )
) ;
//size of
//: file name ( : initial file name control )
//大小
//: 文件名( ::用于初始化文件名控件 )
//size of
//: file name ( : initial file name control )
//大小
//: 文件名( ::用于初始化文件名控件 )
//zofn.lpstrFile[0] = '\0' ;
//file name ( : initial file name control )
//: first char NULL
//文件名( ::用于初始化文件名控件 )
//: 第1个字符是 NULL
zofn.lpstrFileTitle = NULL ;
//file name and extension without path
//文件名和扩展名,不伴随路径
zofn.nMaxFileTitle = 0;
//size of
//: file name and extension without path
//大小
//: 文件名和扩展名,不伴随路径
zofn.lpstrInitialDir = NULL ;
//initial directory
//初始化目录
zofn.lpstrTitle = NULL ;
//dialog box title
//对话框标题
zofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST ;
//flag
//
//< exist file >
//or ( add )
//< path and name valid >
//标示
//
//< 存在的文件 >
//或者(叠加)
//< 路径和名有效 >
//zofn.nFileOffset = znfileoffset ;
zofn.nFileOffset = NULL ;
//offset :
//( path begin ) to ( file name )
//偏移
//( 路径开始 ) 到 ( 文件名 )
zofn.nFileExtension = NULL ;
//offset :
//( path begin ) to ( extension )
//偏移
//( 路径开始 ) 到 ( 扩展名 )
zofn.lpstrDefExt = NULL ;
//default extension
//默认扩展名
zofn.lCustData = NULL ;
//hook procedure application define data
//钩程序应用程序定义数据
zofn.lpfnHook = NULL ;
//hook procedure pointer
//钩程序指针
zofn.lpTemplateName = NULL ;
//dialog template resource name
//对话框模板资源名
if (
GetOpenFileName (
&zofn
//openfilename sturcture information pointer
//openfilename 结构信息指针
)
//create ( open dialog box )
//创建( 打开对话框 )
== TRUE
//click ( ok button )
//点击( ok 按钮 )
)
//if
//click ( open dialog box ) ( ok button )
//如果
//点击( 打开对话框 ) 的 ( ok 按钮 )
{
/* //201712062017 -- <<-
///////
// --
// zhfile = CreateFile (
// zofn.lpstrFile ,
// //file or device name
// //文件或者设备名
// GENERIC_READ ,
// //request access
// //请求权利
// 0 ,
// //prevent other process from open a file
// //阻止其它处理,在打开文件后
// (LPSECURITY_ATTRIBUTES) NULL ,
// //security attribute pointer
// //安全属性指针
// OPEN_EXISTING ,
// //open file or device , only if exist
// //打开文件或者设备,只如果存在
// FILE_ATTRIBUTE_NORMAL ,
// //no other attribute
// //没有其它属性
// (HANDLE) NULL
// //( template file handle ) ( with generic read )
// //( 模块文件句柄 ) ( 在读权利 )
// ) ;
// //create or open file or i/o device
// //( 创建或者打开 ) ( 文件或者输入输出设备 )
//
// zerror = GetLastError () ;
// //error code
// //错误代码
//
// SetFilePointer (
// zhfile ,
// //file handle
// //文件句柄
// 0 ,
// //low order 32-bits to move
// //???????
// //(在64位中)低位的( 32位 ),用于移动
// NULL ,
// //high order 32-bits to move
// //???????
// //(在64位中)高位的( 32位 ),用于移动
// FILE_BEGIN
// //start point == 0
// //begin of file
// //开始点 == 0
// //文件开始
// ) ;
// //move file pointer
// //移动文件指针
//
// zerror = GetLastError () ;
// //error code
// //错误代码
//
// zbytereadfilecounttemp = GetFileSize (
// zhfile ,
// //file handle
// //文件句柄
// NULL
// //high order doubleword file size pointer
// //(在64位中)高位32位双字文件大小指针
// ) ;
// //retrieve file size
// //取回文件大小
// zbytereadfiletemp = ( BYTE * ) malloc (
// zbytereadfilecounttemp
// //allocate byte
// //分配字节
// ) ;
// //allocate memory block
// //分配记忆块
// ZeroMemory (
// zbytereadfiletemp ,
// //memory block pointer
// //记忆块指针
// zbytereadfilecounttemp
// //memory block size
// //记忆块大小
// ) ;
// //fill block size to zero
// //填充快大小,到值0
// ReadFile (
// zhfile ,
// //file handle
// //文件句柄
// zbytereadfiletemp ,
// //( byte pointer ) : ( read file ) : temp
// //( 字节指针 ) : ( 读文件 ) : 暂时
// zbytereadfilecounttemp ,
// //( byte [ pointer ] ) : ( read file ) : count : temp
// //( 字节 [ 指针 ] ) : ( 读文件 ) : 计数 : 暂时
// &zbytereadfilereceivecounttemp ,
// //( byte [ pointer ] ) : ( receive from [ read file ] ) : count : temp
// //( 字节 [ 指针 ] ) : ( 收到来自[读文件] ) : 计数 : 暂时
// NULL
// //no overlapped structure
// //没有 overlapped 结构
// ) ;
// //read file
// //读文件
// zerror = GetLastError () ;
// //error code
// //错误代码
// CloseHandle (
// zhfile
// //file handle
// //文件句柄
// ) ;
// //close handle
// //关闭句柄
// --
///////
z_procedure_pathfilenameextension_pathfilenameextension = ( BYTE * ) zofn.lpstrFile ;
//paht + file name + extension
//路径 + 文件名 + 扩展名
z_procedure_pathfilenameextension__begintofilenamestart = zofn.nFileOffset ;
//begin to file name start
//
//example : a:\bbb\ccc.ddd
//begin to file name start
//==
//a:\bbb\
//开始 到 文件名 开始
//
//例子 : a:\bbb\ccc.ddd
//开始 到 文件名 开始
//==
//a:\bbb\
//
z_procedure_pathfilenameextension_begintoextensionstart = zofn.nFileExtension -1 ;
//begin to extension start
//
//example : a:\bbb\ccc.ddd
//begin to extension start
//==
//a:\bbb\ccc
//
//note :
//extension
//==
//( ,ddd )
//开始 到 扩展名 开始
//
//例子 : a:\bbb\ccc.ddd
//开始 到 扩展名 开始
//==
//a:\bbb\ccc
//
//注意 :
//扩展名
//==
//( ,ddd )
//z_procedure_pathfilenameextension_begintoextensionstart = z_procedure_pathfilenameextension_begintoextensionstart ;
ZFPATHFILENAMEEXTENSION (
z_procedure_pathfilenameextension_pathfilenameextension ,
//input :
//paht + file name + extension
//路径 + 文件名 + 扩展名
znull ,
//input :
//paht + file name + extension :
//end :flag
//路径 + 文件名 + 扩展名
//结束 : 标志
z_procedure_pathfilenameextension__begintofilenamestart ,
//input :
//begin to file name start
//
//example : a:\bbb\ccc.ddd
//begin to file name start
//==
//a:\bbb\
//开始 到 文件名 开始
//
//例子 : a:\bbb\ccc.ddd
//开始 到 文件名 开始
//==
//a:\bbb\
z_procedure_pathfilenameextension_begintoextensionstart ,
//input :
//begin to extension start
//
//example : a:\bbb\ccc.ddd
//begin to extension start
//==
//a:\bbb\ccc
//
//note :
//extension
//==
//( ,ddd )
//开始 到 扩展名 开始
//
//例子 : a:\bbb\ccc.ddd
//开始 到 扩展名 开始
//==
//a:\bbb\ccc
//
//注意 :
//扩展名
//==
//( ,ddd )
z_procedure_pathfilenameextension_path ,
//output :
//path + ( end : flag )
//路径 + ( 结束 : 标志 )
z_procedure_pathfilenameextension_filename ,
//output :
//file name + ( end : flag )
//文件名 + ( 结束 : 标志 )
z_procedure_pathfilenameextension_filenameextension ,
//output :
//file name + extension + ( end : flag )
//文件名 + 扩展名 + ( 结束 : 标志 )
znull
//input :
//( path ) ( end : flag )
//( file name ) ( end : flag )
//( file name + extension ) ( end : flag )
//( 路径 ) ( 结束 : 标志 )
//( 文件名 ) ( 结束 : 标志 )
//( 文件名 + 扩展名 ) ( 结束 : 标志 )
) ;
///////
//( path + file name + extension ) extract
//
//extract : path
//extract : file name
//extract : extension == ( .xxx )
//( 路径 + 文件名 + 扩展名 ) 提取
//
//提取 : 路径
//提取 : 文件名
//提取 ::扩展名 == ( .xxx )
///////
// ==
// --
*/ //201712062017 -- <<-
MessageBox (
hwndframe ,
TEXT( "g7" ) ,
TEXT( "G7" ) ,
MB_OK
);
// --
// --
///////
}
return 0 ;
//( menu -> open ) : success
//( 菜单 -> 打开 ) : 成功
}
case WM_PAINT :
//request paint window portion
//请求画窗口部分
///////
// --
// --
InvalidateRect (
hwndclient ,
//window handle
//窗口句柄
NULL ,
//update region rectangle pointer
//更新区域矩形指针
TRUE
//background erase
//背景擦除
);
//add rectangle to window update region
//添加矩形到窗口更新区域
zhdc = BeginPaint (
hwndclient ,
//window handle
//窗口句柄
&zps
//paintstruct structure pointer
//paintstruct 结构指针
);
//prepare specified window for paint
//准备指定窗口,用于绘画
//SelectObject (
// zhdc,
// CreateSolidBrush (
// RGB(255,0,0)
// )
// );
EndPaint (
hwndclient ,
//window handle
//窗口句柄
&zps
//paintstruct structure pointer
//paintstruct 结构指针
);
//end paint in specified window
//结束绘画,在指定窗口
// --
// --
///////
return 0 ;
//request paint window portion , success
//请求画窗口部分,成功
case WM_DESTROY :
//window destroy
//窗口消灭
PostQuitMessage (
0
//application exit code
//应用程序退出代码
) ;
//system thread terminate
//系统线程终止
return 0;
//window destroy success
//窗口消灭成功
}
//return DefWindowProc (hwnd,message,wParam,lParam);//提供框架窗口不执行窗口消息
return DefFrameProc (
hwndframe ,
//mdi frame window handle
//多文档框架窗口句柄
hwndclient ,
//mdi client window handle
//多文档客户窗口句柄
message_frame ,
//message to be process
//消息,用于处理
wParam_frame ,
//additional message information
//附加消息信息
lParam_frame
//addtional message information
//附加消息信息
) ;
//default process for message
//默认处理消息
}
///////
//main tool bar : function
//主要 工具 栏 : 函数
LRESULT CALLBACK WndProcMainToolBar (
HWND hwndchild_maintoolbar,
UINT message_maintoolbar,
WPARAM wParam_maintoolbar,
LPARAM lParam_maintoolbar
)
//main tool bar : function
//主要 工具 栏 : 函数
{
switch (
message_maintoolbar
//message
//消息
)
//message value
//消息值
{
case WM_CREATE :
//window create
//窗口创建
return 0 ;
//window create success
//创建创建成功
case WM_DESTROY :
//window destroy
//窗口消灭
return 0 ;
//window destroy success
//窗口消灭成功
}
return DefMDIChildProc (
hwndchild_maintoolbar,
//mdi child widnow handle
//多文档子窗口句柄
message_maintoolbar,
//message to process
//消息,用于处理
wParam_maintoolbar,
//additional message
//附加消息
lParam_maintoolbar
//additional message
//附加消息
) ;
//provide default process
//提供默认处理
}
///////
//edit window : function
//编辑 窗口 : 函数
LRESULT CALLBACK WndProcEditWindow (
HWND hwndchild_editwindow,
UINT message_editwindow,
WPARAM wParam_editwindow,
LPARAM lParam_editwindow
)
//edit window : function
//编辑 窗口 : 函数
{
switch (
message_editwindow
//message
//消息
)
//message value
//消息值
{
case WM_CREATE :
//window create
//窗口创建
return 0 ;
//window create success
//创建创建成功
case WM_DESTROY :
//window destroy
//窗口消灭
return 0 ;
//window destroy success
//窗口消灭成功
}
return DefMDIChildProc (
hwndchild_editwindow,
//mdi child widnow handle
//多文档子窗口句柄
message_editwindow,
//message to process
//消息,用于处理
wParam_editwindow,
//additional message
//附加消息
lParam_editwindow
//additional message
//附加消息
) ;
//provide default process
//提供默认处理
}
///////
//detail tool bar : function
//详细 工具 栏 : 函数
LRESULT CALLBACK WndProcDetailToolBar (
HWND hwndchild_detailtoolbar,
UINT message_detailtoolbar,
WPARAM wParam_detailtoolbar,
LPARAM lParam_detailtoolbar
)
//detail tool bar : function
//详细 工具 栏 : 函数
{
switch (
message_detailtoolbar
//message
//消息
)
//message value
//消息值
{
case WM_CREATE :
//window create
//窗口创建
return 0 ;
//window create success
//创建创建成功
case WM_DESTROY :
//window destroy
//窗口消灭
return 0 ;
//window destroy success
//窗口消灭成功
}
return DefMDIChildProc (
hwndchild_detailtoolbar,
//mdi child widnow handle
//多文档子窗口句柄
message_detailtoolbar,
//message to process
//消息,用于处理
wParam_detailtoolbar,
//additional message
//附加消息
lParam_detailtoolbar
//additional message
//附加消息
) ;
//provide default process
//提供默认处理
}
///////
//( define variable )
//宏变量
///////
#define _USE_MATH_DEFINES
///////
#define INIT_MENU_POS 70000
//menu zero base relative postion
//菜单0基础相对位置
#define IDM_FIRSTCHILD 70100
//first mdi child window identifier
//第1个多文档子窗口标识符
///////
//standard variable
//标准变量
static TCHAR szAppName [] = TEXT ("GUGUSTOCK") ;
//frame window class name
//框架窗口类名
static WNDCLASS wndclass ;
//window class attribute
//窗口类属性
static HWND hwndframe ;
//frame window handle
//框架窗口句柄
static MSG msg ;
//message
//消息
static UINT message_frame ;
static WPARAM wParam_frame ;
static LPARAM lParam_frame ;
static UINT message_maintoolbar ;
static WPARAM wParam_maintoolbar ;
static LPARAM lParam_maintoolbar ;
static UINT message_editwindow ;
static WPARAM wParam_editwindow ;
static LPARAM lParam_editwindow ;
static UINT message_detailtoolbar ;
static WPARAM wParam_detailtoolbar ;
static LPARAM lParam_detailtoolbar ;
///////
//frame standard variable
//框架标准变量
static TCHAR szmaintoolbar [] = TEXT( "MAINTOOLBAR" ) ;
//mdi child window name
//多文档子窗口名
static TCHAR szeditwindow [] = TEXT( "EDITWINDOW" ) ;
//mdi child window name
//多文档子窗口名
static TCHAR szdetailtoolbar [] = TEXT( "DETAILTOOLBAR" ) ;
//mdi child window name
//多文档子窗口名
//static TCHAR szresourcefile [] = TEXT( "g" ) ;
static HWND hwndclient ;
//client window handle
//客户窗口句柄
static HMENU hmenuinit ;
//menu resource handle
//菜单资源句柄
static HMENU hmenuinitwindow ;
//menu submenu handle
//菜单中的子菜单句柄
static HACCEL haccel ;
//accelerator table handle
//加速表句柄
static HINSTANCE hInstance ;
//handle instance
//句柄事例
static CLIENTCREATESTRUCT clientcreate ;
//Contains information about the menu and first multiple-document interface (MDI) child window of an MDI client window.
//多文档客户端窗口 结构
static MDICREATESTRUCT mdicreate_maintoolbar ;
//( Contains information about the class, title, owner, location, and size of a multiple-document interface (MDI) child window. )
//about ( main tool bar )
//多文档接口子窗口 信息
static HWND hwndchild_maintoolbar ;
//( handle child : main tool bar )
//主要工具栏 : 子窗口
static MDICREATESTRUCT mdicreate_editwindow ;
//( Contains information about the class, title, owner, location, and size of a multiple-document interface (MDI) child window. )
//about ( main tool bar )
//多文档接口子窗口 信息
static HWND hwndchild_editwindow ;
//( handle child : main tool bar )
//主要工具栏 : 子窗口
static MDICREATESTRUCT mdicreate_detailtoolbar ;
//( Contains information about the class, title, owner, location, and size of a multiple-document interface (MDI) child window. )
//about ( main tool bar )
//多文档接口子窗口 信息
static HWND hwndchild_detailtoolbar ;
//( handle child : main tool bar )
//主要工具栏 : 子窗口
static HDC zhdc ;
//handle dc
//dc句柄
static PAINTSTRUCT zps ;
//The PAINTSTRUCT structure contains information for an application.
//This information can be used to paint the client area of a window owned by that application.
//窗口客户区域 信息
///////
///////
//program variable
//程序 变量
static OPENFILENAME zofn ;
//initialize ( open ) and ( save as ) dialog box information
//初始化打开或保存对话框信息
static CHAR zfilename[260] ;
//file name ( : initial file name control )
//文件名( ::用于初始化文件名控件 )
static HANDLE zhfile ;
//file handle
//文件句柄
///////
//program variable
//: menu -> open
//: ZMENUPOP
static BYTE * z_p_filepathtemp ;
//file path : pointer : temp
//文件路径 : 指针 : 临时
static BYTE * z_p_filepath ;
//file path : pointer
//文件路径 : 指针
static DWORD z_filepathsize ;
//file path : pointer : size
//文件路径 : 指针 : 大小
//static BYTE * z_p_filenametemp ;
//file name : pointer : temp
//文件名 : 指针 : 临时
static BYTE * z_p_filename ;
//file name : pointer
//文件名 : 指针
//static BYTE z_pointersize_flag ;
//end : flag
//结束 : 标志
static DWORD z_filenamesize ;
//file name : pointer : size
//文件名 : 指针 : 大小
//static DWORD znfileoffset ;
//offset :
//( path begin ) to ( file name )
//偏移
//( 路径开始 ) 到 ( 文件名 )
///////
//constant
///////
//常数
///////
//constant ->>
static BYTE z1 = 0x01 ;
//0x01
//0x01
static BYTE z30 = 0x30 ;
//0x30 == ( 0 : text )
//0x30 == ( 0 : 文本 )
static BYTE z39 = 0x39 ;
//0x39 == ( 9 : text )
//0x39 == ( 9 : 文本 )
static BYTE zff = 0xff ;
//0xff
//0xff
static BYTE zzero = 0 ;
//0
//0
static BYTE zten = 10 ;
//10
//10
static BYTE znull = 0x00 ;
//NULL
//没有 字节
static BYTE z00 = 0x00 ;
//0x00
//0x00
static BYTE z09 = 0x09 ;
//0x09 == tab
//0x09 == 水平制表符
static BYTE z0a = 0x0a ;
//0x0a
//0x0a
static BYTE z0d = 0x0d ;
//0x0d
//0x0d
static BYTE z22 = 0x22 ;
//0x22 == "
//0x22 == "
static BYTE z2d = 0x2d ;
//0x2d : -
//0x2d : -
static BYTE z2e = 0x2e ;
//0x2e == .
//0x2e == .
static BYTE z2f = 0x2f ;
//0x2f == /
//0x2f == /
static DWORD z00dword = 0x00 ;
//0x00 = 00
//0x00 = 00
static DWORD z01dword = 0x01 ;
//0x01
//0x01
static DWORD z02dword = 0x02 ;
//0x02 = 02
//0x02 = 02
static DWORD z03dword = 0x03 ;
//0x03 = 03
//0x03 = 03
static DWORD z04dword = 0x04 ;
//0x04 = 04
//0x04 = 04
static DWORD z06dword = 0x06 ;
//0x06
//0x06
static DWORD z08dword = 0x08 ;
//0x08
//0x08
static DWORD z09dword = 0x09 ;
//0x09
//0x09
static DWORD z0adword = 0x0a ;
//0x0a = 10
//0x0a = 10
static DWORD z0fdword = 0x0f ;
//0x0f = 15
//0x0f = 15
static DWORD z10dword = 0x10 ;
//0x10 = 16
//0x10 = 16
static DWORD z11dword = 0x11 ;
//0x11 = 17
//0x11 = 17
static DWORD z10000dword = 0x10000 ;
//0x10000 = 0x10000
//0x10000 = 0x10000
static DWORD zmaxpath = 260 ;
//max path == 260
//最大 路径 == 260
static DWORD zzerodword = 0 ;
//0
//0
static DWORD z20dword = 0x00000020 ;
//z32dword == 32
//z32dword == 32
static CHAR extensionconvert[] = ".convert" ;
//extension : .convert
//扩展名 : .convert
static CHAR extensionflag[] = ".flag" ;
//extension : .flag
//扩展名 : .flag
//constant <<-
订阅:
博文评论 (Atom)
没有评论:
发表评论