본문 바로가기
IT-개발,DB

[개발/VC] IE 서브클래싱(subclass)

by SB리치퍼슨 2015. 1. 15.




[VC] IE 서브클래싱(subclass)


WNDPROC g_pOldProc;

static LRESULT CALLBACK MyIEProc(HWND, UINT, WPARAM, LPARAM);

 

 

void CBand::SubClass(HWND hWnd)

{

     // 64bit 환경을 위해서 SetWindowLongPtr() 사용

    g_pOldProc = (WNDPROC) SetWindowLongPtr(hwndOfCallingComponent, GWLP_WNDPROC, (LONG_PTR)IEProc);

}

 

LRESULT CALLBACK CBand::MyIEProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
 BOOL bRes = false;

 if (Message == WM_SIZE)
  bRes = g_pBand->SetPosition();
 if (Message == WM_ERASEBKGND)
  bRes  = false;

 if (bRes == false)
  return CallWindowProc (g_pOldProc, hwnd, message, wParam, lParam);

}

// 위치 체크 및 이동
BOOL CBand::SetPosition()
{
 RECT rc;

 ::GetClientRect(m_BandWnd, &rc);
 if (rc.top == 0)
 {
  // 작업내용
 }

 return false;
}

 

 

참고 :

http://0x68.com/shorts/subclass.asp

http://social.msdn.microsoft.com/Forums/en/vclanguage/thread/7cd4b8b5-1cd6-4661-9f29-e0569156cea4

http://www.cyworld.com/soinho/1291233

반응형

댓글