调用文档
<p>下载地址 :
支持企微版本: 4.0.2.6 || 3.1.18
下载地址: <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>
<p><a href="https://dldir1.qq.com/wework/work_weixin/WeCom_3.1.18.6007.exe">https://dldir1.qq.com/wework/work_weixin/WeCom_3.1.18.6007.exe</a></p>
<pre><code>只需要关心 funExport.dll
1. 4个回调函数为 __stdcall 约定,只有1个参数( json字符串, utf8编码 )
2. 所有 能调用的函数 均为 __stdcall 约定 (extern &quot;C&quot; __stdcall ,char* 类型的参数 均为gbk编码)
调用3步走 :
第1步: 定义4个回调函数 __stdcall 约定, 4个回调函数都是一个参数, pstr参数就是 数据json
第2步: 调用 SetContext 设置回调函数,sdk目录, 调用后 休眠1秒
第3步: StartQw启动 企微 + 注入,完毕</code></pre>
<pre><code>vc,c++调用
c#调用 参考c++
#include &quot;../src/funExport.h&quot;
#pragma comment(lib, &quot;../src/funExport.lib&quot;)
第1步: 定义4个回调函数, 4个回调函数都是一个参数, pstr 就是 数据json
void __stdcall OnSign(const char * pstr)
{
101 有 新的企微登录
102查询登录号详细信息 都会触发进来
103登出(企微登出流程是 退出进程 然后新开进程, sdk用户 需 调用附加到新开企微方法
}
void __stdcall OnRecvmsg(const char* pstr)
{ //收 ,发消息 触发进来
wstring st = UTF8216(pstr);
}
void __stdcall OnGetFirend(const char* pstr)
{ //没有用, 保留,这个回调不需要理会
}
void __stdcall OnMultifun(const char* pstr)
{/ /多功能回调函数,手机号搜索微信好友,
群二维码, 欢迎语列表, 新好友申请-列表获取
点击聊天人 等等 都会触发进来
wstring st = UTF8216(pstr);
}
第2步: 设置回调函数,sdk目录
SetContext(&quot;D:\\sdk-all\\Release&quot;, OnSign, OnRecvmsg, OnGetFirend, OnMultifun, &quot;{111222333}&quot;);
Sleep(1500);//休眠1秒
第3步: 启动 企微 + 注入
int npid = StartQw(&quot;C:\\Program Files (x86)\\WXWork\\WXWork.exe&quot;, &quot;_t0&quot;, 1); //从沙盒目录 多开启动
int npid = StartQw(&quot;C:\\Program Files (x86)\\WXWork\\WXWork.exe&quot;, &quot;null&quot;, 1); //不多开 从默认目录启动
结束
</code></pre>
<pre><code>Python调用
from ctypes import *
import ctypes
import time
only_pid = []
dll = ctypes.windll.LoadLibrary('.//funExport.dll')
qwpath = ctypes.c_char_p('C:\Program Files (x86)\WXWork\WXWork.exe'.encode('gbk'))
sdkpath = ctypes.c_char_p('.//'.encode('gbk')) # sdk相对路径
para = ctypes.c_char_p('_t0'.encode('gbk')) # 沙盒启动别名
key1 = ctypes.c_char_p('{111112223333}'.encode('gbk')) # 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 OnGetFirend(pdata):
@WINFUNCTYPE(None, c_char_p)
def OnMultifun(pdata):
print('4', pdata)
dll.SetContext(sdkpath,OnSign, OnRecvmsg, OnGetFirend, OnMultifun, key1)
time.sleep(2)
a = input('回车启动')
npid = dll.StartQw(qwpath, para, 1)
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@24': ['void', ['string', 'pointer', 'pointer', 'pointer','pointer','string']],
'_StartQw@12': ['int', ['string', 'string', 'int']],
})
以下是导出函数对应的名字
_StartQw@12
_AttachQw@4
_GetAllLab@4
_GetAllRoomInfo1@8
_GetAllRoomInfo@4
_GetAllUserCache1@8
_GetAllUserCache@4
_GetAllWxFri@4
_GetGroupQrcode@8
_GetLabUserList@8
_GetOneRoomInfo@8
_GetOneUserCache@8
_GetQrCode@4
_GetRoomMember@8
_GetState@4
_GetVerifyFriend@4
_GetWelcomeList@4
_GroupKick@12
_GroupPull@12
_ReadQwRegPath@0
_RelayMsg@12
_SearchPhone@8
_SendAt@16
_SendCard@20
_SendFile@12
_SendGif@12
_SendImg@12
_SendLink@24
_SendMp4@12
_SendNotice@12
_SendSmall1@12
_SendSmall@40
_SendText@12
_SetContext@24
_SetGroupAdmin@16
_SetGroupInvite@12
_SetGroupMaster@12
_SetGroupName@12
_SetGroupRemarks@12
_SetGroupWelcome@12
_SetMark@20
_SetUpdate@8
_TerminatePr@4
_TxlisFinish@4
_cdn_SendFile@28
_cdn_SendMsg@32
_AddLab1@12
_AddLab2@12
_AddWelcomeImg@16
_AddWelcomeText@8
_Addfri1@16
_Addfri2@16
_Addfri3@12
_Addfri@16
_AllowFriend@12
_CheckConnect@4
_ClosePipe@4
_CrashTest@0
_CreateGroup@8
_CreateLab@12</code></pre>
<pre><code>易语言调用
1. 参考 调用步骤 , 定义对应的 4个 回调函数 , SetContext, StartQw 函数
2. 函数 参数 (const char* pstr ) 统一 定义为 字节集, gbk编码
2. BOOL 定义为 int类型</code></pre>