Click here to Skip to main content
15,924,318 members
Home / Discussions / C#
   

C#

 
GeneralRe: Phone caller Pin
Nader Elshehabi28-Sep-06 9:42
Nader Elshehabi28-Sep-06 9:42 
QuestionRe: Phone caller Pin
HojatAlizadehfard1-Oct-06 1:20
HojatAlizadehfard1-Oct-06 1:20 
AnswerRe: Phone caller Pin
Nader Elshehabi1-Oct-06 4:22
Nader Elshehabi1-Oct-06 4:22 
QuestionQuestion about messaging in C# Pin
Jethro6325-Sep-06 7:00
Jethro6325-Sep-06 7:00 
AnswerRe: Question about messaging in C# Pin
led mike25-Sep-06 7:44
led mike25-Sep-06 7:44 
AnswerRe: Question about messaging in C# Pin
Nader Elshehabi25-Sep-06 7:59
Nader Elshehabi25-Sep-06 7:59 
GeneralRe: Question about messaging in C# Pin
Jethro6325-Sep-06 8:13
Jethro6325-Sep-06 8:13 
GeneralRe: Question about messaging in C# Pin
Nader Elshehabi25-Sep-06 10:42
Nader Elshehabi25-Sep-06 10:42 
Well, I think you are getting a little meticulous about details hereBig Grin | :-D . It's nice though not much seen these days.

Exchanging messages between forms has many formsPoke tongue | ;-P , depending on your needs and design. There may not be a best practice that is considered an industrial standard or a windows logo criteria, rather it's just a mere advice that could be criticized by another programmer.
Jethro63 wrote:
Now, the new form has controls of various stripes on it and the parent form need not know about everything that is going on on this form but needs to be notified of certain key events

Once I read that sentence I had the word interface jumping across my eyes. It would be a nice way to make a standard of communicaion between your parent form and different MDIChild types -ie. through a common interface-.
Jethro63 wrote:
And lets say that simply calling some member function of the parent form from the child form isn't quite going to work

Well, actually it can be done using Parent.Invoke() method for events that you want your child form to wait for the parent to excute its code. If you want to fire an event in the parent form and not to wait until it's done, call Parent.BeginInvoke() instead. Both calls of course are from your child forms.
Jethro63 wrote:
In Win32 programming and MFC, we would send asynchronous messaged from one window to another using the messaging system built into windows. As long as your thread or window has a message pump, then it should get the message.

Well, you still can use the same thing in C# if you like it. Actually the messaging system is still applicable -even in Windows Vista I think-, so simply:
1- In the child form call Windows API PostMessage() or SendMessage() functions -whichever suits you-, using P/Invoke and give it the handle of the parent form.
2- In the parent form implement IMessageFilter interface and use its PreFilterMessage() to catch your custom message or use any way that suits you -usually there are predefined handlers- to catch WM_ standard messages if you wish to send them.
Jethro63 wrote:
Is there anything like this for C#?

In addition to the above there are more improvised ways like exchanging data between forms -considered as threads- using System.Runtime.Remoting.IPCChannel class, or even sockets -one form is listener and the other is client-, but I don't think they would be an interesting choice to you.

I hope that was useful.


RegardsRose | [Rose]

GeneralRe: Question about messaging in C# Pin
Jethro6325-Sep-06 16:20
Jethro6325-Sep-06 16:20 
QuestionProblem with SmtpClient Pin
Hmitosh25-Sep-06 6:36
Hmitosh25-Sep-06 6:36 
AnswerRe: Problem with SmtpClient Pin
led mike25-Sep-06 7:45
led mike25-Sep-06 7:45 
AnswerRe: Problem with SmtpClient Pin
Nadia Monalisa25-Sep-06 10:15
Nadia Monalisa25-Sep-06 10:15 
Questionchoosing appropriate data type Pin
biaali25-Sep-06 6:24
biaali25-Sep-06 6:24 
AnswerRe: choosing appropriate data type Pin
Jon Sagara25-Sep-06 6:33
Jon Sagara25-Sep-06 6:33 
GeneralRe: choosing appropriate data type Pin
biaali25-Sep-06 6:36
biaali25-Sep-06 6:36 
GeneralRe: choosing appropriate data type Pin
Jon Sagara25-Sep-06 6:44
Jon Sagara25-Sep-06 6:44 
GeneralRe: choosing appropriate data type Pin
biaali25-Sep-06 6:46
biaali25-Sep-06 6:46 
QuestionThreading in C# Pin
Omkar Ghaisas25-Sep-06 6:13
Omkar Ghaisas25-Sep-06 6:13 
AnswerRe: Threading in C# Pin
Nader Elshehabi25-Sep-06 6:48
Nader Elshehabi25-Sep-06 6:48 
QuestionHow to Open popup window in Mozilla firefox Pin
eswarattaluri25-Sep-06 5:26
eswarattaluri25-Sep-06 5:26 
AnswerRe: How to Open popup window in Mozilla firefox Pin
Nader Elshehabi25-Sep-06 6:46
Nader Elshehabi25-Sep-06 6:46 
QuestionC# Video & Audio Network Stream Writer Pin
Nautilus Master25-Sep-06 5:21
Nautilus Master25-Sep-06 5:21 
Questionchange windowapplication in an exe Pin
faladrim25-Sep-06 5:03
faladrim25-Sep-06 5:03 
AnswerRe: change windowapplication in an exe Pin
Ed.Poore25-Sep-06 5:08
Ed.Poore25-Sep-06 5:08 
QuestionSorting columns in listviews Pin
Hampus@foi25-Sep-06 4:56
Hampus@foi25-Sep-06 4:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.