pls help
-
Hi I want to ask a question which is very important for me. My project is on Windows CE but the problem is about visual C++.I have a worker thread that is waiting for the data coming from serial port.I want that when a definite data is comes I want to change the focus on controls.I am doing that with;
if(the definite data comes) dlg->PostMessage(WM_NEXTDLGCTL,NULL,NULL);
dlg is the object of the dialog box which I want to change the focus.But that is working only for the dialog box which the thread is working in.I cannot change the focus of controls for dialog boxes other then the dialog box which has the thread. If I can explain the problem can you help me. Thanks -
Hi I want to ask a question which is very important for me. My project is on Windows CE but the problem is about visual C++.I have a worker thread that is waiting for the data coming from serial port.I want that when a definite data is comes I want to change the focus on controls.I am doing that with;
if(the definite data comes) dlg->PostMessage(WM_NEXTDLGCTL,NULL,NULL);
dlg is the object of the dialog box which I want to change the focus.But that is working only for the dialog box which the thread is working in.I cannot change the focus of controls for dialog boxes other then the dialog box which has the thread. If I can explain the problem can you help me. ThanksTwo considerations: 1. Only one window can have the focus at a time. 2. It is indeed possible to give the focus to a dialog which is not used to start a thread. This a design problem. Post the code where : a. you create the thread b. you want the dlg to be updated.
Don't follow any man spiritually, don't do anything that will get you in sh*t if god is real - Bradml[^]
-
Hi I want to ask a question which is very important for me. My project is on Windows CE but the problem is about visual C++.I have a worker thread that is waiting for the data coming from serial port.I want that when a definite data is comes I want to change the focus on controls.I am doing that with;
if(the definite data comes) dlg->PostMessage(WM_NEXTDLGCTL,NULL,NULL);
dlg is the object of the dialog box which I want to change the focus.But that is working only for the dialog box which the thread is working in.I cannot change the focus of controls for dialog boxes other then the dialog box which has the thread. If I can explain the problem can you help me. Thanksiayd wrote:
I want that when a definite data is comes I want to change the focus on controls.
So why are you not calling
SetFocus()
for the control you want to have focus?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
-
Hi I want to ask a question which is very important for me. My project is on Windows CE but the problem is about visual C++.I have a worker thread that is waiting for the data coming from serial port.I want that when a definite data is comes I want to change the focus on controls.I am doing that with;
if(the definite data comes) dlg->PostMessage(WM_NEXTDLGCTL,NULL,NULL);
dlg is the object of the dialog box which I want to change the focus.But that is working only for the dialog box which the thread is working in.I cannot change the focus of controls for dialog boxes other then the dialog box which has the thread. If I can explain the problem can you help me. ThanksAre you really passing NULL for the WPARAM/LPARAM parameters when posting the WM_NEXTDLGCTL message? That sets the focus to the next control in the dialog that has the WS_TABSTOP style. Is that what you want or do you want the focus on a certain control? Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
Are you really passing NULL for the WPARAM/LPARAM parameters when posting the WM_NEXTDLGCTL message? That sets the focus to the next control in the dialog that has the WS_TABSTOP style. Is that what you want or do you want the focus on a certain control? Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
Man you two are priceless! I've got tears rolling down my face I'm laughing so hard! Have you guys considered starting your own show?
¡El diablo está en mis pantalones! ¡Mire, mire! Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)! SELECT * FROM User WHERE Clue > 0 0 rows returned Save an Orange - Use the VCF! VCF Blog
-
Hi I want to ask a question which is very important for me. My project is on Windows CE but the problem is about visual C++.I have a worker thread that is waiting for the data coming from serial port.I want that when a definite data is comes I want to change the focus on controls.I am doing that with;
if(the definite data comes) dlg->PostMessage(WM_NEXTDLGCTL,NULL,NULL);
dlg is the object of the dialog box which I want to change the focus.But that is working only for the dialog box which the thread is working in.I cannot change the focus of controls for dialog boxes other then the dialog box which has the thread. If I can explain the problem can you help me. ThanksThe problem you're probably running into is that you're making message calls to an HWND created in thread A from code that is executing in thread B. To make things work correctly, you to to make sure that the code executes on thread A (or whatever the correct thread ultimately is). What you can do is have your worker thread (the thread(s) that is spawned by the main UI thread) call PostThreadMessage, and use the thread ID of the main UI thread. The message will be some custom message specific to your app, and in that message handler, you can then do things to your UI/dialog box. You should read up on multiple threads and windows, and the PostThreadMessage/GetCurrentThreadId API's.
¡El diablo está en mis pantalones! ¡Mire, mire! Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)! SELECT * FROM User WHERE Clue > 0 0 rows returned Save an Orange - Use the VCF! VCF Blog
-
Man you two are priceless! I've got tears rolling down my face I'm laughing so hard! Have you guys considered starting your own show?
¡El diablo está en mis pantalones! ¡Mire, mire! Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)! SELECT * FROM User WHERE Clue > 0 0 rows returned Save an Orange - Use the VCF! VCF Blog
:) I don't know about led mike, but I find laughing through the pain to be good therapy. Mark
Mark Salsbery Microsoft MVP - Visual C++ :java: