// cCommonControl.cpp: implementation of the cCommonControl class.
//
//////////////////////////////////////////////////////////////////////

#include "cCommonControl.h"

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

cCommonControl::cCommonControl()
{

}

cCommonControl::~cCommonControl()
{
	cWindow::~cWindow();
}

BOOL cCommonControl::Create(DWORD dwExStyle, LPCTSTR lpClassName, 
	LPSTR lpWindowName, DWORD dwStyle, 
	int x, int y, int nWidth, int nHeight, 
	cWindow * _pParent, DWORD Id){

	hWnd = ::CreateWindowEx(dwExStyle, lpClassName, lpWindowName,
		dwStyle, x, y, nWidth, nHeight, _pParent->hWnd, (HMENU)Id,
		hInstance, NULL);

	// 서브 클래싱을 위한 윈도우 프로시져를 등록한다.
//	pThisObject = this;//????????
	if(hWnd){
		OldWindowProc = GetWindowLong(hWnd, GWL_WNDPROC);
		SetWindowLong(hWnd, GWL_USERDATA, (LONG)this);
		SetWindowLong(hWnd, GWL_WNDPROC, (LONG)DefaultProc);
	}

	return hWnd != NULL;
}

LRESULT cCommonControl::Proc(UINT uMsg, WPARAM wParam, LPARAM lParam){
#if _MSC_VER > 1100
	return CallWindowProc( WNDPROC(OldWindowProc), hWnd, uMsg, wParam, lParam);
#else
	return CallWindowProc( (int (__stdcall *)(void))(OldWindowProc), hWnd, uMsg, wParam, lParam);
#endif // _MSC_VER > 1100
}
