C++窗体程序初步 - 附件
共 2708字,需浏览 6分钟
·
2023-06-25 09:28
开发记录(.md文件)请在公众号后台回复: 窗体初步
官方入门文档: Create a traditional Windows Desktop application (C++) :
https://docs.microsoft.com/en-us/cpp/windows/walkthrough-creating-windows-desktop-applications-cpp#:~:text=From the main menu%2C choose,Desktop Wizard then choose Next.
Microsoft Visual Studio :
https://visualstudio.microsoft.com/
关于是否需要使用`<tchar.h>`模块,具体请看 官方文档:
https://docs.microsoft.com/en-us/cpp/windows/walkthrough-creating-windows-desktop-applications-cpp?view=msvc-170#:~:text=Windows%20desktop%20programs%20require%20%3Cwindows.h%3E.%20%3Ctchar.h%3E%20defines%20the%20TCHAR%20macro%2C%20which%20resolves%20ultimately%20to%20wchar_t%20if%20the%20UNICODE%20symbol%20is%20defined%20in%20your%20project%2C%20otherwise%20it%20resolves%20to%20char.%20If%20you%20always%20build%20with%20UNICODE%20enabled%2C%20you%20don%27t%20need%20TCHAR%20and%20can%20just%20use%20wchar_t%20directly
其他系统图标参见 官方文档 :
https://docs.microsoft.com/zh-cn/windows/win32/api/winuser/nf-winuser-loadicona?redirectedfrom=MSDN&f1url=%3FappId%3DDev16IDEF1&l=ZH-CN&k=k(WINUSER%252FLoadIcon)%3Bk(LoadIcon)%3Bk(DevLang-C%252B%252B)%3Bk(TargetOS-Windows)&rd=true
当光标进入程序窗口后鼠标的样式可参照 官方文档 :
https://docs.microsoft.com/zh-cn/windows/win32/api/winuser/nf-winuser-loadcursora?redirectedfrom=MSDN&f1url=%3FappId%3DDev16IDEF1&l=ZH-CN&k=k(WINUSER%252FLoadCursor)%3Bk(LoadCursor)%3Bk(DevLang-C%252B%252B)%3Bk(TargetOS-Windows)&rd=true
背景样式及颜色也可以更改,参考 官方文档 :
https://docs.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-wndclassexw#:~:text=the%20application%27s%20window.-,hbrBackground,fErase%20member%20of%20the%20PAINTSTRUCT%20structure%20filled%20by%20the%20BeginPaint%20function.,-lpszMenuName
窗体句柄函数功能 官方文档 :
https://docs.microsoft.com/en-us/cpp/windows/walkthrough-creating-windows-desktop-applications-cpp?view=msvc-170#:~:text=Now%20you%20can%20create%20a%20window.%20Use%20the%20CreateWindowEx%20function
窗体显示 官方文档 :
https://docs.microsoft.com/en-us/cpp/windows/walkthrough-creating-windows-desktop-applications-cpp?view=msvc-170#:~:text=At%20this%20point%2C%20the%20window%20has%20been%20created%2C%20but%20we%20still%20need%20to%20tell%20Windows%20to%20make%20it%20visible.%20That%27s%20what%20this%20code%20does%3A
更多有关Message的知识,参见 官方文档 :
https://docs.microsoft.com/en-us/cpp/windows/walkthrough-creating-windows-desktop-applications-cpp?view=msvc-170#:~:text=For%20more%20information%20about%20the%20structures%20and%20functions%20in%20the%20message%20loop%2C%20see%20MSG%2C%20GetMessage%2C%20TranslateMessage%2C%20and%20DispatchMessage