Ok, here goes, I've got a staticwindow where I am putting the information from keyboard presses and onscreen button presses. When I run the program, I can press the keys and they show up just fine. I then press the button on the screen with my mouse which also works. However, now when I try to press a key on the board again, the WM_CHAR case is no longer getting information from the wParam.
I have found that by minimizing the window, or placing a messagebox inside of the WM_COMMAND case, it works properly. I've looked extensively and haven't found a proper solution.
LRESULT CALLBACK WinProc(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
LPTSTR pushed_button = new TCHAR[10];
LPTSTR current_string = new TCHAR[1010];
GetWindowText(hwndStatic, current_string, 1000);
switch(Msg){
case WM_COMMAND:
//Enable the following message box, or minimize and restore the window for functionality to return.
//MessageBox(hwnd,L"button press",L"Item details",0);
switch(LOWORD(wParam)){ //the ID is is wParam
case 20:
GetWindowText(button[0], pushed_button,10);
lstrcat(current_string,pushed_button);
SetWindowText(hwndStatic, current_string);
break;
case 21:
GetWindowText(button[1], pushed_button,10);
lstrcat(current_string,pushed_button);
SetWindowText(hwndStatic, current_string );
break;
}
return DefWindowProc(hwnd, Msg, wParam, lParam);
break;
case WM_CHAR: //the case that stops working.
switch(wParam){
case 'A':
lstrcat(current_string,L"A");
SetWindowText(hwndStatic, current_string );
break;
Any help is appreciated. Thank-you