用 C 实现选项卡式 Windows 对话框窗口

发布于 2024-09-26 16:37:24 字数 638 浏览 2 评论 0原文

背景:
我继承了一个项目,大约 10k loc 实现了 odbc 驱动程序。要配置驱动程序,将打开一个配置窗口。配置窗口由 .rc 文件(资源脚本)定义,该文件使用 x,y 坐标定义所有按钮和复选框。

到目前为止,当添加新功能时,我只是复制/粘贴另一个按钮/复选框来更改变量名称和 ID 代码,效果非常好。最近,该面板变得过于单一,因此决定对配置面板进行彻底检修。新设计将选项分隔到选项卡中,而不是将它们全部放在一页上。

问题:
我需要弄清楚如何实现带有选项卡的 Windows 对话框窗口。我用谷歌搜索了一下,试图找到例子,但没有运气试图弄清楚这一点。我可以在 Visual Studio 中打开 .rc 文件(该项目最初不是在 Visual Studio 中开发的),它向我展示了配置面板的良好视觉表示,我可以拖动元素,并且它很好地修改了 .rc 文件。我不知道如何让选项卡正常工作。我可以创建一个选项卡控件,但我不能用它做任何事情。我不知道如何将其他对象放在选项卡控件的不同选项卡上。

我理想地寻找的是一个在 C 中实现此功能的极其简洁的示例(一个对话框窗口,至少有两个选项卡,每个选项卡上至少有一个东西)。从那时起,我可以抽象其余部分。如果找不到关于如何实现选项卡式对话框的综合教程的指针可能是下一个最好的选择。我找到了 C# 教程,但驱动程序的其余部分(与配置面板交互)是用 C 编写的。

Background:
I’ve inherited a project, about 10k loc implementing an odbc driver. To configure the driver a configuration window is opened. The configuration window is defined by an .rc file (a resource script) which defines all the buttons and checkboxes using x,y coordinates.

Up until now when adding a new feature I just copy/pasted another button/checkbox changing the variable names and ID codes, this worked pretty well. As of late the panel has gotten too monolithic, and it has been decided that the configuration panel should be overhauled. The new design will segregate options into tabs, instead of having them all on one page.

Problem:
I need to figure out how to implement a Windows dialog window with tabs. I have googled around, tried to find examples, and had no luck trying to figure this out. I can open the .rc file in visual studio (the project was NOT originally developed in visual studio) and it shows me a nice visual representation of the config panel, I can drag the elements around, and it modifies the .rc file nicely. What I can’t figure out how to do is get tabs to work. I can create a tab control, but I can’t do anything with it. I can’t figure out how to put other objects on the different tabs of the tab control.

What I am ideally looking for is an extremely terse example implementing this (a dialog window with at least two tabs and at least one thing on each tab) in C. From that point I can abstract the rest. If that can’t be found a pointer to a comprehensive tutorial on how to implement a tabbed dialog box would probably be the next best thing. I’ve found tutorials in C#, but the rest of the driver, which interfaces with the configuration panel, is written in C.

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

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

发布评论

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

评论(2

离旧人 2024-10-03 16:37:24

在这里找到答案: http://msdn.microsoft .com/en-us/library/bb760551(v=vs.85).aspx 但示例需要一些黑客才能使其工作。

Answer was found here: http://msdn.microsoft.com/en-us/library/bb760551(v=vs.85).aspx but examples needed some hacking to get them to work.

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