使用 CreateWindow 并向其添加按钮等?如何?

发布于 2024-08-11 16:02:22 字数 265 浏览 2 评论 0 原文

我意识到,经过这么长时间的 DirectX/OpenGL 应用程序编码,我对如何使用文本框、标签、命令按钮等基本表单对象创建窗口一无所知。

我可以使用 CreateWindow功能很好,怎么样我可以向其中添加按钮、命令提示符和其他表单对象吗?

I have realised after so long of coding DirectX/OpenGL applications I don't have the faintest of ideas how to create windows with basic form objects like text boxes, labels, command buttons etc.

I can create a window using the CreateWindow function just fine, how can I add buttons, command prompts and other form objects to it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

池予 2024-08-18 16:02:22

请参阅创建窗口帮助。创建主窗口后,您可以通过向函数提供父 HWND 来创建子窗口。对于标准控件,您可以使用在按钮上定义的类名之一,例如编辑框的 EDIT 和按钮的 BUTTON。

举个例子:

CreateWindow(L"BUTTON", L"Button", BS_TEXT | WS_CHILD | WS_VISIBLE, 40, 40, 100, 40, hMainWnd, (HMENU)ID_MYBUTTON, hInstance, NULL);

或者您可以只创建一个对话框,然后使用 Visual Studio 的资源编辑器对其进行编辑(如果您有完整的 VS)。

Look at Create Window Help. Once you create your main window you can create child windows by providing the parent HWND to the function. For standard controls you use one of the class names defined at the button, like EDIT for an edit box and BUTTON for a button.

As an example:

CreateWindow(L"BUTTON", L"Button", BS_TEXT | WS_CHILD | WS_VISIBLE, 40, 40, 100, 40, hMainWnd, (HMENU)ID_MYBUTTON, hInstance, NULL);

Or you could just create a dialog box instead and edit it with Visual Studio's resource editor (if you have full VS that is).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文