超级模仿秀--挑战微软画图软件(1)
2006-11-01 15:53
323 查看
学习Visual C++编程,有一个速成的办法就是首先跟着案例做,接着模仿现成的软件,最后独立创新。
[align=left] --Highness[/align]
[align=left] [/align]
[align=left] 挑战微软“画图”软件,对于高手来说,其实并不是什么困难的事。对于刚入门的学习者利用VisualC++编一个跟微软“画图”软件一模一样的工程,有一条路可以走。这条路就是“建立基本框架,功能逐一完善”。我们从画图软件中的菜单栏开始,首先在ResouceView视图里面,选择Menu,IDR_MAINFRAME,使得菜单栏和画图一样。即:[/align]
[align=left]------------------------------------------------------------------------------------------[/align]
[align=left]文件(F)|编辑(E)|查看(V)|图像(I)|帮助(H) [/align]
[align=left]------------------------------------------------------------------------------------------[/align]
[align=left]建立好菜单,同时也明确了我们的任务。我们的主要任务是将菜单栏上每一个选项的功能逐一完善。那么我们的模仿秀基本就完成了。
万事皆从简单事情做起,编写软件更何况不是呢?我们从最简单的功能做起,一个一个将功能实现。[/align]
[align=left]下面以提问的方式介绍。[/align]
[align=left] 打开Visual C++,新建MFC APPWIZARD EXE工程,工程名为“Draw”,在向导的第1步“Step 1 of 6” ,选择单文档,在向导的第4步“Step 4 of 6”,将隐藏工具栏和打印和打印预览选项取消打勾。其它皆为缺省,点完成。[/align]
[align=left]-------------------------------------------------------------------------------------------
帮助(H)
帮助主题(H)
关于画图(A)
--------------------------------------------------------------------------------------------
1.如何实现帮助主题?
在微软画图软件中,点击帮助下的帮助主题,将会弹出一个后缀名为chm的文件,这个文件其实是在window/help/mspaint.chm,因为安装Microsoft公司的操作系统,一般都会自带画图软件,这样自然会自带mspaint.chm文件,这个文件要自己编写也可以,但是有现成的,我们只需要直接调用就行了。
帮助主题,其ID键名为“IDH_THEMEHELP” 在建立类向导中,在CDrawView下建立common函数--OnThemehelp() 。[/align]
[align=left]其代码如下:
void CDrawView::OnThemehelp()
{
// TODO: Add your command handler code here
::WinExec("HH mspaint.chm", SW_SHOW);
}
备注:WinExec()函数介绍(from MSDN)
This function is provided for compatibility with 16-bit Windows. Win32-based applications should use the CreateProcess function. [/align]
[align=left]UINT WinExec(
LPCSTR lpCmdLine, // 调用应用程序地址
UINT uCmdShow // 新应用软件的窗口类型
);[/align]
[align=left] 对nCmdShow特别介绍:
Specifies how the window is to be shown. This parameter is ignored the first time an application calls ShowWindow, if the program that launched the application provides aSTARTUPINFO structure. Otherwise, the first time ShowWindow is called, the value should be the value obtained by the WinMain function in its nCmdShow parameter. In subsequent calls, this parameter can be one of the following values: [/align]
[align=left]
2.关于画图的实现?[/align]
[align=left] 关于画图,其ID键名为“ID_APP_ABOUT” 在建立类向导中,在CDrawView下建立common函数--[/align]
[align=left]OnAppAbout() 。[/align]
[align=left]void CDrawView::OnAppAbout()
{
// TODO: Add your command handler code here
ShellAbout(this->m_hWnd, "画图", "highness0520@gmail.com",NULL);
}[/align]
未完待续...
[align=left] --Highness[/align]
[align=left] [/align]
[align=left] 挑战微软“画图”软件,对于高手来说,其实并不是什么困难的事。对于刚入门的学习者利用VisualC++编一个跟微软“画图”软件一模一样的工程,有一条路可以走。这条路就是“建立基本框架,功能逐一完善”。我们从画图软件中的菜单栏开始,首先在ResouceView视图里面,选择Menu,IDR_MAINFRAME,使得菜单栏和画图一样。即:[/align]
[align=left]------------------------------------------------------------------------------------------[/align]
[align=left]文件(F)|编辑(E)|查看(V)|图像(I)|帮助(H) [/align]
[align=left]------------------------------------------------------------------------------------------[/align]
[align=left]建立好菜单,同时也明确了我们的任务。我们的主要任务是将菜单栏上每一个选项的功能逐一完善。那么我们的模仿秀基本就完成了。
万事皆从简单事情做起,编写软件更何况不是呢?我们从最简单的功能做起,一个一个将功能实现。[/align]
[align=left]下面以提问的方式介绍。[/align]
[align=left] 打开Visual C++,新建MFC APPWIZARD EXE工程,工程名为“Draw”,在向导的第1步“Step 1 of 6” ,选择单文档,在向导的第4步“Step 4 of 6”,将隐藏工具栏和打印和打印预览选项取消打勾。其它皆为缺省,点完成。[/align]
[align=left]-------------------------------------------------------------------------------------------
帮助(H)
帮助主题(H)
关于画图(A)
--------------------------------------------------------------------------------------------
1.如何实现帮助主题?
在微软画图软件中,点击帮助下的帮助主题,将会弹出一个后缀名为chm的文件,这个文件其实是在window/help/mspaint.chm,因为安装Microsoft公司的操作系统,一般都会自带画图软件,这样自然会自带mspaint.chm文件,这个文件要自己编写也可以,但是有现成的,我们只需要直接调用就行了。
帮助主题,其ID键名为“IDH_THEMEHELP” 在建立类向导中,在CDrawView下建立common函数--OnThemehelp() 。[/align]
[align=left]其代码如下:
void CDrawView::OnThemehelp()
{
// TODO: Add your command handler code here
::WinExec("HH mspaint.chm", SW_SHOW);
}
备注:WinExec()函数介绍(from MSDN)
This function is provided for compatibility with 16-bit Windows. Win32-based applications should use the CreateProcess function. [/align]
[align=left]UINT WinExec(
LPCSTR lpCmdLine, // 调用应用程序地址
UINT uCmdShow // 新应用软件的窗口类型
);[/align]
[align=left] 对nCmdShow特别介绍:
Specifies how the window is to be shown. This parameter is ignored the first time an application calls ShowWindow, if the program that launched the application provides aSTARTUPINFO structure. Otherwise, the first time ShowWindow is called, the value should be the value obtained by the WinMain function in its nCmdShow parameter. In subsequent calls, this parameter can be one of the following values: [/align]
[align=left]Value[/align] | [align=left]Meaning[/align] |
[align=left]SW_FORCEMINIMIZE[/align] | [align=left]Windows NT 5.0 and later: Minimizes a window, even if the thread that owns the window is hung. This flag should only be used when minimizing windows from a different thread.[/align] |
[align=left]SW_HIDE[/align] | [align=left]Hides the window and activates another window.[/align] |
[align=left]SW_MAXIMIZE[/align] | [align=left]Maximizes the specified window.[/align] |
[align=left]SW_MINIMIZE[/align] | [align=left]Minimizes the specified window and activates the next top-level window in the Z order.[/align] |
[align=left]SW_RESTORE[/align] | [align=left]Activates and displays the window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag when restoring a minimized window.[/align] |
[align=left]SW_SHOW[/align] | [align=left]Activates the window and displays it in its current size and position. [/align] |
[align=left]SW_SHOWDEFAULT[/align] | [align=left]Sets the show state based on the SW_ flag specified in the STARTUPINFO structure passed to the CreateProcess function by the program that started the application. [/align] |
[align=left]SW_SHOWMAXIMIZED[/align] | [align=left]Activates the window and displays it as a maximized window.[/align] |
[align=left]SW_SHOWMINIMIZED[/align] | [align=left]Activates the window and displays it as a minimized window.[/align] |
[align=left]SW_SHOWMINNOACTIVE[/align] | [align=left]Displays the window as a minimized window. The active window remains active.[/align] |
[align=left]SW_SHOWNA[/align] | [align=left]Displays the window in its current state. The active window remains active.[/align] |
[align=left]SW_SHOWNOACTIVATE[/align] | [align=left]Displays a window in its most recent size and position. The active window remains active.[/align] |
[align=left]SW_SHOWNORMAL[/align] | [align=left]Activates and displays a window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag when displaying the window for the first time.[/align] |
2.关于画图的实现?[/align]
[align=left] 关于画图,其ID键名为“ID_APP_ABOUT” 在建立类向导中,在CDrawView下建立common函数--[/align]
[align=left]OnAppAbout() 。[/align]
[align=left]void CDrawView::OnAppAbout()
{
// TODO: Add your command handler code here
ShellAbout(this->m_hWnd, "画图", "highness0520@gmail.com",NULL);
}[/align]
未完待续...
相关文章推荐
- 微软发布WindowsMobile管理软件 挑战RIM黑莓领先优势!
- 微软桌面平台遭挑战google推免费软件套餐
- 87岁老奶奶用微软自带画图软件绘画 惊艳了世人
- IBM推免费办公软件 欲挑战微软霸主地位
- 87岁老奶奶用微软自带画图软件绘画 惊艳了世人
- 微软发布WindowsMobile管理软件 挑战RIM黑莓领先优势!
- IBM Symphony云计算办公软件挑战微软Office
- Google推出办公软件套件 低价挑战微软Office
- 微软证实将推软件订阅服务 应对Google挑战
- 微软发布Windwos Live软件套装 挑战谷歌
- 专业函数画图软件Origin
- 如何微软的CRM数据导入软件可以改善你的企业
- 常用的微软软件和下载地址
- 画图及高效的产品设计软件工具
- 推荐:微软出的免费录屏软件Community Clips
- 福建泉州软件企业将与微软“联姻”
- 常用的微软软件和下载地址(绝大多数是免费软件,包括免费操作系统/杀毒软件/屏幕录制软件/编程/设计/共享),必有不止一款你需要
- 微软IE9将改变软件售后未来
- 微软的软件测试方法