How to "SendMessage" to a listbox in a dialog class?
-
I am currently writing a program which is ported from C++ for DOS. I have a routine which handles the output messages to the screen in DOS, but now I am trying to output it to a ListBox in a Dialog box. Here a fragment of the code i have written.. #include "stdafx.h" void utility::message() { SendMessage(0,WM_MYCALL,0,0); } WM_MYCALL is a handler I defined in a dialog class. Apparently, when I tried this command, nothing really happen. My program is a SDI program. Somehow, WM_MYCALL is not process at all by the dialog class? Why does this happen? Is there something I missed out?:confused:
-
I am currently writing a program which is ported from C++ for DOS. I have a routine which handles the output messages to the screen in DOS, but now I am trying to output it to a ListBox in a Dialog box. Here a fragment of the code i have written.. #include "stdafx.h" void utility::message() { SendMessage(0,WM_MYCALL,0,0); } WM_MYCALL is a handler I defined in a dialog class. Apparently, when I tried this command, nothing really happen. My program is a SDI program. Somehow, WM_MYCALL is not process at all by the dialog class? Why does this happen? Is there something I missed out?:confused:
You must tell it where to send the message. Somehow I dubt you have a dialog box with a HWND of zero. :-)
-
You must tell it where to send the message. Somehow I dubt you have a dialog box with a HWND of zero. :-)
-
Yup, that's right. But I am not sure how to get the handle for my dialog box. Do you have any suggestion? So right now I am sending to the main window. :wtf:
mydlg.GetSafeHwnd() Pavel Sonork 100.15206
-
Yup, that's right. But I am not sure how to get the handle for my dialog box. Do you have any suggestion? So right now I am sending to the main window. :wtf:
If you have a dialog, surely you must know its HWND? For every message your dialogs message-pump handles, you get a HWND as part of the MSG (so if you handle WM_INITDIALOG, the WPARAM is the HWND of the dialog).
-
If you have a dialog, surely you must know its HWND? For every message your dialogs message-pump handles, you get a HWND as part of the MSG (so if you handle WM_INITDIALOG, the WPARAM is the HWND of the dialog).