Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

CWindow::Create failing on Windows 7

29 views
Skip to first unread message

headkaze

unread,
Jun 4, 2011, 7:59:29 PM6/4/11
to
Hi,

I have a dll that I have working on my XP machine that is failing on my
Windows 7 machine. It is an ActiveX host for WMP. The problem is the window
creation is returning a NULL and GetLastError() is returning "0".

Here is part of the host class I inherit from. OnCreate is never called.

class CWMPHost : public CWindowImpl<CWMPHost, CWindow,
CWinTraits<WS_OVERLAPPEDWINDOW> >
{
public:
DECLARE_WND_CLASS_EX(NULL, 0, 0)

BEGIN_MSG_MAP(CWMPHost)
MESSAGE_HANDLER(WM_CREATE, OnCreate)
MESSAGE_HANDLER(WM_DESTROY, OnDestroy)
END_MSG_MAP()

LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL&
bHandled);
LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL&
bHandled);

I suppose I should show my basic Dll entry point code

CComModule _Module;

BEGIN_OBJECT_MAP(ObjectMap)
END_OBJECT_MAP()

BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID
/*lpReserved*/)
{
if (dwReason == DLL_PROCESS_ATTACH)
{
_Module.Init(ObjectMap, hInstance);
DisableThreadLibraryCalls(hInstance);
}
else if (dwReason == DLL_PROCESS_DETACH)
_Module.Term();

return TRUE;
}

And here is the line that returns NULL.

HWND hWnd = Create(NULL, CWindow::rcDefault, NULL, WS_OVERLAPPEDWINDOW, 0,
NULL);

Any help would be appreciated.


0 new messages