how to send messages between diferents dialogs?
-
Hello, in my aplication there are two dialogs CCalibracionDlg and DlgMap1 both derived from Cdialog, when I press a button in DlgMap1 i have to send a message to CCalibracionDlg, how can i do this? I've been trying to do this with PostMessage(hWnd, WM_MYCUSTOMMESSAGE,(WPARAM) wParam,(LPARAM) lParam ); or SendMessage , but in DlgMap1 how can i get the hWnd to CCalibracionDlg? Thanks in advance.
timbk wrote:
...when I press a button in DlgMap1 i have to send a message to CCalibracionDlg, how can i do this?
Are they both visible? Are they modal or modelsss?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
-
timbk wrote:
...when I press a button in DlgMap1 i have to send a message to CCalibracionDlg, how can i do this?
Are they both visible? Are they modal or modelsss?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
-
Ies they are both visible, the one from class CCalibracionDlg is modal and the one from CDlgMap1 is no modal, why?
timbk wrote:
...the one from class CCalibracionDlg is modal and the one from CDlgMap1 is no modal, why?
Because modal dialog boxes "block" other windows from processing messages. Your topmost dialog would need to be modeless if you want it to be able to communicate with the dialog below it.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
-
CCalibracionDlg and DlgMap1 both derived from Cdialog, when I press a button in DlgMap1 i have to send a message to CCalibracionDlg, how can i do this? I've been trying to do this with PostMessage(hWnd, WM_MYCUSTOMMESSAGE,(WPARAM) wParam,(LPARAM) lParam ); or Better to have an 'object' or pointer of CCalibracionDlg in DlgMap1.U can get handle through object.GetSafeHWND(). Or Simply u can call object.SendMessage(..) or object.PostMessage() --Cool_Dev--
-
timbk wrote:
...the one from class CCalibracionDlg is modal and the one from CDlgMap1 is no modal, why?
Because modal dialog boxes "block" other windows from processing messages. Your topmost dialog would need to be modeless if you want it to be able to communicate with the dialog below it.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
-
oh, I didn't know it , so it's imposible send and recive messages between a model and modeless? ok supose that i change the main dialog to modeless , how can i do te send or post a message between the two modeless? with PostMessage?
timbk wrote:
so it's imposible send and recive messages between a model and modeless?
No, it IS possible.
timbk wrote:
ok supose that i change the main dialog to modeless...
The main dialog should stay modal. Any subsequent dialogs that you want to communicate with it should be modeless.
timbk wrote:
...with PostMessage?
That's a different topic altogether, and at this point does not matter to you.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
-
The objet from i'd like send the message is CDlgMap1 to the objet CCalibracionDlg, so you say that i have to put this code in the apropiate function in CDlgMap1 : CCalibracionDlg.PostMessage(...)?
yeaa.. exactly. As you want to send message to a window from another window in same application, u can simply use a Callback or a direct function call. But if the situation needs, such as you need to call the function many times, its better to use PostMessage or sendMessage. --Cool_Dev--
-
oh, I didn't know it , so it's imposible send and recive messages between a model and modeless? ok supose that i change the main dialog to modeless , how can i do te send or post a message between the two modeless? with PostMessage?
Thanks. But , wich is the correct syntax? i wrote the following code in CDlgMapa1 <code>CCalibracionDlg.PostMessage( ? , WM_MYCUSTOMMESSAGE,(WPARAM) wParam,(LPARAM) lParam);</code> Two questions: 1-What have i put in'?' ? , the handler to CCalibracionDlg (is the object that recives the message) ? in this case , how can obtain it? if you could put some code like an example , would be nice. 2- at that line of code the compiler says : error C2143: syntax error : missing ';' before '.' , sounds like the compiler doesn't recognizes that line. thanks again.
-
CCalibracionDlg and DlgMap1 both derived from Cdialog, when I press a button in DlgMap1 i have to send a message to CCalibracionDlg, how can i do this? I've been trying to do this with PostMessage(hWnd, WM_MYCUSTOMMESSAGE,(WPARAM) wParam,(LPARAM) lParam ); or Better to have an 'object' or pointer of CCalibracionDlg in DlgMap1.U can get handle through object.GetSafeHWND(). Or Simply u can call object.SendMessage(..) or object.PostMessage() --Cool_Dev--
-
Hello, in my aplication there are two dialogs CCalibracionDlg and DlgMap1 both derived from Cdialog, when I press a button in DlgMap1 i have to send a message to CCalibracionDlg, how can i do this? I've been trying to do this with PostMessage(hWnd, WM_MYCUSTOMMESSAGE,(WPARAM) wParam,(LPARAM) lParam ); or SendMessage , but in DlgMap1 how can i get the hWnd to CCalibracionDlg? Thanks in advance.