abt Alt+keys
-
hello all what code do i need to write in MFC in order to check if the user has clicked alt key on the key board and how can i implement Alt+F4 fuction when the user clickes alt button on the key board and button(with caption F4) which is on my dialog box which is created in an SDI application my alt and F4 button on the dialogbox has the following code in the fuction void MyDialog::OnButtonalt1() { flag=1; if( ( (WM_KEYDOWN||WM_SYSKEYDOWN) && (0x8000 ==(0x8000 & GetKeyState(18)) ) ) ) { MessageBox("in Alt"); } /*if( (WM_KEYDOWN && !GetKeyState(18)) && caps) { Invalidate(); } BYTE keyState[256]; GetKeyboardState((LPBYTE)&keyState); if( (TRUE && !(keyState[115] & 1))||(!FALSE && (keyState[115] & 1)) ) { // Simulate a key press keybd_event( 38,0x45,KEYEVENTF_EXTENDEDKEY|0,0); // Simulate a key release keybd_event(38,0x45,KEYEVENTF_EXTENDEDKEY|KEYEVENTF_KEYUP,0); } */ } void MyDialog::OnButtonF4() { int i = GetKeyState(115); if(i) { MessageBox("In F4"); } } Request to all to continue this
-
hello all what code do i need to write in MFC in order to check if the user has clicked alt key on the key board and how can i implement Alt+F4 fuction when the user clickes alt button on the key board and button(with caption F4) which is on my dialog box which is created in an SDI application my alt and F4 button on the dialogbox has the following code in the fuction void MyDialog::OnButtonalt1() { flag=1; if( ( (WM_KEYDOWN||WM_SYSKEYDOWN) && (0x8000 ==(0x8000 & GetKeyState(18)) ) ) ) { MessageBox("in Alt"); } /*if( (WM_KEYDOWN && !GetKeyState(18)) && caps) { Invalidate(); } BYTE keyState[256]; GetKeyboardState((LPBYTE)&keyState); if( (TRUE && !(keyState[115] & 1))||(!FALSE && (keyState[115] & 1)) ) { // Simulate a key press keybd_event( 38,0x45,KEYEVENTF_EXTENDEDKEY|0,0); // Simulate a key release keybd_event(38,0x45,KEYEVENTF_EXTENDEDKEY|KEYEVENTF_KEYUP,0); } */ } void MyDialog::OnButtonF4() { int i = GetKeyState(115); if(i) { MessageBox("In F4"); } } Request to all to continue this
-
hello all what code do i need to write in MFC in order to check if the user has clicked alt key on the key board and how can i implement Alt+F4 fuction when the user clickes alt button on the key board and button(with caption F4) which is on my dialog box which is created in an SDI application my alt and F4 button on the dialogbox has the following code in the fuction void MyDialog::OnButtonalt1() { flag=1; if( ( (WM_KEYDOWN||WM_SYSKEYDOWN) && (0x8000 ==(0x8000 & GetKeyState(18)) ) ) ) { MessageBox("in Alt"); } /*if( (WM_KEYDOWN && !GetKeyState(18)) && caps) { Invalidate(); } BYTE keyState[256]; GetKeyboardState((LPBYTE)&keyState); if( (TRUE && !(keyState[115] & 1))||(!FALSE && (keyState[115] & 1)) ) { // Simulate a key press keybd_event( 38,0x45,KEYEVENTF_EXTENDEDKEY|0,0); // Simulate a key release keybd_event(38,0x45,KEYEVENTF_EXTENDEDKEY|KEYEVENTF_KEYUP,0); } */ } void MyDialog::OnButtonF4() { int i = GetKeyState(115); if(i) { MessageBox("In F4"); } } Request to all to continue this