zoukankan      html  css  js  c++  java
  • RunMessageScript from spy

    1、执行函数

    void CComputerRobotTestDlg::RunMessageScript(CString str)
    {
    // <00055> 00020540 S message:0x07F3 [用户定义:WM_USER+1011] wParam:00000000 lParam:00000000
    CString sInput = str;
    int pos1, pos2;
    // get wnd handle
    pos1 = sInput.Find(_T("> ")) + _tcslen(_T("> "));;
    CString strHWND = sInput.Mid(pos1, _tcslen(_T("00020540")));

    pos1 = sInput.Find(_T("> ")) + _tcslen(_T("> 00020540 "));
    CString strFun = sInput.Mid(pos1, 1);

    pos1 = sInput.Find(_T("message:")) + _tcslen(_T("message:"));
    CString strmessage = sInput.Mid(pos1, _tcslen(_T("0x07F3")));

    pos1 = sInput.Find(_T("wParam:")) + _tcslen(_T("wParam:"));
    CString strwParam = sInput.Mid(pos1, _tcslen(_T("00000000")));

    pos1 = sInput.Find(_T("lParam:")) + _tcslen(_T("lParam:"));
    CString strlParam = sInput.Mid(pos1, _tcslen(_T("00000000")));

    HWND hWnd = NULL;
    DWORD dMsg;
    WPARAM wParam;
    LPARAM lParam;

    #ifdef _UNICODE
    hWnd = (HWND)wcstoul(strHWND, NULL, 16);
    dMsg = (DWORD)wcstoul(strmessage, NULL, 16);
    wParam = (WPARAM)wcstoul(strwParam, NULL, 16);
    lParam = (LPARAM)wcstoul(strlParam, NULL, 16);
    #else
    hWnd = (HWND)strtoul(strHWND, NULL, 16);
    dMsg = (DWORD)strtoul(strmessage, NULL, 16);
    wParam = (WPARAM)strtoul(strlParam, NULL, 16);
    lParam = (LPARAM)wcstoul(strlParam, NULL, 16);
    #endif

    if (_T("S")==strFun)
    {
    ::SendMessage(hWnd, dMsg, wParam, lParam);
    }
    else if (_T("P")==strmessage)
    {
    ::PostMessage(hWnd, dMsg, wParam, lParam);
    }

    }

    2、调用函数

    CStdioFileEx file;
    if (file.Open(_T("c:\\tmp.txt"), CFile::modeRead))
    {
    CString str;
    while (file.ReadString(str))
    {
    RunMessageScript(str);
    }
    }

      

  • 相关阅读:
    3.3 React Hooks
    ES6高阶函数
    ES6扩展运算符
    4.0不用npm,cnpm。使用yarn包启动react项目
    4.3 webpack打包学习
    4.2 Node.js模块化教程
    4.1React模块化
    vue组件化开发
    js箭头函数
    weblogic_exploit
  • 原文地址:https://www.cnblogs.com/carl2380/p/2290412.html
Copyright © 2011-2022 走看看