Original Post
I want to create multiple threads which tell windows to create a message queue for them, and then executes different things, depending on the wParam and lParam of the WM_APP messages that they receive (which are sent between them).
If I use WM_APP, all the threads that communicate between them will receive the messages, but if other application send WM_APP to the threads, they will receive them?
I want to make sure that if a random application starts broadcasting random messages, my application won't have problems with them.
For example, a thread executes something if it receives the WM_APP message with wParam == 1 and lParam == (Some pointer which contain data). If another application sends the message WM_APP with wParam == 1 and lParam = 3 (an unwanted value), will my application receive it (and obviously crash)?
If so, how i can make my threads so that they do not have this kind of problems?
I've searched through Google and through the forum about this and found nothing.
void ThreadProc(void) // a thread's procedure{ PeekMessage(&msg,0,WM_APP,WM_APP,PM_NOREMOVE); //make sure windows creates the message queue while (1) { if (GetMessage(&msg,0,0,0)) { if (msg.message == WM_APP) { if (msg.wParam == 0) { return 0; //we do not need the thread anymore } else { //Do something } } } }}