CapsLock(), InsMode() , NumLock()

This forum is meant for questions about the Visual FoxPro Language support in X#.

Karl-Heinz
Posts: 774
Joined: Wed May 17, 2017 8:50 am
Location: Germany

CapsLock(), InsMode() , NumLock()

Post by Karl-Heinz »

Hi Robert,

i finally added "XS" to the names of the two new members and the two modified structures. i think that signals that not the original structure declarations are used.

Code: Select all

INTERNAL CLASS Win32  

	CONST INTERNAL KEYEVENTF_KEYUP := 2 AS INT
	CONST INTERNAL VK_INSERT := 45 AS INT
	CONST INTERNAL VK_NUMLOCK := 144 AS INT
	CONST INTERNAL VK_CAPITAL := 20 AS INT 
    CONST INTERNAL TYPE_KEYBOARD := 1 AS INT
    
		
	[DllImport("user32.dll", SetLastError := TRUE)] ;
	INTERNAL STATIC METHOD SendInput(nInputs AS DWORD , pInputs AS winInputXS[], cbSize AS LONG ) AS DWORD

	[DllImport("user32.dll", SetLastError := TRUE)] ;
	INTERNAL STATIC METHOD GetKeyState(nVirtkey AS INT) AS SHORTINT
		
	[StructLayout(LayoutKind.Sequential)];	
	INTERNAL STRUCTURE winKeyboardInputXS
		INTERNAL wVk AS WORD 
		INTERNAL wScan AS WORD
		INTERNAL dwFlags AS DWORD
		INTERNAL time AS DWORD
		INTERNAL dwExtraInfo AS IntPtr
		INTERNAL Unused1XS AS DWORD
		INTERNAL UnUsed2XS AS DWORD		
	END STRUCTURE 		

	
	[StructLayout(LayoutKind.Sequential)] ;
	INTERNAL STRUCTURE winInputXS
		INTERNAL Type AS DWORD
		INTERNAL Input AS winKeyboardInputXS 
	END STRUCTURE 

END CLASS 

regards
Karl-Heinz
User avatar
robert
Posts: 4520
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

CapsLock(), InsMode() , NumLock()

Post by robert »

Karl-Heinz ,
The naming is OK. Since these are internal structures there is very little change of naming conflicts anyway.
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
Karl-Heinz
Posts: 774
Joined: Wed May 17, 2017 8:50 am
Location: Germany

CapsLock(), InsMode() , NumLock()

Post by Karl-Heinz »

Guys,

in the attachment you find the latest VFPKeyboard.viaef
,
regards
Karl-Heinz
Attachments

[The extension viaef has been deactivated and can no longer be displayed.]

User avatar
robert
Posts: 4520
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

CapsLock(), InsMode() , NumLock()

Post by robert »

Karl-Heinz,

I'll include this in the upcoming 2.8 release

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
Karl-Heinz
Posts: 774
Joined: Wed May 17, 2017 8:50 am
Location: Germany

CapsLock(), InsMode() , NumLock()

Post by Karl-Heinz »

Guys,

Attached is a app that handles the insert key via a keyboard hook. To round things up, i implemented a local (app only) and a global keyboard hook. A global hook doesn't make much sense in this particular case, so it's added just to show the different behavior.

The name of the attached app is still VFPKeyboard.viaef, but because i added a VO window with a sle to test the insert key, the app requires now the VO dialect.

In the Start() method you can decide whether you want to install a local (app only) or a global keyboard hook. Just change the content of the logic var 'lUseGlobalHook' in the start() method. If a global hook is installed, switch to another app and press the insert key. When you look at the terminal window, you will see now a message that the insert key state has changed. This does not happen if a local (app only) keyboard hook is installed.

BTW. I doubt that it's always possible to detect correctly at startup the current insert key state.

regards
Karl-Heinz
Attachments

[The extension viaef has been deactivated and can no longer be displayed.]

Post Reply