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;
}
'IT-개발,DB' 카테고리의 다른 글
[개발/VC++] WebBrowser Control 이벤트 연결 - C++ (0) | 2015.01.22 |
---|---|
[ASP.NET] [GDI+] LineChart 그래프를 만들어보자. (ASP.NET using C#) (0) | 2015.01.22 |
[개발/VC] IE 서브클래싱(subclass) (0) | 2015.01.15 |
[개발/javascript] 미디어 플레이어 객체 제어하기 (0) | 2015.01.14 |
[개발/javascript] 미디어 플레이어의 화면구조 (0) | 2015.01.03 |
댓글