Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Problems w/ combo boxes in Dialog windows

Posted on 1997-04-09
2
Medium Priority
?
435 Views
Last Modified: 2013-12-03
Ok, I have a dialog box, and I have a combo box within the dialog box.  I am trying to add items to the combo box, but the program refuses to do it.  Here are snippits of the dialog box definition in the rc script, and various relevant C code segments. . .

Here is from the rc file. . .

SETUPDIALOG DIALOG DISCARDABLE  20, 20, 186, 106
STYLE DS_SYSMODAL | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION |
    WS_SYSMENU
CAPTION "Setup"
FONT 8, "MS Sans Serif"
BEGIN
    DEFPUSHBUTTON   "OK",IDOK,19,85,50,14
    PUSHBUTTON      "Cancel",IDCANCEL,103,85,50,14
    LTEXT           "Generation Type:",IDC_STATIC,7,17,56,8
    LTEXT           "Generation Description:",IDC_STATIC,7,33,75,8
    EDITTEXT        IDC_EDIT1,7,44,172,35,ES_AUTOHSCROLL | ES_READONLY
    COMBOBOX        IDSETUP_COMBO,68,16,89,12,CBS_DROPDOWNLIST | WS_VSCROLL |
                    WS_TABSTOP
END


Here is the case from the oncommand function that creates the dialog box if someone calls setup. . .

case CM_SETUP:
            {
            FARPROC SetupProg =
                  MakeProcInstance((FARPROC)SetupPrgDlgProc, hInstance);
            DialogBox(hInstance,"SETUPDIALOG", MainWindow, (DLGPROC)SetupProg);
            FreeProcInstance(SetupProg);
            InvalidateRect(hwnd, NULL, TRUE);
            break;
            }


Here is the dialog callback function. . . (I also tried to send a message to a dialog item too)

/////////////////////////////////////
// Setup Dialog
////////////////////////////////////

#pragma argsused
BOOL CALLBACK SetupPrgDlgProc(HWND hDlg, UINT Message,
                                                WPARAM wParam, LPARAM lParam)
{
      char S[50];

      strcpy(S,"Method 1");
      switch(Message)
      {
      case WM_INITDIALOG:
            {
                  strcpy(com,"Init dialog called");
                  ComboBox_AddString(GetDlgItem(hDlg,IDSETUP_COMBO), S);
                  return TRUE;
            }
      case WM_COMMAND:
            if (LOWORD(wParam) == IDOK ||
                  LOWORD(wParam) == IDCANCEL)
            {
                  EndDialog(hDlg, LOWORD(wParam));
                  return TRUE;
            }
            break;
      }

      return FALSE;
}


I really want to be able to add multiple string options to this combo box for someone to select for the setup function, but it just doesn't want to add the strings.  If someone else has run into this - or sees what I am doing wrong - any and all help would be most appreciated.
0
Comment
Question by:navigator010897
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 23

Accepted Solution

by:
chensu earned 300 total points
ID: 1334500
You C code is OK. When you created the combobox with AppStudio (or other Resource Editor), did you clicked on the down arrow of the combobox? Click on it, then you can set the drop down size. By default, it is the same size as the edit box. In fact, you did add a string to it but you could not see it. Or you can modify your RC file directly.

COMBOBOX IDSETUP_COMBO,68,16,89,62,CBS_DROPDOWNLIST |
                     WS_VSCROLL |
                         WS_TABSTOP

0
 

Expert Comment

by:Thuy
ID: 4992903
I got the same problem, too. None of CB_ADDSTRING or CB_INSERTSTRING, SendMessage or SendDlgItemMessage works.
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows a few slightly more advanced techniques for Windows 7 gadget programming, including how to save and restore user settings for your gadget and how to populate the "details" panel that is displayed in the Windows 7 gadget gallery.  …
After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

597 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question