Tällä koodilla kun tekee ikkunan ja siihen ComboBox:in, niin se ComboBox ei aukea ainakaan itselläni kun käännän koodin Visual c++ 6:lla:
#include <windows.h> HWND hComboLoota; LRESULT CALLBACK ViestienKasittelija(HWND hWnd, UINT Viesti, WPARAM wParam, LPARAM lParam); HRESULT LuoIkkuna(HINSTANCE hInstance, INT nCmdShow); INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPreviousInstance, LPSTR lpCmdLine, INT nCmdShow) { LuoIkkuna(hInstance, nCmdShow); MSG viesti; while(viesti.message != WM_QUIT){ if(PeekMessage(&viesti, NULL, 0U, 0U, PM_REMOVE)) { TranslateMessage(&viesti); DispatchMessage(&viesti); } else { } } UnregisterClass("IkkunaLuokanNimi", hInstance); return 0; } HRESULT LuoIkkuna(HINSTANCE hInstance, INT nCmdShow) { HWND hWnd; WNDCLASS wc; wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC; wc.lpfnWndProc = ViestienKasittelija; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = hInstance; wc.hIcon = LoadIcon((HINSTANCE) NULL,IDI_APPLICATION); wc.hCursor = LoadCursor((HINSTANCE) NULL,IDC_ARROW); wc.hbrBackground = (HBRUSH)GetStockObject(LTGRAY_BRUSH); wc.lpszMenuName = NULL; wc.lpszClassName = "IkkunaLuokanNimi"; if (!RegisterClass(&wc)) return FALSE; hWnd = CreateWindow("IkkunaLuokanNimi", "Ikkunan Otsikko", WS_OVERLAPPED | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX, 100, 100, 300, 200, (HWND) NULL, (HMENU) NULL, hInstance, (LPVOID) NULL); if(!hWnd) return FALSE; ShowWindow(hWnd, nCmdShow); UpdateWindow(hWnd); return S_OK; } LRESULT CALLBACK ViestienKasittelija(HWND hWnd, UINT Viesti, WPARAM wParam, LPARAM lParam) { switch(Viesti) { case WM_CREATE: { hComboLoota = CreateWindow("COMBOBOX", "listalaatikko", WS_CHILD | WS_VISIBLE | CBS_DROPDOWNLIST | CBS_HASSTRINGS | CBS_SORT, 10, 10, 100, 20, hWnd, (HMENU) 101, (HINSTANCE) GetWindowLong (hWnd, GWL_HINSTANCE), (LPVOID) NULL); SendMessage (hComboLoota, CB_ADDSTRING, 0, (LPARAM) (LPCTSTR) "Valinta 1"); SendMessage (hComboLoota, CB_ADDSTRING, 0, (LPARAM) (LPCTSTR) "Valinta 2"); SendMessage (hComboLoota, CB_ADDSTRING, 0, (LPARAM) (LPCTSTR) "Valinta 3"); SendMessage (hComboLoota, CB_ADDSTRING, 0, (LPARAM) (LPCTSTR) "Valinta 4"); SendMessage (hComboLoota, CB_ADDSTRING, 0, (LPARAM) (LPCTSTR) "Valinta 5"); SendMessage (hComboLoota, CB_ADDSTRING, 0, (LPARAM) (LPCTSTR) "Valinta 6"); SendMessage (hComboLoota, CB_ADDSTRING, 0, (LPARAM) (LPCTSTR) "Valinta 7"); SendMessage (hComboLoota, CB_SETCURSEL, (WPARAM) 0, 0); } break; case WM_COMMAND: { } break; case WM_DESTROY: { PostQuitMessage(0); return TRUE; } break; default:break; } return DefWindowProc(hWnd, Viesti, wParam, lParam); }
Vika on CreateWindowin nHeight-parametrissa jonka olet asettanut aivan liian pieneksi, kokeile vaikkapa arvoa 100.
Aihe on jo aika vanha, joten et voi enää vastata siihen.