Autohotkey 调用 Total Commander内部命令

#NoEnv 
#NoTrayIcon 
#SingleInstance force 
 
;~ Send {Alt Down} 
;~ Sleep, 20 
#IfWinActive ahk_class TTOTAL_CMD
#0::SendTCUserCommand("em_To7zip") 
return
;~ WinWait, ahk_class AutoIt v3 GUI 
;~ Send {Alt Up} 
 
SendTCUserCommand(Command) ; string 
{ 
  If  Command <> 
    { 
      VarSetCapacity(CopyDataStruct, 3*A_PtrSize, 0)  ; Set up the structure's memory area. 
      dwData := Asc("E") + 256 * Asc("M") 
      NumPut(dwData, CopyDataStruct, 0) 
      cbData := StrPutVar(Command, Command, "cp0") 
      NumPut(cbData, CopyDataStruct, A_PtrSize)  ; OS requires that this be done. 
      NumPut(&Command, CopyDataStruct, 2*A_PtrSize)  ; Set lpData to point to the string itself. 
      SendMessage, 0x4a, 0, &CopyDataStruct,, ahk_class TTOTAL_CMD ; 0x4a is WM_COPYDATA. Must use Send not Post. 
    } 
} 
 
StrPutVar(string, ByRef var, encoding) 
{ 
    ; Ensure capacity. 
    VarSetCapacity( var, StrPut(string, encoding) * ((encoding="utf-16"||encoding="cp1200") ? 2 : 1) ) 
    ; Copy or convert the string. 
    return StrPut(string, &var, encoding) 
}

FROM:http://ahk8.com/thread-3677.html (这个不支持Unicode版的AHK)

http://forum.ru-board.com/topic.cgi?forum=5&topic=45288&start=1030&limit=1&m=1 (支持Unicode)

转载于:https://www.cnblogs.com/cnsealine/p/4197336.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值