fattumsdad
asked on
"Communicating" with Peripherals And Virtual Keys
Is there a way to "interact" with the peripherals in a console program? For example, switch mouse buttons... turns caps on / off, etc? Also, I've heard about using Virtual Keys... is that used to basically simulate keystrokes?
Thanks,
Tony
Thanks,
Tony
ASKER
Everything I found in those answers were MFC based, I want to use console. :)
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Its not really such a surprise that they cannot be imitated in C++ (without WindowsAPI). C++ itself, remember, is just a few keywords like if, and switch. The origional C/C++ libraries were designed with portability in mind. They assume an absolute MINIMUM about the system. The idea of there being other programs wanting to pretend to be the user, and faking out your program is not something of value in the origional set of libraries.
Enter the WindowsAPI, which was designed without portability in mind. Thus if the feature should be in windows, it will be in the WindowsAPI.
As for the VB commands... all they do is call the WindowsAPI calls for you... nothing C++ with windows features can not do.
Enter the WindowsAPI, which was designed without portability in mind. Thus if the feature should be in windows, it will be in the WindowsAPI.
As for the VB commands... all they do is call the WindowsAPI calls for you... nothing C++ with windows features can not do.
ASKER
Rick,
I see what you're saying... and I agree totally. I just wish that using the WindowsAPI were as simple as two VB lines :)
I see what you're saying... and I agree totally. I just wish that using the WindowsAPI were as simple as two VB lines :)
>>> a surprise that they cannot be imitated in C++ (without WindowsAPI)
Rick, i couldn't reproduce the results of these VB comands using the full API. Even the SendKeys function from the link above isn't equal as it doesn't start the program by ShellExecute or CreateProcess but by entering key inputs to the 'Run' prompt of the Windows Start menu. (the disadvantage of this is that the user may interfere wth own key inputs as you need to have long timeouts between different inputs.) Very probably, i could do it using a COM approach but it was a little bit frustrating that with native WINAPI and hundreds of statements three is less than with 2 VB script calls,
Regards, Alex
Rick, i couldn't reproduce the results of these VB comands using the full API. Even the SendKeys function from the link above isn't equal as it doesn't start the program by ShellExecute or CreateProcess but by entering key inputs to the 'Run' prompt of the Windows Start menu. (the disadvantage of this is that the user may interfere wth own key inputs as you need to have long timeouts between different inputs.) Very probably, i could do it using a COM approach but it was a little bit frustrating that with native WINAPI and hundreds of statements three is less than with 2 VB script calls,
Regards, Alex
https://www.experts-exchange.com/questions/21115369/Redirect-stdin-to-pipe.html
Regards, Alex