File: scitedirector.py

package info (click to toggle)
ipython 0.13.1-2%2Bdeb7u1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 15,752 kB
  • sloc: python: 69,537; makefile: 355; lisp: 272; sh: 80; objc: 37
file content (26 lines) | stat: -rw-r--r-- 780 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import win32api
import win32gui
import win32con

import struct
import array

def findWindows():
    ret = []
    sdi = win32api.RegisterWindowMessage("SciTEDirectorInterface")
    w = win32gui.GetWindow(win32gui.GetDesktopWindow(), win32con.GW_CHILD)
    while w:
        res = win32gui.SendMessage(w, sdi, 0, 0)
        if res == sdi:
            ret.append(w)
        w = win32gui.GetWindow(w, win32con.GW_HWNDNEXT)

    return ret

def sendCommand(w, message):
    CopyDataStruct = "IIP"
    char_buffer = array.array('c', message)
    char_buffer_address = char_buffer.buffer_info()[0]
    char_buffer_size = char_buffer.buffer_info()[1]
    cds = struct.pack(CopyDataStruct, 0, char_buffer_size, char_buffer_address)
    win32gui.SendMessage(w, win32con.WM_COPYDATA, 0, cds)