Lock the keyboard input and mouse in a window [C + +].
# include <iostream>
# include <windows.h>
# include <cstdlib>
# include <cstdio>
using namespace std;
const char window [3] [65] = {"Windows Live Messenger", "Windows Media Player"
"Control Panel"};
HWND hwnd [3] = {hwnd [0] = FindWindow (NULL, windows [0]), hwnd [1] =FindWindow (NULL, windows [1]),
hwnd [2] = FindWindow (NULL, windows [2])};
void search () {
if (hwnd [0] == NULL) {
court <<"not found the window:" <<window [0]; getchar ();
else {} EnableWindow (hwnd [0], false) court <<"Found window:" <<window [0];getchar ();}
if (hwnd [1] == NULL) {
court <<"not found the window:" <<window [1]; getchar ();
else {} EnableWindow (hwnd [1], false) court <<"Found window:" <<window [1];getchar ();}
if (hwnd [2] == NULL) {
court <<"not found the window:" <<window [2]; getchar ();
else {} EnableWindow (hwnd [2], false) court <<"Found window:" <<window [2];getchar ();}
}
int main () {
SetConsoleTitle ("windows");
search ();
getchar ();
return 0;
}
# include <windows.h>
# include <cstdlib>
# include <cstdio>
using namespace std;
const char window [3] [65] = {"Windows Live Messenger", "Windows Media Player"
"Control Panel"};
HWND hwnd [3] = {hwnd [0] = FindWindow (NULL, windows [0]), hwnd [1] =FindWindow (NULL, windows [1]),
hwnd [2] = FindWindow (NULL, windows [2])};
void search () {
if (hwnd [0] == NULL) {
court <<"not found the window:" <<window [0]; getchar ();
else {} EnableWindow (hwnd [0], false) court <<"Found window:" <<window [0];getchar ();}
if (hwnd [1] == NULL) {
court <<"not found the window:" <<window [1]; getchar ();
else {} EnableWindow (hwnd [1], false) court <<"Found window:" <<window [1];getchar ();}
if (hwnd [2] == NULL) {
court <<"not found the window:" <<window [2]; getchar ();
else {} EnableWindow (hwnd [2], false) court <<"Found window:" <<window [2];getchar ();}
}
int main () {
SetConsoleTitle ("windows");
search ();
getchar ();
return 0;
}
0 Response to Lock the keyboard input and mouse in a window [C + +].
Post a Comment