it must be inside the inner loop and out of the switch.
ajmalsiddiqui
it must be inside the inner loop and out of the switch.
ajmalsiddiqui
There is no UI thread all are worker threads.This was not the exact code , the exact code is running well there is no issue in the application.I just write the scenrio of my requirment. 1.If there is message in the queue it will be processed and then will be removed.So there is need little correction is code: PeekMessage(pmsg, NULL, 0, 0, PM_REMOVE); // -(2) is inside the switch, not out of the inner while loop.
while(PeekMessage(pmsg, NULL, 0, 0, PM_NOREMOVE)) // -(1)
{
switch(pmsg ->message)
{
case MSG_RE_START:
// log here pending messages in queue
//do some functionality
break;
case MSG_RE_STOP:
// log here pending messages in queue
//do some functionality
break;
case MSG_RE_DATA:
// get number of pending messages
//Process data
break;
}
PeekMessage(pmsg, NULL, 0, 0, PM_REMOVE); // -(2)
}
2.The main thread is not constantly spinning in a busy loop, becasue it waits on some events when exits from the inner loop.I did not mention, So leave it 3. Leave this, assume that the application is running not closing. I just want to know that How can i get the pending number of messages in queue , for example when i receive MSG_RE_DATA message,How many number of messages MSG_RE_DATA are pending.
ajmalsiddiqui
Thanks, I am little bit cofused by your reply and unable to understand.There is no issue I just want to add some functionality in my application threads, I just want to check queue length,In my application there are 15 threads one of them is main thread(Controller Thread).All threads are posting theire different customized message and some data in WPARAM/LPARAM using using PostThreadMessage function. Now the controller thread receive all these messages using PeekMessage(pmsg, NULL, 0, 0, PM_NOREMOVE)from thread mesage queue in its Run method. // code snap shot Controller::Run() { While(1) { while(PeekMessage(pmsg, NULL, 0, 0, PM_NOREMOVE)) { switch(pmsg ->message) { case MSG_RE_START: // log here pending messages in queue //do some functionality case MSG_RE_StOP: // log here pending messages in queue //do some functionality } PeekMessage(pmsg, NULL, 0, 0, PM_REMOVE); } } } So when I receive one message I wan to log the pending messages which are still in queue and will be processed in next iteration means in call of PeekMessage. After Processing one Message I remove it from Thread queue using PeekMessage(pmsg, NULL, 0, 0, PM_REMOVE) So can I get the queue status , how many number of messages are in thread queue or queue length.?
ajmalsiddiqui
Thanks for the response , but i think this would not because this function returns the type of messages in the queue, not message count or queue length. I wan to get number of messages in queue or number of pending messages in queue.
ajmalsiddiqui
My application has several MFC threads running concurrently; these threads process their messages by using Peek Message. I want to know queue size in each thread (i.e. pending messages in thread queue).Is there any API that can tell me the message count or pending message count for each thread.? If there is no such an API, Is there any method to get message count at process level.?
ajmalsiddiqui
dear why do You not use loop to initialize array with ur desired value. ajmalsiddiqui -- modified at 6:50 Monday 8th May, 2006
Plz See the following Example first. Class A { Void Func(){AfxMessageBox("Function Class A");} } int Main() { A *pClassA; pClassA=NULL; pClassA->Func(); } The output is a MessageBox displayed: AfxMessageBox("Function Class A"); Why this output is displayed because pointer has no memory plz explain this behaviour in the context of VC++ 6.0/MFC.Is this compliler Bug or My VC++6.0 is corrupt or any other.....? Yours Sincerely Ajmal Siddiqi ajmalsiddiqui -- modified at 6:45 Monday 8th May, 2006
hi what a good reply thanks for this. I m using CFileDialog class object but on domodal i want to restrict the user to modifify the files those are veiwed in filedialog.Actually i want that user can only veiw the files and can copy by mouse right click but not cut and del. bye ajmal ajmalsiddiqui
i m using CFileDialog object to open file dialog so user can select the files but i want to make disable the "delete" option if user right clicks on the selected file and tries to delete it.Also user cannot be able to delete the selected file by the key "delete" from key board. thanks ajmal ajmalsiddiqui
thanks sir for replying actually i make a multithrreaded mfc applicaion .it has my own functionality and i want to run it in background as a process just like a service.And i donot want any window should apear so user cannot interact with my application. ajmal ajmalsiddiqui
hi sir.. i want as the dialog is created it should be hidden or as application is loaded dialog should be hidden.so sir to handle this situation where i should write this->ShowWindow(SW_HIDE); THANKS AJMAL ajmalsiddiqui
I have developed IP SoftPhone based on H.323 Protocol in vc++; It has traditional calling features like : 1)PC-PC and PC-PSTN CallHandling 2)CallTransfering 3)CallForwarding Extra feature: A)Browsing facility ajmal siddiqi(ajmal_qau@yahoo.com)
i developed an application dialog based.i want to hide dialog i mean,Dialog application should exist in background process but its dialog window should not be visible at the front end.In other words just dialog window should not be displayed but its process should exist. thanks ajmal siddiqi ajmalsiddiqui