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

'windowproc'에 해당되는 글 2건

  1. 2015.01.15 [개발/VC++] SubClassing 하는 방법
  2. 2011.01.18 [VC++] SubClassing 하는 방법





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++ 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패밀리