Sip Size


Description:
This bit of sample code is a handler for the WM_SETTINGCHANGE message. It shows you how you can monitor for the input panel being displayed, or changed, and set the size of your window accordingly.
 
Code:
LRESULT CMainWnd::OnSettingChanged(WPARAM wParam, LPARAM lParam) {

   if (wParam == SPI_SETSIPINFO) {
      RECT rect;
      SIPINFO sip;
      int nCmdHeight = CommandBar_Height(m_hWndCmd);

      SHSipInfo(SPI_GETSIPINFO, lParam, &sip, 0);

      MoveWindow(m_hWnd, sip.rcVisibleDesktop.left, sip.rcVisibleDesktop.top,
         sip.rcVisibleDesktop.right - sip.rcVisibleDesktop.left,
         sip.rcVisibleDesktop.bottom - sip.rcVisibleDesktop.top,
         TRUE);

      GetClientRect(m_hWnd, &rect);

      MoveWindow(m_hWndEdit, rect.left, nCmdHeight, 
         rect.right, rect.bottom - nCmdHeight, TRUE);

   }
   return 0;
}
 
Sample Usage:
 
n/a