I want to set SublimeText's main window to topmost using API SetWindowPos,and my code is:
- Code: Select all
import sublime, sublime_plugin
from ctypes import *
user32 = windll.user32
classname = "PX_WINDOW_CLASS"
hWin = user32.FindWindowA(classname,None)
class SetWindowTopCommand(sublime_plugin.TextCommand):
def run(self, view):
user32.SetWindowPos(hWin,-1,0,0,0,0,3)
It can work when I use
- Code: Select all
view.run_command("set_window_top")
It is strange that the hot key can work when I open and save SetWindowTop.py again without any changes.
I need some help to know why,please?