EDN Admin
Well-known member
Hi,
Im developing a Win32 GUI application in Visual C++.
I have a function that performs a lot of calculations and that should pause and require a user input a few time during its execution.
The user input is a direct keyboard input, i.e. key presses.
Is there a standard way to do it?
If I insert a loop with a Sleep() function inside, and process user input in the main WndProc function, the application becomes non responsive.
I also tried to put something like this in to the function:
<pre class="prettyprint" style=" while (GetMessage(&msg, hWnd, WM_KEYFIRST, WM_KEYLAST))
{
switch(msg.message)
{
case WM_CHAR:
switch (msg.wParam) {
case 114:
// process input
break;
case 101:
// process input
break;
default:
break;
}
break;
}
} [/code]
but after a few seconds of waiting the program becomes non responsive.
Thanks!
<br/>
<br/>
<br/>
<br/>
<br/>
View the full article
Im developing a Win32 GUI application in Visual C++.
I have a function that performs a lot of calculations and that should pause and require a user input a few time during its execution.
The user input is a direct keyboard input, i.e. key presses.
Is there a standard way to do it?
If I insert a loop with a Sleep() function inside, and process user input in the main WndProc function, the application becomes non responsive.
I also tried to put something like this in to the function:
<pre class="prettyprint" style=" while (GetMessage(&msg, hWnd, WM_KEYFIRST, WM_KEYLAST))
{
switch(msg.message)
{
case WM_CHAR:
switch (msg.wParam) {
case 114:
// process input
break;
case 101:
// process input
break;
default:
break;
}
break;
}
} [/code]
but after a few seconds of waiting the program becomes non responsive.
Thanks!
<br/>
<br/>
<br/>
<br/>
<br/>
View the full article