如何向其他程序发送控制命令

global type str_systemtime from structure
    integer        iyear
    integer        imonth
    integer        idayofweek
    integer        iday
    integer        ihour
    integer        iminute
    integer        isecond
    integer        imilliseconds
end type

global type point from structure
    long        x
    long        y
end type
 Function ulong FindWindow(ref string lpClassName,ref string lpWindowName) LIBRARY "user32.dll" ALIAS FOR "FindWindowA"
 Function ulong SetFocus(ulong hwnd) LIBRARY "user32.dll"
 Function ulong GetClassName(ulong hwnd,ref string lpClassName,ulong nMaxCount) LIBRARY "user32.dll" ALIAS FOR "GetClassNameA"
 Function ulong GetCursorPos(ref POINT lpPoint) LIBRARY "user32.dll"
 Function ulong WindowFromPoint(ulong xPoint,ulong yPoint) LIBRARY "user32.dll"
 Function ulong ClientToScreen(ulong hwnd,ref POINT lpPoint) LIBRARY "user32.dll"
 Function boolean EnumChildWindows(ulong hWndParent,ulong lpEnumFunc,ulong lParam) LIBRARY "user32.dll"
 Function ulong GetWindowText(ulong hwnd,ref string lpString,ulong cch) LIBRARY "user32.dll" ALIAS FOR "GetWindowTextA"
 Function ulong GetWindow(ulong hwnd,ulong wCmd) LIBRARY "user32.dll"
 Function Boolean SetSystemTime(str_SystemTime str_MyTime) Library "Kernel32.dll"
global function integer setdate (integer year, integer month, integer day);str_SystemTime str_MyTime
str_MyTime.iYear=year
str_MyTime.imonth=month
str_MyTime.iDay=day
str_mytime.ihour=hour(now())
str_mytime.iminute=minute(now())
str_mytime.isecond=second(now())


if SetSystemTime(ref str_MyTime) then
   return 1
else
  return -1
end if
end function


ld_currq=today()
if setdate(2006,3,26)=-1 then
    MessageBox("提示","系统日期设置失败!")
    return
end if   
if run('C:/Program Files/BS/管理系统/cyqt.exe',Minimized!)=1 then  
   long GW_CHILD = 5
    long GW_HWNDNEXT = 2
    long WM_GETTEXT = 13
    long tWnd
    long bWnd
    String lpClassName
    Long   RetVal
    String  mName ,ls_class
    mName="试用版本提示"
    setnull(lpclassname)
    int i=0
    do
        sleep(100)
        i=i+1
        tWnd=FindWindow(lpclassname,mName)
        if i>=20 then  exit
        if twnd<>0 then exit   
       
    loop while 1=1
   
    if setdate1(ld_currq)=-1 then
        MessageBox("提示","恢复系统日期失败!")
        return
   end if
    if twnd=0 then return
    bWnd=GetWindow(tWnd,GW_CHILD)
    Do While bWnd <> 0
       lpClassName=Space(256)
       RetVal=GetClassName(bWnd, lpClassName, 256)
        ls_class=space(50)
       GetWindowText(bwnd,ls_class,50)
        if ls_class='确定' then
          Send(tWnd, 273, 0,bwnd)
          exit
        end if   
        bWnd=GetWindow(bWnd, GW_HWNDNEXT)
    Loop
end if
halt
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值