שאלה

the origin

New member
שאלה

למישהו יש מושג איך אני בודק אם הcaps Lock דלוק או לא??? אני מתכנת בvc++ אז אל תתנו תשובות של דוס בבקשה :p (בדוס זה לא בעיה)
 

gmorphus

New member
לא התעמקתי אבל...

מפה אתה אמור להסתדר. הקוד הזה מדליק את ה NumLock אבל אני מניח שהבדיקות שקולות עבור CapsLock (שים לב לפונקציה GetKeyboardState)
/* Compile options needed: */ #include <windows.h> void SetNumLock( BOOL bState ) { BYTE keyState[256]; GetKeyboardState((LPBYTE)&keyState); if( (bState && !(keyState[VK_NUMLOCK] & 1)) || (!bState && (keyState[VK_NUMLOCK] & 1)) ) { // Simulate a key press keybd_event( VK_NUMLOCK, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0 ); // Simulate a key release keybd_event( VK_NUMLOCK, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0); } } void main() { SetNumLock( TRUE ); }​
 

hatulflezet

New member
ומכאן...

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI/WindowsUserInterface/UserInput/KeyboardInput/KeyboardInputReference/KeyboardInputFunctions/SetKeyboardState.asp
 

hatulflezet

New member
אופס...hehe

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI/ WindowsUserInterface/UserInput/ KeyboardInput/KeyboardInputReference/ KeyboardInputFunctions/SetKeyboardState.asp​
תחבר הכל יחד זה לינק לMSDN
 
למעלה