Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8335553
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T03:42:38+00:00 2026-06-09T03:42:38+00:00

I have a CDialog ( myDialogBox ) that has a CComboBox member ( myComboBox

  • 0

I have a CDialog (myDialogBox) that has a CComboBox member (myComboBox). My goal is to get the user-typed text (preferably as a CString) from the edit portion of a dropdown style CComboBox. But, I cannot seem to get it to work.

I’ve tried using myComboBox.GetWindowText(myString). But whenever I run it in debug mode, my code breaks at ASSERT(::IsWindow(m_hWnd)) within the CWnd::GetWindowText() function.

I’ve also tried myDialogBox.GetDlgItemText(MY_COMBOBOX_ID, myString), which breaks down in a similar way.

Additionally, I’ve tried:

    COMBOBOXINFO info;
    memset(&info,0,sizeof(info));
    myComboBox.GetComboBoxInfo(&info);
    LPTSTR str = new TCHAR[::GetWindowTextLength(info.hwndItem)];
    ::GetWindowText(info.hwndItem,str,::GetWindowTextLength(info.hwndItem));

But, it doesn’t seem to be populating my info variable correctly.

Could someone point me in the right direction, please? What am I doing wrong? Any suggestions?

EDIT: Just in case it might help understand my ultimate goal, I am trying to have a combo-box where that can help a user pic and choose from a listing of strings. Nonetheless, if he/she does not want any on the dropdown-list, he can come up with his own string. I’d like a way to receive his user-typed string.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T03:42:39+00:00Added an answer on June 9, 2026 at 3:42 am

    You need to call GetWindowText before the dialog is destroyed. A good place to do that would be in the DoDataExchange member function of the dialog.

    Edit: You can also get an error if the CComboBox object hasn’t been attached to the actual window. This also typically occurs in DoDataExchange.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im trying to get a CDialog that has no border or frame to show
I have a control derived from a CWnd object that has its custom implemented
Imagine I have a CDialog which creates controls dynamically when the user clicks a
I have an MFC application that creates a CDialog. I'd like this CDialog to
I have a popup dialog( CDialog ) that handles WM_CTLCOLOR message to color itself.
I am using VS c++ 6.0. I have read that 6.0 has some problems
I have a CDialog that is calling DoModal(), the dialog is opened, everything else
Basically I have a program that has 6 sliders that send a value through
I have an MFC CDialog with an IWebBrowser2 in it. I get to a
I have a modal dialog that I would like to implement a right mouse

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.