Subclass woe
Hi Jim,
> 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|swMciStyle);
> }
> This immediately gave me an assertion:
> File wincore.cpp, Line 574, Assertion Failed!
You could also have overidden the CWnd::PreCreateWindow() and changed the
lpszClass to "MCIWndClass" and the style to WS_OVERLAPPED | WS_CHILD |
WS_VISIBLE in there.
> 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.
Maybe what you want is to use the MCIWndClass as the View and not the
frame window. Are you using Doc/View?
Sincerely,
Brian Ku
-Microsoft Developer Support