python调用pb

python调用pb

# pip install pypiwin32

import win32api

import win32gui

# 读取系统窗口列表信息

# 按窗口名称获取窗口句柄

# 给PB开发的应用窗口发送一个参数1,通知执行结束

# PB接收,other事件使用pbm_other,

# string ls_tmp

# long ll_return

# if message.number=1600 then

#   mle_1.text=string(wparam)

#   mle_2.text=string(lparam)

# end if



#查找pb窗口标题

# hWndList = []

# win32gui.EnumWindows(lambda hWnd, param: param.append(hWnd), hWndList)

# for hwnd in hWndList:

#     clsname = win32gui.GetClassName(hwnd)

#     title = win32gui.GetWindowText(hwnd)

#     if (title.find('pycallpb') >= 0):

#         win32api.SendMessage(hwnd, 1600, 21, 11)

#         print(hwnd)



#按指定句柄找,pb中Handle(this) 得到hwnd=203218

win32api.SendMessage(1182656, 1600, 21, 11)


print('ok')

你可能感兴趣的:(pb,python,python,windows,开发语言)