Can any one help me in creating a Hidden window by extending CWnd class. I'm new to windows programming. I've tried creating one, but the issue is code breaks down when trying to register the window class or creating a window.
class HiddenWindow : public CWnd
{
public:
HiddenWindow();
~HiddenWindow();
protected:
afx_msg LRESULT DoNOOP(WPARAM wParam, LPARAM lParam);
DECLARE_MESSAGE_MAP()
};
This is my .cpp file
HiddenWindow::HiddenWindow()
{
CString wcn = ::AfxRegisterWndClass(NULL);//code fails here because of AfxGetInstanceHandle( )
BOOL created = this->CreateEx(0, wcn, _T("YourHiddenWindowClass"), 0, 0, 0, 0, NULL,HWND_MESSAGE,0);
}
HiddenWindow::~HiddenWindow()
{
}
BEGIN_MESSAGE_MAP(HiddenWindow, CWnd)
ON_MESSAGE(WM_USER + 1, DoNOOP)
END_MESSAGE_MAP()
LRESULT HiddenWindow::DoNOOP(WPARAM wParam, LPARAM lParam)
{
AfxMessageBox(_T("Test"));
return LRESULT(true);
}
I have done this in MFC by overriding the Create, the constructor is way too early Try :