1

I am new to C++ programming, Basically i am VB.net programmer.. i need to put combo Box in my C++ dynamic library. my C++ dynamic library will call my VB.Net function. i want to show combo box popup on C++ dynamic library load and select item.

I have goggled and tried following code from MSDN Reference

    // 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);

But i am getting following errors:

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

Your help will be really appreciable.

Thanks in Advance!

Tithi Patel
  • 777
  • 4
  • 21
  • possible duplicate of [What is an 'undeclared identifier' error and how do I fix it?](http://stackoverflow.com/questions/22197030/what-is-an-undeclared-identifier-error-and-how-do-i-fix-it) – sashoalm Mar 05 '14 at 15:31

1 Answers1

1

Looking at the complete example on the page linked, we see that the snippet you've copied and pasted is part of a larger class. This class includes things like the m_hwnd member variable. The complete example also includes the macro definition for HINST_THISCOMPONENT.

If the terms I'm using ("class", "member variable", "macro") don't make sense to you, I recommend that you take a look at The Definitive C++ Book Guide and List. It's a list of very good books for learning C++ collected by the C++ gurus here on StackOverflow.

For Win32 GUI programming, I'd recommend Charles Petzold's Programming Windows, Fifth Edition.

Attempting to learn C++ or Win32 GUI programming one StackOverflow question at a time is going to be painful.

Community
  • 1
  • 1
chwarr
  • 6,777
  • 1
  • 30
  • 57
  • _Attempting to learn C++ or Win32 GUI programming one StackOverflow question at a time is going to be painful._ +1 for accuracy. – cf- Feb 22 '14 at 10:53