Re: One other question: detecting SIP

"Luke Dunstan" <[email protected]>
Newsgroups gmane.comp.python.windows-ce
Message-ID <[email protected]>
----- Original Message ----- 
From: "Progor" <[email protected]>
To: <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.