资源简介
Q760642.zip windows程序设计 编写Windows窗口应用程序实现对话框与菜单的应用 https://ask.csdn.net/questions/760642 编写Windows窗口应用程序实现对话框与菜单的应用
1)编程实现如下应用程序,含有菜单,单击“新建”时弹出新建对话框(非模态对话框),单击对话框颜色按钮后应用程序窗口字体和背景色发生相应的变化。单击“关于”菜单项时弹出关于对话框(模态对话框)。
(Winodws对话框、Windows菜单)
代码片段和文件信息
// Q760642.cpp : Defines the entry point for the application.
//
#include “stdafx.h“
#include “commdlg.h“
#include “Q760642.h“
#define MAX_LOADSTRING 100
LRESULT CALLBACK NewWndProc(HWND hWnd UINT message WPARAM wParam LPARAM lParam);
// Global Variables:
HINSTANCE hInst; // current instance
TCHAR sztitle[MAX_LOADSTRING]; // The title bar text
TCHAR szWindowClass[MAX_LOADSTRING]; // the main window class name
HWND hWnd;
HWND newdlghWnd;
HBRUSH hmainBrush = NULL;
// Forward declarations of functions included in this code module:
ATOM MyRegisterClass(HINSTANCE hInstance);
BOOL InitInstance(HINSTANCE int);
LRESULT CALLBACK WndProc(HWND UINT WPARAM LPARAM);
INT_PTR CALLBACK About(HWND UINT WPARAM LPARAM);
int APIENTRY _tWinMain(HINSTANCE hInstance
HINSTANCE hPrevInstance
LPTSTR lpCmdLine
int nCmdShow)
{
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine);
// TODO: Place code here.
MSG msg;
HACCEL hAccelTable;
// Initialize global strings
LoadString(hInstance IDS_APP_title sztitle MAX_LOADSTRING);
LoadString(hInstance IDC_Q760642 szWindowClass MAX_LOADSTRING);
MyRegisterClass(hInstance);
// Perform application initialization:
if (!InitInstance (hInstance nCmdShow))
{
return FALSE;
}
hAccelTable = LoadAccelerators(hInstance MAKEINTRESOURCE(IDC_Q760642));
// Main message loop:
while (GetMessage(&msg NULL 0 0))
{
if (!TranslateAccelerator(msg.hwnd hAccelTable &msg))
{
if (!IsDialogMessage(newdlghWnd &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
}
return (int) msg.wParam;
}
//
// FUNCTION: MyRegisterClass()
//
// PURPOSE: Registers the window class.
//
// COMMENTS:
//
// This function and its usage are only necessary if you want this code
// to be compatible with Win32 systems prior to the ‘RegisterClassEx‘
// function that was added to Windows 95. It is important to call this function
// so that the application will get ‘well formed‘ small icons associated
// with it.
//
ATOM MyRegisterClass(HINSTANCE hInstance)
{
WNDCLASSEX wcex;
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = WndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = hInstance;
wcex.hIcon = LoadIcon(hInstance MAKEINTRESOURCE(IDI_Q760642));
wcex.hCursor = LoadCursor(NULL IDC_ARROW);
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wcex.lpszMenuName = MAKEINTRESOURCE(IDC_Q760642);
wcex.lpszClassName = szWindowClass;
wcex.hIconSm = LoadIcon(wcex.hInstance MAKEINTRESOURCE(IDI_SMALL));
return RegisterClassEx(&wcex);
}
//
// FUNCTION: InitInstance(HINSTANCE int)
//
// PURPOSE: Saves instance handle and creates main window
//
// COMMENTS:
//
// In this function we
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2019-05-10 01:41 Q760642\Debug\
文件 91648 2019-05-10 01:38 Q760642\Debug\Q760642.exe
文件 888 2019-05-10 00:18 Q760642\Q760642.sln
文件 12288 2019-05-10 01:41 Q760642\Q760642.suo
目录 0 2019-05-10 01:05 Q760642\Q760642\
目录 0 2019-05-10 01:42 Q760642\Q760642\Debug\
文件 52452 2019-05-10 01:05 Q760642\Q760642\Q760642.APS
文件 6923 2019-05-10 01:38 Q760642\Q760642\Q760642.cpp
文件 39 2019-05-10 00:18 Q760642\Q760642\Q760642.h
文件 23558 2009-08-31 02:31 Q760642\Q760642\Q760642.ico
文件 8774 2019-05-10 01:04 Q760642\Q760642\Q760642.rc
文件 4592 2019-05-10 00:18 Q760642\Q760642\Q760642.vcxproj
文件 1824 2019-05-10 00:18 Q760642\Q760642\Q760642.vcxproj.filters
文件 143 2019-05-10 00:18 Q760642\Q760642\Q760642.vcxproj.user
文件 2578 2019-05-10 00:18 Q760642\Q760642\ReadMe.txt
文件 2252 2019-05-10 01:04 Q760642\Q760642\resource.h
文件 23558 2009-08-31 02:31 Q760642\Q760642\small.ico
文件 294 2019-05-10 00:18 Q760642\Q760642\stdafx.cpp
文件 529 2019-05-10 00:18 Q760642\Q760642\stdafx.h
文件 314 2019-05-10 00:18 Q760642\Q760642\targetver.h
- 上一篇:指纹识别的代码
- 下一篇:2个8位PWM实现16位DAC
相关资源
- setuptools-0.6c11.win32-py2.7.exe
- 汇编课设——一个win32计算器功能完整
- 基于win32的象棋游戏
- win32 扫雷游戏
- Win32API编程入门
- Win32标准输出重定向VS2015通用实现
- MTTTY (Multi-Threaded TTY)
- 我的拼图游戏WIN32编程
- linux和win32下通用的互斥锁Mutex封装
- Win32汇编的扫雷不完全版本
- Win32 API大全.chm 帮助文档 速查手册
- Win32 Hooks 钩子详细介绍
- WIN32游戏实现
- 纯Win32 API 编写的截图小工具
- Eclipse64位4.5火星版eclipse-jee-mars-2-win
- Open62541 win32 动态库
- Eclipse32位4.5火星版eclipse-jee-mars-2-win
- Eclipse32位4.3.2开普勒版eclipse-jee-keple
- 用win32GDI函数编程推箱子
- 编译jepglib需要的Win32.Mak
- eclipse-jee-mars-2-win32-x86_64火星版本
- libjpeg lib文件
- eclipse-SDK-3.7-win32.zip
- Eclipse64位3.6.2太阳神版eclipse-jee-helio
- cronolog-1.6.1-win32日志分割工具
- Win32汇编语言实现的扫雷
- 简单win32绘图程序
- 博客-Windows窗体原理及控件WM_DRAWITEM和
- connect-1.104-win32-msvc.zip
- 用win32API编的飞机游戏
评论
共有 条评论