win32 应用程序 添加资源

一、资源

1、字符串资源

  LoadString

  LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);

 

二、窗口类

   1、系统类 

    The following table describes the system classes that are available for use by all processes.

ClassDescription
ButtonThe class for a button.
ComboBoxThe class for a combo box.
EditThe class for an edit control.
ListBoxThe class for a list box.
MDIClientThe class for an MDI client window.
ScrollBarThe class for a scroll bar.
StaticThe class for a static control.

    The following table describes the system classes that are available only for use by the system. They are listed here for completeness sake.

ClassDescription
ComboLBoxThe class for the list box contained in a combo box.
DDEMLEventThe class for Dynamic Data Exchange Management Library (DDEML) events.
MessageThe class for a message-only window.
#32768The class for a menu.
#32769The class for the desktop window.
#32770The class for a dialog box.
#32771The class for the task switch window.
#32772The class for icon titles.

 

 

  2、全局类

  3、局部类

 

  

转载于:https://www.cnblogs.com/meizixiong/p/4200538.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
以下是在VC2010中编写Win32窗口应用程序的基本步骤: 1. 打开VC2010,选择“新建项目”。 2. 在“新建项目”对话框中,选择“Win32控制台应用程序”并命名您的项目。 3. 在“应用程序类型”对话框中,选择“Windows应用程序”并勾选“空项目”选项。 4. 单击“确定”按钮创建项目。 5. 在“解决方案资源管理器”中,右键单击“源文件”文件夹并选择“添加”>“新建项”。 6. 在“添加新项”对话框中,选择“C++文件”并命名您的文件。 7. 在您的源文件中,编写WinMain函数和窗口过程函数。 8. 在您的WinMain函数中,调用CreateWindow函数创建窗口。 9. 在您的窗口过程函数中,处理您需要处理的窗口消息。 10. 在您的窗口过程函数中,处理WM_DESTROY消息并调用PostQuitMessage函数以退出应用程序。 11. 编译并运行您的应用程序。 以下是一个简单的Win32窗口应用程序示例: ```c++ #include <Windows.h> LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { // 注册窗口类 WNDCLASS wc; wc.style = CS_HREDRAW | CS_VREDRAW; wc.lpfnWndProc = WndProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = hInstance; wc.hIcon = LoadIcon(NULL, IDI_APPLICATION); wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); wc.lpszMenuName = NULL; wc.lpszClassName = "MyWindowClass"; RegisterClass(&wc); // 创建窗口 HWND hWnd = CreateWindow("MyWindowClass", "Win32 Window Application", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 640, 480, NULL, NULL, hInstance, NULL); // 显示窗口 ShowWindow(hWnd, nCmdShow); UpdateWindow(hWnd); // 消息循环 MSG msg; while (GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); } return (int)msg.wParam; } LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_PAINT: { PAINTSTRUCT ps; HDC hdc = BeginPaint(hWnd, &ps); TextOut(hdc, 10, 10, "Hello, Win32 Window Application!", strlen("Hello, Win32 Window Application!")); EndPaint(hWnd, &ps); break; } case WM_DESTROY: { PostQuitMessage(0); break; } default: return DefWindowProc(hWnd, message, wParam, lParam); } return 0; } ``` 这个示例创建一个简单的窗口,并在窗口中绘制一些文本。请注意,这只是一个简单的示例,您可以根据您的需要进行更改和扩展。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值