Infinite loop ??
-
Hello, I am having trouble making a semi-infinite loop. Here's the problem: I need to send a positional value from a machine to a dialog box on my main dialog screen all the time, but the program must be able to detect when buttons are being pushed and things like that Right now I have it where I can continuously update the text box while a button is down by using the command:
while(GetAsyncKeyState(VK_LBUTTON)<0)
, but the mouse button must remain down to do this, which makes all of the other buttons on the dialog useless. I need to do something like this in my main dialog box: always update the text box without clicking the mouse or pressing any buttons and be able to constantly monitor when the keyboard is pressed and when the mouse buttons are pressed Thanks for your help! Loren: -
Hello, I am having trouble making a semi-infinite loop. Here's the problem: I need to send a positional value from a machine to a dialog box on my main dialog screen all the time, but the program must be able to detect when buttons are being pushed and things like that Right now I have it where I can continuously update the text box while a button is down by using the command:
while(GetAsyncKeyState(VK_LBUTTON)<0)
, but the mouse button must remain down to do this, which makes all of the other buttons on the dialog useless. I need to do something like this in my main dialog box: always update the text box without clicking the mouse or pressing any buttons and be able to constantly monitor when the keyboard is pressed and when the mouse buttons are pressed Thanks for your help! Loren: -
Hello, I am having trouble making a semi-infinite loop. Here's the problem: I need to send a positional value from a machine to a dialog box on my main dialog screen all the time, but the program must be able to detect when buttons are being pushed and things like that Right now I have it where I can continuously update the text box while a button is down by using the command:
while(GetAsyncKeyState(VK_LBUTTON)<0)
, but the mouse button must remain down to do this, which makes all of the other buttons on the dialog useless. I need to do something like this in my main dialog box: always update the text box without clicking the mouse or pressing any buttons and be able to constantly monitor when the keyboard is pressed and when the mouse buttons are pressed Thanks for your help! Loren:I'm pretty sure there is something trivial that you are missing, but I don't do windows event loops enough to tell you what. As an alternative, that might be better: have you considered using threads? use one thread to read this message, and when it changes post a message to the main thread. (In some systems you can update the window from that thread, I'm not sure about windows) Threads have their own problems, and are difficult to work with on some levels, but it might be better.
-
Hello, I am having trouble making a semi-infinite loop. Here's the problem: I need to send a positional value from a machine to a dialog box on my main dialog screen all the time, but the program must be able to detect when buttons are being pushed and things like that Right now I have it where I can continuously update the text box while a button is down by using the command:
while(GetAsyncKeyState(VK_LBUTTON)<0)
, but the mouse button must remain down to do this, which makes all of the other buttons on the dialog useless. I need to do something like this in my main dialog box: always update the text box without clicking the mouse or pressing any buttons and be able to constantly monitor when the keyboard is pressed and when the mouse buttons are pressed Thanks for your help! Loren:Loren, Have you thought about using the timer event. In the OnInitDlg section of your code you could create a timer that calls the OnTimer event. Have it run every second. Then you can let the rest of your program do what you want it to do. I have this running a clock in a status bar. Work great. Tom Wright tawright915@yahoo.com
-
Hello, I am having trouble making a semi-infinite loop. Here's the problem: I need to send a positional value from a machine to a dialog box on my main dialog screen all the time, but the program must be able to detect when buttons are being pushed and things like that Right now I have it where I can continuously update the text box while a button is down by using the command:
while(GetAsyncKeyState(VK_LBUTTON)<0)
, but the mouse button must remain down to do this, which makes all of the other buttons on the dialog useless. I need to do something like this in my main dialog box: always update the text box without clicking the mouse or pressing any buttons and be able to constantly monitor when the keyboard is pressed and when the mouse buttons are pressed Thanks for your help! Loren: