Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Crossin的编程教室
ComWeChatRobot
提交
46f1c29b
C
ComWeChatRobot
项目概览
Crossin的编程教室
/
ComWeChatRobot
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
ComWeChatRobot
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
46f1c29b
编写于
4月 14, 2022
作者:
L
ljc545w
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
优化停止服务接口
上级
bdee01c0
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
16 addition
and
16 deletion
+16
-16
CWeChatRobot/pch.cpp
CWeChatRobot/pch.cpp
+3
-2
Release/CWeChatRobot.exe
Release/CWeChatRobot.exe
+0
-0
wxRobot.py
wxRobot.py
+13
-14
未找到文件。
CWeChatRobot/pch.cpp
浏览文件 @
46f1c29b
...
...
@@ -174,15 +174,16 @@ DWORD StartRobotService() {
}
DWORD
StopRobotService
()
{
DWORD
cpid
=
GetCurrentProcessId
();
if
(
!
hProcess
)
return
1
;
return
cpid
;
DWORD
wxPid
=
GetWeChatPid
();
CheckFriendStatusFinish
();
StopReceiveMessage
();
RemoveDll
(
wxPid
);
ZeroMemory
((
wchar_t
*
)
SelfInfoString
.
c_str
(),
SelfInfoString
.
length
()
*
2
+
2
);
CloseHandle
(
hProcess
);
return
0
;
return
cpid
;
}
wstring
GetComWorkPath
()
{
...
...
Release/CWeChatRobot.exe
浏览文件 @
46f1c29b
无法预览此类型文件
wxRobot.py
浏览文件 @
46f1c29b
...
...
@@ -64,19 +64,16 @@ class WeChatRobot():
self
.
myinfo
=
myinfo
return
self
.
myinfo
# 这个可以再更新一下,CStopRobotService返回COM组件的pid
def
StopService
(
self
):
import
psutil
self
.
StopReceiveMessage
()
status
=
self
.
robot
.
CStopRobotService
()
pids
=
psutil
.
pids
()
for
pid
in
pids
:
p
=
psutil
.
Process
(
pid
)
process_name
=
p
.
name
()
if
process_name
==
'CWeChatRobot.exe'
:
p
.
kill
()
break
return
status
cpid
=
self
.
robot
.
CStopRobotService
()
try
:
cprocess
=
psutil
.
Process
(
cpid
)
cprocess
.
kill
()
except
psutil
.
NoSuchProcess
:
pass
return
cpid
def
GetAddressBook
(
self
):
try
:
...
...
@@ -218,17 +215,19 @@ def ReceiveMessageCallBack(robot,message):
sender
=
wxSender
[
'wxNickName'
]
if
wxSender
[
'wxNickName'
]
!=
'null'
else
message
[
'sender'
]
if
'@chatroom'
in
message
[
'sender'
]:
wxUser
=
robot
.
GetWxUserInfo
(
message
[
'wxid'
])
print
(
"来自 {} {}
"
.
format
(
sender
,
wxUser
[
'wxNickName'
]))
print
(
"来自 {} {}
,type {}"
.
format
(
sender
,
wxUser
[
'wxNickName'
,
message
[
'type'
]
]))
else
:
print
(
"来自 {}
"
.
format
(
sender
))
print
(
"来自 {}
,type {}"
.
format
(
sender
,
message
[
'type'
]
))
if
message
[
'type'
]
==
1
:
print
(
message
[
'message'
])
elif
message
[
'type'
]
==
3
:
print
(
message
[
'message'
])
print
(
message
[
'filepath'
])
elif
message
[
'type'
]
==
49
:
print
(
message
[
'message'
])
if
not
message
[
'filepath'
]:
print
(
message
[
'filepath'
])
else
:
print
(
message
[
'
type'
],
message
[
'
message'
])
print
(
message
[
'message'
])
def
test_SendText
():
import
os
...
...
@@ -284,4 +283,4 @@ def test_ReceiveMessage():
wx
.
StopService
()
if
__name__
==
'__main__'
:
test_ReceiveMessage
()
\ No newline at end of file
test_ReceiveMessage
()
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录