#Subclass woe
Hi,
Excuse my for butting in, but I am having a problem with subclassing which you
might be able to help me with:
I'm trying to make an MDI child window that is an MCIWnd (from the VFW kit).
The VFWDK registers a window class called "MCIWndClass".
The first thing I tried was something like this:
void CMainFrame::OnWindowMci()
{
DWORD dwWinStyle = WS_OVERLAPPEDWINDOW | WS_CHILD | WS_VISIBLE;
DWORD dwMciStyle = MCIWNDF_SHOWALL;
CMDIChildWnd* pWnd = new CMDIChildWnd;
pWnd->Create(MCIWND_WINDOW_CLASS, "Hello",
dwWinStyle | dwMciStyle);
}
This immediately gave me an assertion:
File wincore.cpp, Line 574, Assertion Failed!
Then I did this:
class CMDIChildMCIWnd : public CMDIChildWnd
{
protected:
static WNDPROC pfnSuperWndProc;
virtual WNDPROC* GetSuperWndProcAddr()
{ return &pfnSuperWndProc; }
};
WNDPROC CMDIChildWnd::pfnSuperWndProc = NULL;
void CMainFrame::OnWindowMci()
{
DWORD dwWinStyle = WS_OVERLAPPEDWINDOW | WS_CHILD | WS_VISIBLE;
DWORD dwMciStyle = MCIWNDF_SHOWALL;
CMDIChildMCIWnd* pWnd = new CMDIChildMCIWnd;
pWnd->Create(MCIWND_WINDOW_CLASS, "Hello",
dwWinStyle | dwMciStyle);
}
Now I get no assertion, but I don't get anything else either. The window
created is a vanilla do-nothing window. I checked it with Spy and its window
class is "MCIWndClass" (as it should be), but MFC is not passing messages
through to it.
How can I make it work?
Thanks,
Jim