|
-
Apr 17th, 2001, 09:41 PM
#1
Thread Starter
Frenzied Member
Hi,
I'm learning how to use the windows common controls in VC++.
I'm starting with the ComboBoxEx control.
The main window work fine and I just put in the code to create the combo box from MSDN. However, I'm getting the following error when compiling:
error C2664: 'CreateWindowExA' : cannot convert parameter 9 from 'void *' to 'struct HWND__ *'
Conversion from 'void*' to pointer to non-'void' requires an explicit cast
Parameter 9 is the handle to the main window. I declared a global variable as: HANDLE ghWndMain and after I call the ShowWindow function, I set the variable as: ghWndMain = hWnd which should set it to the Main window's handle, right?
But for some reason, the CreateWindowEx function inside the ComboBoxEx function doesn't like that handle. Here is the code for the ComboBox:
Code:
HWND WINAPI CreateComboEx(void)
{
HWND hWnd;
INITCOMMONCONTROLSEX icex;
icex.dwSize = sizeof(INITCOMMONCONTROLSEX);
icex.dwICC = ICC_USEREX_CLASSES;
InitCommonControlsEx(&icex);
hWnd = CreateWindowEx(0,WC_COMBOBOXEX,NULL,
WS_BORDER|WS_VISIBLE|WS_CHILD|CBS_DROPDOWN,
// No size yet -- resize after setting image list
0, // Vertical position of Combobox
0, // Horizontal position of Combobox
0, // Sets the width of Combobox
100, // Sets the height of Combobox
ghWndMain,
NULL,
ghInstance,
NULL);
return(hWnd);
}
Any help would be appreciated..
Dan
-
Apr 18th, 2001, 10:16 AM
#2
Frenzied Member
You can't use a HANDLE in that function. You need to use a HWND. So change:
HANDLE ghWndMain; to
HWND ghWndMain;
MSVS 6, .NET & .NET 2003 Pro
I HATE MSDN with .NET & .NET 2003!!!
Check out my sites:
http://www.filthyhands.com
http://www.techno-coding.com

Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|