Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does C++ call windows Keyboard Code

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article will explain in detail how C++ calls the windows keyboard code. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.

1. What is the windows keyboard

Windows calls this ugly one the on-screen keyboard.

Windows calls this good-looking one the touch keyboard.

Of course, the screenshot above is the keyboard effect of win10. There are some differences on win7, so we won't take the screenshot here.

2. How to call these windows keyboards

It seems very simple, we use Spy++ to grab the window, find the process handle associated with the window handle, and then check which process and the command line information, and then we can happily execute the command to invoke the process.

On-screen keyboard process information:

Touch keyboard process information:

If you can adjust both keyboards smoothly, I can only tell you that you are blinded by your system.

3. Wei (ruan) to cause trouble

When the system version is greater than or equal to win10 10.0.14393.0, the touch keyboard you call TabTip.exe will not be displayed, which means that its internal implementation has changed.

Will you be surprised when you come here? isn't this a standard game? Why not without warning?

I can only say that you are stupid and naive. Microsoft's official website itself does not explain the correct posture of keyboard calls, that is to say, touching the keyboard is not open to you. Of course, the Internet is omnipotent, but some gods still find a way to reverse the way of touching the keyboard.

4. Specific code / / 4ce576fa-83dc-4F88-951c-9d0782b4e376DEFINE_GUID (CLSID_UIHostNoLaunch, 0x4CE576FA, 0x83DC, 0x4f88, 0x95, 0x1C, 0x9D, 0x07, 0x82, 0xB4, 0xE3, 0x76); / / 37c994e7_432b_4834_a2f7_dce1f13b834bDEFINE_GUID (IID_ITipInvocation, 0x37c994e7, 0x432b, 0x4834, 0xa2, 0xf7, 0xdc, 0xe1, 0xf1, 0x3b, 0x83, 0x4b); struct ITipInvocation: IUnknown {virtual HRESULT STDMETHODCALLTYPE Toggle (HWND wnd) = 0;}; namespace {constexpr auto kKeyboardWindowClass = L "IPTip_Main_Window" Constexpr auto kWindowParentClass = L "ApplicationFrameWindow"; constexpr auto kWindowClass = L "Windows.UI.Core.CoreWindow"; constexpr auto kWindowCaption = L "Microsoft Text Input Application"; constexpr auto kTabTipPath = L "C:\\ Program Files\\ Common Files\\ Microsoft Shared\\ ink\\ TabTip.exe"; constexpr auto kTabletTipSubKey = "Software\\ Microsoft\\ TabletTip"; constexpr auto kTabletTipOption = "EnableDesktopModeAutoInvoke";}

Call the on-screen keyboard

Bool ScreenKeyBoard::OpenOskKeyboard () {if (! PublicUtils::Process::FindProcess ("osk.exe"). Empty () {return true;} PVOID OldValue = NULL; / / 32-bit programs on 64-bit systems need to cancel the redirect to Syswow64 BOOL bRet = Wow64DisableWow64FsRedirection (& OldValue) to access the native system32 folder; ShellExecuteW (NULL, L "open", L "osk.exe", NULL, NULL, SW_SHOWNORMAL) If (bRet) {Wow64RevertWow64FsRedirection (OldValue); return true;} else {std::cerr

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report