Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Output to dlg list box

This topic is 5533 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am trying to get output to a list box in my dialog working. Here is an example of the function I am using. SendMessage(GetDlgItem( hChildHandle, IDC_SESSIONS ),LB_ADDSTRING,0,(LPARAM)szText); hChildHandle is equal to my main window handle do I need a seperate handle for my dialog, if so how do I get it. Little confused about handles.

Share this post

Link to post
Share on other sites
You usually get the handle of the dialog box when it fulfills its duties. Example:

HWND status_dlg //Handle of the dialog box


status_dlg = CreateDialog(GetModuleHandle(NULL),MAKEINTRESOURCE(IDD_INFO_BOX),hwnd,Status_Dialog);
MessageBox(hwnd,"Satus Dialog Box cannot be created","ERROR",MB_OK);

When sending a message to the dialog box it seems, in what I've always accepted, you use the parent's handle. I'm not sure why but it seems to work for me.
Although my dialog box's handle is named spell_dlg, my parent windows handle, hwnd, will work.

for(loop=0; loop < 30; loop++)
if(spell[loop] != 4)
int increment=loop+1;
SendDlgItemMessage(hwnd, IDC_LEARN_LIST, LB_ADDSTRING, 0, (LPARAM)spell_char2);

Someone will have to clearify why the parent's handle works rather than the dialog's that the list is in.

Edit: Handle: A variable that identifies an object; an indirect reference to an operating system resource.

[edited by - Xiachunyi on October 21, 2003 9:44:16 PM]

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!