search

Home  >  Q&A  >  body text

windows - 如何用Python模拟拖拽文件?

import win32con
import win32com
import win32clipboard
import win32gui
from ctypes.wintypes import LONG, HWND, UINT, WPARAM, LPARAM, FILETIME


point = win32gui.GetCursorPos()
hwnd = win32gui.WindowFromPoint(point)

# How to Send a file to HWND?
win32gui.SendMessage(hwnd, win32con.WM_DROPFILES , WPARAM(FILETIME("d:\\test.jpg")), 0)

如何用Python发送一个文件到接受文件拖拽的窗口?

PHP中文网PHP中文网2811 days ago378

reply all(0)I'll reply

No reply
  • Cancelreply