platform for an app for Ease of Access searched
-
I have written an app for Ease of Access on desktop which plays sound for typing on keyboard and releases the shift key automatically after a letter typed. I used MFC messages and SetWindowsHookEx(WH_KEYBOARD_LL, …) I’m not so happy with the ancient dialog elements and need advice to port the software to a modern GUI. Needed features, used in the software are: Handling of keyboard events and SendInput() to release shift-key automatically Hide the dialog and placed as tray icon Usage of the XAudio2 library Imbed sounds of .wav files in the resources of the App Regions for the shape of the dialog and oval buttons Now I use C++ and MFC Are the features mentioned practicable also for a WPF app written in C# or an other ? Thank you for tips Erhy
-
I have written an app for Ease of Access on desktop which plays sound for typing on keyboard and releases the shift key automatically after a letter typed. I used MFC messages and SetWindowsHookEx(WH_KEYBOARD_LL, …) I’m not so happy with the ancient dialog elements and need advice to port the software to a modern GUI. Needed features, used in the software are: Handling of keyboard events and SendInput() to release shift-key automatically Hide the dialog and placed as tray icon Usage of the XAudio2 library Imbed sounds of .wav files in the resources of the App Regions for the shape of the dialog and oval buttons Now I use C++ and MFC Are the features mentioned practicable also for a WPF app written in C# or an other ? Thank you for tips Erhy
Of course, WPF and .NET allow you to control the input capturing from the System.Windows.Input namespace, where you get all the features such as
Keyboard
, or Binding for the inputs etc. You can use these classes to control the input from users, change the input or even change the key bindings all. Secondly — but not recommended, you can consider using P/Invoke as well, to invoke the dll functions, such as and especially theSendInput
function to actually send something as input a number of times. The benefit of this is, that you still get all of the high-level features of WPF application, while being able to easily go back to the native stuff and controlling hardware from unmanaged code, and maintaining states through marshalling. There are several other types available there in the System.Windows.* namespace gallery, you would be amazed to see all of that service-level stuff available in managed and "modern GUI" way. That said, you can still go back to native stuff and do the things you want to do to your application. :-) [System.Windows.Input Namespace](https://msdn.microsoft.com/en-us/library/system.windows.input(v=vs.110).aspx) [Keyboard
Class (System.Windows.Input)](https://msdn.microsoft.com/en-us/library/system.windows.input.keyboard(v=vs.110).aspx) [keypress using SendInput API](https://social.msdn.microsoft.com/Forums/vstudio/en-US/d696b9cc-1166-4ad9-b3c9-6c838fe897f0/keypress-using-sendinput-api?forum=wpf)The shit I complain about It's like there ain't a cloud in the sky and it's raining out - Eminem ~! Firewall !~
-
Of course, WPF and .NET allow you to control the input capturing from the System.Windows.Input namespace, where you get all the features such as
Keyboard
, or Binding for the inputs etc. You can use these classes to control the input from users, change the input or even change the key bindings all. Secondly — but not recommended, you can consider using P/Invoke as well, to invoke the dll functions, such as and especially theSendInput
function to actually send something as input a number of times. The benefit of this is, that you still get all of the high-level features of WPF application, while being able to easily go back to the native stuff and controlling hardware from unmanaged code, and maintaining states through marshalling. There are several other types available there in the System.Windows.* namespace gallery, you would be amazed to see all of that service-level stuff available in managed and "modern GUI" way. That said, you can still go back to native stuff and do the things you want to do to your application. :-) [System.Windows.Input Namespace](https://msdn.microsoft.com/en-us/library/system.windows.input(v=vs.110).aspx) [Keyboard
Class (System.Windows.Input)](https://msdn.microsoft.com/en-us/library/system.windows.input.keyboard(v=vs.110).aspx) [keypress using SendInput API](https://social.msdn.microsoft.com/Forums/vstudio/en-US/d696b9cc-1166-4ad9-b3c9-6c838fe897f0/keypress-using-sendinput-api?forum=wpf)The shit I complain about It's like there ain't a cloud in the sky and it's raining out - Eminem ~! Firewall !~
-
P/Invoke is actually a technology, which allows you to invoke the native and unmanaged code functions from your managed applications. For instance, your WPF app is a managed application, whereas the low-level function SendInput is an unmanaged one — and others written in C or C++ runtimes etc. Thus, to execute them you would need to use P/Invoke, it lets you specify where your function exists. It is similar to using the extern modifier in C or C++ to guide compiler, that the function exists somewhere else (
kernel.dll
,user32.dll
,custom.dll
etc.). The statement are similar to something like this,// Your DLL path, and other settings
[DllImport("custom.dll")]
static extern void Add(int a, int b); // Name, entry points, parameters, their types, stacksYou would require to control how these things actually go about. Marshalling, for instance, allows you to actually go deep down and control how data is passed at the boundary of unmanaged and managed code. Strings, arrays, integers and other stuff requires this much control so you need to make sure that your application easily takes care of all of that. [Platform Invoke Tutorial (C#)](https://msdn.microsoft.com/en-us/library/aa288468(v=vs.71).aspx)
The shit I complain about It's like there ain't a cloud in the sky and it's raining out - Eminem ~! Firewall !~
-
P/Invoke is actually a technology, which allows you to invoke the native and unmanaged code functions from your managed applications. For instance, your WPF app is a managed application, whereas the low-level function SendInput is an unmanaged one — and others written in C or C++ runtimes etc. Thus, to execute them you would need to use P/Invoke, it lets you specify where your function exists. It is similar to using the extern modifier in C or C++ to guide compiler, that the function exists somewhere else (
kernel.dll
,user32.dll
,custom.dll
etc.). The statement are similar to something like this,// Your DLL path, and other settings
[DllImport("custom.dll")]
static extern void Add(int a, int b); // Name, entry points, parameters, their types, stacksYou would require to control how these things actually go about. Marshalling, for instance, allows you to actually go deep down and control how data is passed at the boundary of unmanaged and managed code. Strings, arrays, integers and other stuff requires this much control so you need to make sure that your application easily takes care of all of that. [Platform Invoke Tutorial (C#)](https://msdn.microsoft.com/en-us/library/aa288468(v=vs.71).aspx)
The shit I complain about It's like there ain't a cloud in the sky and it's raining out - Eminem ~! Firewall !~
now with .NET a hang with the resources I embedded more than 150 wave Files with the build action 'Embedded Resource' and want memory pointers to the data. With MFC a used LockResource to get a pointer - this is fast. I see, in .NET an access is only possible with Streams. I think this will take a while and need a big memory space. Have you an idea? Erhy