[PythonCE] One other question: detecting SIP

Luke Dunstan coder_infidel at hotmail.com
Tue Feb 27 10:56:20 CET 2007


----- Original Message ----- 
From: "Progor" <dpwhittaker at gmail.com>
To: <pythonce at python.org>
Sent: Tuesday, February 27, 2007 2:15 PM
Subject: [PythonCE] One other question: detecting SIP


>
> Is it possible to detect whether the SIP (software keyboard) is displayed 
> or
> not?  It would be nice to resize my main frame when the SIP is in the way.

You need to do the following:

1. Allocate a SHACTIVATEINFO structure
2. When your main window receives a WM_SETTINGCHANGE message, call 
SHHandleWMSettingChange() passing the structure
3. When you receive WM_ACTIVATE, call SHHandleWMActivate() passing the same 
structure

The resizing of your window will now be done for you.

Luke

class SHACTIVATEINFO(ctypes.Structure):
    _fields_ = [
        ('cbSize', DWORD),
        ('hwndLastFocus', HWND),
        ('flags', UINT),
    ]

    def __init__(self):
        ctypes.Structure.__init__(self)
        self.cbSize = ctypes.sizeof(self)

    aygshell = ctypes.cdll.aygshell

    SHHandleWMSettingChange = aygshell[83]
    SHHandleWMSettingChange.argtypes = [ HWND, WPARAM, LPARAM, 
ctypes.POINTER(SHACTIVATEINFO) ]
    SHHandleWMSettingChange.restype = BOOLRESULT

    SHHandleWMActivate = aygshell[84]
    SHHandleWMActivate.argtypes = [ HWND, WPARAM, LPARAM, 
ctypes.POINTER(SHACTIVATEINFO), DWORD ]
    SHHandleWMActivate.restype = BOOLRESULT



More information about the PythonCE mailing list