任何人都可以告诉我如何在没有资源和没有MFC的情况下使用DropDownList(如带有DropDownStyle = DropDownList的C#ComboBox控件)创建ComboBox吗?我用Google搜索了大约20分钟,但我找到的所有代码示例都为我创建了奇怪的控件(例如,一个带有复选框的普通区域无法检查......)。我的代码如下所示:
WNDCLASSEX wcex;
HWND hwnd;
HWND button;
HDC hDC;
HGLRC hRC;
MSG msg;
BOOL bQuit = FALSE;
float theta = 0.0f;
/* register window class */
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style = CS_OWNDC;
wcex.lpfnWndProc = WindowProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = hInstance;
wcex.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
wcex.lpszMenuName = NULL;
wcex.lpszClassName = "GLSample";
wcex.hIconSm = LoadIcon(NULL, IDI_APPLICATION);;
if (!RegisterClassEx(&wcex))
return 0;
/* create main window */
hwnd = CreateWindowEx(0,
"GLSample",
"OpenGL Sample",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
256,
256,
NULL,
NULL,
hInstance,
NULL);
ShowWindow(hwnd, nCmdShow);
button = CreateWindow("GLSample", "knopf", WS_CHILD | WS_VISIBLE, 200, 200, 150, 60, hwnd, NULL, hInstance, NULL);
答案 0 :(得分:2)
您必须再次致电CreateWindow()
,指定lpClassName = combobox
和dwStyle = CBS_DROPDOWNLIST
您可以使用messages