调用文档
<p>对应版本企微下载 :
<a href="https://dldir1.qq.com/wework/work_weixin/WeCom_4.0.2.6026.exe">https://dldir1.qq.com/wework/work_weixin/WeCom_4.0.2.6026.exe</a></p>
<pre><code>只需要关心 jsonfunExport.dll
1. 3个回调函数为 __stdcall 约定,只有1个参数(char*类型的 json字符串, utf8编码 )
2. 3个调用函数 均为 __stdcall 约定 (char* 类型的参数 均为utf8编码)
调用3步走 :
第1步: 定义3个回调函数 __stdcall 约定, 都是一个参数
第2步: 导出SetContext ,SendCommand ,GetUserCommand 3个函数,调用 SetContext
设置回调函数,sdk目录, 调用后 休眠1秒
第3步: SendCommand 启动 企微 + 注入,完毕</code></pre>
<pre><code>vc,c++调用
c#调用 参考c++
#include &quot;../src/funExport.h&quot;
#pragma comment(lib, &quot;../src/jsonfunExport.lib&quot;)
第1步: 定义3个回调函数, 3个回调函数都是一个参数, pstr 就是 数据json
void __stdcall OnSign(const char * pstr)
{
101 有 新的企微登录
102查询登录号详细信息 都会触发进来
103登出(企微登出流程是 退出进程 然后新开进程, sdk用户 需 调用附加到新开企微方法
}
void __stdcall OnRecvmsg(const char* pstr)
{ //收 ,发消息 触发进来
wstring st = UTF8216(pstr);
}
void __stdcall OnMultifun(const char* pstr)
{/ /多功能回调函数,手机号搜索微信好友,
群二维码, 欢迎语列表, 新好友申请-列表获取
点击聊天人 等等 都会触发进来
wstring st = UTF8216(pstr);
}
第2步: 设置回调函数,sdk目录
SetContext(&quot;D:\\sdk-all\\Release&quot;, OnSign, OnRecvmsg, OnMultifun, &quot;{111222333}&quot;);
Sleep(1500);//休眠1秒
第3步: 启动 企微 + 注入
string sjson = &quot;{
&quot;qwpath&quot;: &quot;C:\\Program Files(x86)\\WXWork\\WXWork.exe&quot;,
&quot;alias&quot;: &quot;t0&quot;,
&quot;cefkaiguan &quot;: 1,
&quot;type&quot;: 300
}&quot;;
SendCommand(1234, sjson.c_str());
结束</code></pre>
<pre><code>Python调用
from ctypes import *
import ctypes
import time
only_pid = []
dll = ctypes.windll.LoadLibrary('.//jsonfunExport.dll')
sdkpath = ctypes.c_char_p('.//'.encode('UTF8')) # sdk相对路径
key1 = ctypes.c_char_p('{111112223333}'.encode('UTF8')) # sdk授权key
jsonstr = ctypes.c_char_p('{
&quot;qwpath&quot;: &quot;C:\\Program Files(x86)\\WXWork\\WXWork.exe&quot;,
&quot;alias&quot;: &quot;t0&quot;,
&quot;cefkaiguan &quot;: 1,
&quot;type&quot;: 300
}'.encode('UTF8')) # sdk授权key
@WINFUNCTYPE(None, c_char_p)
def OnSign(pdata):
print('1', pdata)
@WINFUNCTYPE(None, c_char_p)
def OnRecvmsg(pdata):
print('2', pdata)
@WINFUNCTYPE(None, c_char_p)
def OnMultifun(pdata):
print('3', pdata)
dll.SetContext(sdkpath,OnSign, OnRecvmsg, OnMultifun, key1)
time.sleep(2)
a = input('回车启动')
npid = dll.SendCommand(jsonstr)
print(npid)</code></pre>
<pre><code>Electron开发 node js 调用
外部函数接口 FFI 的方式 https://zhuanlan.zhihu.com/p/32134367
extern &quot;C&quot; _stdcall 的约定 会使dll 导出的函数名字前面加一个下划线,
名字后面加一个@再加上参数的字节数。
如果 SetContext的名字 无法导出函数, 使用 _SetContext@24
const libWxCmd = ffi.Library(cmdPath, {
'_SetContext@20': ['void', ['string', 'pointer', 'pointer', 'pointer','string']],
'_SendCommand@4': ['int', ['string']],
'_GetUserCommand@4': ['string', ['string']],
})</code></pre>
<pre><code>易语言调用
1. 参考 调用步骤 , 定义对应的3个 回调函数 , SetContext, SendCommand, GetUserCommand函数
2. 函数 参数 (const char* pstr ) 统一 定义为 字节集, utf8编码
2. BOOL 定义为 int类型</code></pre>