Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I suspect that when you tried to put it in <code>WM_INITDIALOG</code>, you made the common mistake of not putting braces around the block:</p> <pre><code>INT_PTR CALLBACK MyTabDialogOne(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) { // Switches the message for tab 1 control switch (uMsg) { case WM_INITDIALOG: { HWND hwndComboTab = GetDlgItem(hwndDlg, IDC_COMBO1); ComboBox_AddString(hwndComboTab, "Option 1"); ComboBox_AddString(hwndComboTab, "Option 2"); ComboBox_AddString(hwndComboTab, "Option 3"); break; } case WM_COMMAND: { switch (LOWORD(wParam)) // No point here as this is after a button is clicked { case IDC_GET_CODE: // Handles the GET Code button in tab { // Displays the result to main window HWND hwndEdit2 = GetDlgItem(GetParent(GetParent(hwndDlg)), IDC_OUTPUT); HWND hwndStatic1 = GetDlgItem(GetParent(GetParent(hwndDlg)), IDC_STATIC1); SetWindowText(hwndEdit2,buffer); // Displays the result to bottom bar Static_SetText(hwndStatic1, "Completed"); //MessageBox(hwndDlg,TEXT("Selected"),TEXT("Button"),0); break; } default: return FALSE; } break; } default: return FALSE; } return TRUE; } </code></pre> <p>Not adding the braces causes the declaration of <code>hwndComboTab</code> to be skipped. I've also sorted out your return statements. If you handled a message, you should return <code>TRUE</code>, else <code>FALSE</code>. This is with exception to a few messages as documented <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms645469%28v=vs.85%29.aspx" rel="nofollow">here</a>.</p> <p>One last thing I did was to move your declarations to the start of each scope. I assume your file is <code>.cpp</code> even though you appear to be coding C. If your extension was <code>.c</code>, VC++ would treat the file as a C source and the way you are doing your declarations would not even compile.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload