Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Design and Architecture
  4. platform for an app for Ease of Access searched

platform for an app for Ease of Access searched

Scheduled Pinned Locked Moved Design and Architecture
csharpc++wpfquestionannouncement
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    Erhy
    wrote on last edited by
    #1

    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

    A 1 Reply Last reply
    0
    • E 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

      A Offline
      A Offline
      Afzaal Ahmad Zeeshan
      wrote on last edited by
      #2

      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 the SendInput 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 !~

      E 1 Reply Last reply
      0
      • A Afzaal Ahmad Zeeshan

        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 the SendInput 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 !~

        E Offline
        E Offline
        Erhy
        wrote on last edited by
        #3

        Thanks for your answer. Can you tell me more about P/Invoke I never heard above. Erhy

        A 1 Reply Last reply
        0
        • E Erhy

          Thanks for your answer. Can you tell me more about P/Invoke I never heard above. Erhy

          A Offline
          A Offline
          Afzaal Ahmad Zeeshan
          wrote on last edited by
          #4

          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, stacks

          You 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 !~

          E 1 Reply Last reply
          0
          • A Afzaal Ahmad Zeeshan

            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, stacks

            You 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 !~

            E Offline
            E Offline
            Erhy
            wrote on last edited by
            #5

            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

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups