win32gui 상용 인터페이스

690 단어 Python
 
import win32gui

#       
win32gui.SetForegroundWindow(hwnd)

#        
hwnd = win32gui.GetForegroundWindow()

#      
GetWindowText(hwnd)

#           
hwnd = win32gui.FindWindow(None, "C:\Windows\system32\cmd.exe")


#           
#! /usr/bin/env python
# -*- coding: utf-8 -*-
 
from win32gui import *
 
titles = set()
 
def foo(hwnd,nouse):
 
  #             ,         
 
  if IsWindow(hwnd) and IsWindowEnabled(hwnd) and IsWindowVisible(hwnd):
    titles.add(GetWindowText(hwnd))
 
#www.iplaypy.com
 
EnumWindows(foo, 0)
lt = [t for t in titles if t]
lt.sort()
 
for t in lt:
  print t

 
 
 
 
 

좋은 웹페이지 즐겨찾기