천객만래 [千客萬來] (It has an interminable succession of visitors)





VC++ Source Code
// Subclassing.cpp : Defines the entry point for the application.
// #include "stdafx.h"#include <tchar.h> 
#define STRSAFE_NO_DEPRECATE 
WNDPROC g_pOldProc;
char szAppName[]="Subclassing Demo"; 
LRESULT CALLBACK SubclassProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{   
 if(uMsg == WM_CLOSE)    
 {        
  DestroyWindow(hWnd);        
  PostQuitMessage(0);        
  return 0;    
 }    
 return CallWindowProc(g_pOldProc, hWnd, uMsg, wParam, lParam);

int APIENTRY _tWinMain(HINSTANCE hInstance,                     
 HINSTANCE hPrevInstance,                     
 LPSTR     lpCmdLine,                     
 int       nCmdShow)
{    
 HWND hEdit = 0;        
 /*Create a top-level edit control*/    
 hEdit = CreateWindowEx(                0, 
   _T("EDIT"), _T(szAppName),                
   WS_OVERLAPPEDWINDOW,                 
   CW_USEDEFAULT,                 
   CW_USEDEFAULT,                 
   200,                 
   100,                 
   0,                 
   0,                 
   hInstance,                 
   0);        
 g_pOldProc = (WNDPROC)SetWindowLong(hEdit, GWL_WNDPROC, PtrToLong(SubclassProc));     
 ShowWindow(hEdit, SW_SHOWNORMAL);     
 
 MSG msg;    
 
 while(GetMessage(&msg, 0, 0, 0))    
 {        
  TranslateMessage(&msg);        
  DispatchMessage(&msg);    
 }    
 
 return 0;
}

Posted by SB패밀리




[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

Posted by SB패밀리

[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

Posted by SB패밀리

VC++ Source Code
// Subclassing.cpp : Defines the entry point for the application.
// #include "stdafx.h"#include <tchar.h>
#define STRSAFE_NO_DEPRECATE
WNDPROC g_pOldProc;
char szAppName[]="Subclassing Demo";
LRESULT CALLBACK SubclassProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{  
 if(uMsg == WM_CLOSE)   
 {       
  DestroyWindow(hWnd);       
  PostQuitMessage(0);       
  return 0;   
 }   
 return CallWindowProc(g_pOldProc, hWnd, uMsg, wParam, lParam);

int APIENTRY _tWinMain(HINSTANCE hInstance,                    
 HINSTANCE hPrevInstance,                    
 LPSTR     lpCmdLine,                    
 int       nCmdShow)
{   
 HWND hEdit = 0;       
 /*Create a top-level edit control*/   
 hEdit = CreateWindowEx(                0,
   _T("EDIT"), _T(szAppName),               
   WS_OVERLAPPEDWINDOW,                
   CW_USEDEFAULT,                
   CW_USEDEFAULT,                
   200,                
   100,                
   0,                
   0,                
   hInstance,                
   0);       
 g_pOldProc = (WNDPROC)SetWindowLong(hEdit, GWL_WNDPROC, PtrToLong(SubclassProc));    
 ShowWindow(hEdit, SW_SHOWNORMAL);    
 
 MSG msg;   
 
 while(GetMessage(&msg, 0, 0, 0))   
 {       
  TranslateMessage(&msg);       
  DispatchMessage(&msg);   
 }   
 
 return 0;
}

Posted by SB패밀리