如何将组合框放入我的C++动态库中

How to put Combo Box in my C++ dynamic library?

本文关键字:C++ 我的 动态 组合      更新时间:2023-10-16

我是C++编程新手,基本上我是 VB.net 程序员。 我需要将组合盒放在我的C++动态库中。 我的C++动态库将调用我的 VB.Net 函数。 我想在动态库加载并选择项目时显示组合框弹出窗口C++。

我已经戴上了护目镜并尝试遵循MSDN参考中的代码

    // Create the Combobox
//
// Uses the CreateWindow function to create a child window of 
// the application window. The WC_COMBOBOX window style specifies  
// that it is a combobox.
 int xpos = 100;            // Horizontal position of the window.
 int ypos = 100;            // Vertical position of the window.
 int nwidth = 200;          // Width of the window
 int nheight = 200;         // Height of the window
 HWND hwndParent =  m_hwnd; // Handle to the parent window
 HWND hWndComboBox = CreateWindow(WC_COMBOBOX, TEXT(""), 
     CBS_DROPDOWN | CBS_HASSTRINGS | WS_CHILD | WS_OVERLAPPED | WS_VISIBLE,
     xpos, ypos, nwidth, nheight, hwndParent, NULL, HINST_THISCOMPONENT,
     NULL);

但是我收到以下错误:

error C2065: 'm_hwnd' : undeclared identifier
error C2065: 'HINST_THISCOMPONENT' : undeclared identifier

您的帮助将非常可观。

提前感谢!

查看链接页面上的完整示例,我们发现您复制和粘贴的代码段是较大类的一部分。此类包括 m_hwnd 成员变量之类的内容。完整的示例还包括 HINST_THISCOMPONENT 的宏定义。

如果我使用的术语("类","成员变量","宏")对您没有意义,我建议您查看The Definitive C++ Book Guide and List。这是C++大师在StackOverflow上收集的非常好的学习C++书籍列表。

对于Win32 GUI编程,我推荐Charles Petzold的Programming Windows,第五版。

尝试一次学习一个C++或Win32 GUI编程一个StackOverflow问题将是痛苦的。