Original Post
Hi there, I''m having a problem that is rather frustrating because its seems like the solution should be so easy, but it isn''t working. First off, I''m writing this all with the WIN32 API, so no MFC. Basically I have a dialog box that contains a combo box along with several other controls. When the dialog box
opens, I''m using the WM_INITDIALOG msg to do my setup. I adjust some properties for spin controls etc. all that works fine. The part that doesn''t work is loading items into the combo box. The following code is what I''m using to load an item into the combo box:
SendDlgItemMessage(hwnd, IDC_LAYER_COMBO, CB_ADDSTRING, 0, (LPARAM)"TILES");
I don''t get any errors, but it doesn''t work. I''ve also tried using GetDlgItem to retrieve the window handle of the control then using that in SendMessage, but I haven''t had any luck with that either. I''m really baffeled because it really shouldn''t be too difficult, and all the examples I''ve looked at do it exactly the same way. The rest of my dialog box msg handler is included at the end of this message just in case.
thanks in advance for any suggestions
-Josh de Bever
LRESULT CALLBACK Res_Gen_Proc(HWND hwnd,
UINT msg,
WPARAM wparam,
LPARAM lparam)
{
// what is the message
switch(msg)
{
case WM_INITDIALOG:
{
//Initialize Spin Controls
SendDlgItemMessage(hwnd,IDC_HP_SPIN, UDM_SETRANGE32,0,300);
SendDlgItemMessage(hwnd,IDC_ARMOR_SPIN,UDM_SETRANGE32,0,100);
SendDlgItemMessage(hwnd,IDC_SPEED_SPIN,UDM_SETRANGE32,0,50);
//Initalize Combo Box {DOESN''T WORK!!! HELP!!!!!!!}//
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
SendDlgItemMessage(hwnd, IDC_LAYER_COMBO, CB_INSERTSTRING, 0,
(LPARAM)"TILES");
return(1);
}break;
case WM_COMMAND:
switch(LOWORD(wparam))
{
case IDC_DISP_FRAME_BUTTON:
DialogBox(main_instance, MAKEINTRESOURCE(IDD_GRFX_VIEWER), hwnd,(DLGPROC)Grfx_Viewer_Proc);
return(1);
} break;
case WM_CLOSE:
{
DestroyWindow(hwnd);
Gen_Wnd = NULL;
return(1);
}break;
default:break;
}
// end switch
// process any messages that we didn''t take care of
return(0);
} // end Res_Gen_Proc