zoukankan      html  css  js  c++  java
  • 利用 AttachThreadInput 和 WM_INPUTLANGCHANGEREQUEST 消息改变其它进程的输入状态

    https://blog.csdn.net/kaizi318/article/details/7766283?utm_medium=distribute.pc_relevant_bbs_down.none-task-blog-baidujs-1.nonecase&depth_1-utm_source=distribute.pc_relevant_bbs_down.none-task-blog-baidujs-1.nonecase 

     https://stackoverflow.com/questions/24319987/delphi-simulate-key-press-for-automation 

    https://www.it1352.com/2041624.html

    c# AttachThreadInput  WM_INPUTLANGCHANGEREQUEST

    HWND hWnd = GetForegroundWindow();
    ASSERT(IsWindow(hWnd))
    
    // Get Target Thread ID and Attach Thread Input
    DWORD ProcID;
    DWORD ThreadID = GetWindowThreadProcessId(hWnd, &ProcID);
    AttachThreadInput(GetCurrentThreadId(), ThreadID, TRUE);
    
    // Get Target Window
    HWND hWndFocus = GetFocus();
    
    // Post Input Messages 
    ASSERT(IsWindow(hWndFocus));
    
    // Change Input Language
    PostMessage(hWndFocus, WM_INPUTLANGCHANGEREQUEST, (WPARAM)TRUE, (LPARAM)g_hklRPC);   // Use Language ID 0x0804(Chinese PRC)
    
    // Detach Thread Input
    AttachThreadInput(GetCurrentThreadId(), ThreadID, FALSE);
  • 相关阅读:
    [CF1462F] The Treasure of The Segments
    [CF1466E] Apollo versus Pan
    SYZOJ 搭建 Note
    [CF1476D] Journey
    [CF1476E] Pattern Matching
    [CF1494D] Dogeforces
    [CF1383B] GameGame
    [CF1383A] String Transformation 1
    [CF1453D] Checkpoints
    [CF1453C] Triangles
  • 原文地址:https://www.cnblogs.com/chinasoft/p/14805343.html
Copyright © 2011-2022 走看看