i was going into similar problem, i used to create the window and then it froze, then i realized it was a threading issue, anyway here is how it worked for me

Code:
#include <afx.h>
#include <windows.h>
#include <windowsx.h>
#include <afxwin.h>

#define WinClass _T("UrWinClass")

LRESULT WINAPI WinParser(HWND handle, UINT message, WPARAM wParam, LPARAM parameters) {
	switch (message) {
	default:
		return DefWindowProc(handle, message, wParam, parameters);
	case WM_COMMAND:
		break;
	case WM_PAINT:
		break;
	case WM_DESTROY:
		break;
	case WM_COPYDATA:
		break;
	}
	return 0;
}

class Win : public CWinThread {
public:
	Win() {};
	~Win() {};
private:
	HACCEL Table;
public:
	virtual int Run() {
		MSG Msg;
		while (GetMessage(&Msg, NULL, 0, 0)) {
			if (!TranslateAccelerator(Msg.hwnd, Table, &Msg)) {
				TranslateMessage(&Msg);
				DispatchMessage(&Msg);
			}
		}
		return 0;
	};
	virtual BOOL InitInstance() {
		WNDCLASSEX WinC;
		WinC.hInstance		= NULL;
		WinC.lpszClassName	= WinClass;
		WinC.lpfnWndProc	= WinParser;
		WinC.style			= CS_HREDRAW | CS_VREDRAW;
		WinC.hIcon			= LoadIcon(NULL, IDI_APPLICATION);
		WinC.hIconSm		= LoadIcon(NULL, IDI_APPLICATION);
		WinC.hCursor		= LoadCursor(NULL, IDC_ARROW);
		WinC.lpszMenuName	= NULL;
		WinC.cbClsExtra		= 0;
		WinC.cbWndExtra		= 0;
		WinC.hbrBackground	= (HBRUSH)COLOR_BACKGROUND;
		WinC.cbSize			= sizeof(WNDCLASSEX);
		RegisterClassEx(&WinC);
		HWND Handle = CreateWindow(WinClass, _T(""), WS_DISABLED, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, NULL, NULL);
		if (Handle) {
			UpdateWindow(Handle);
			Table = LoadAccelerators(NULL, WinClass);
			return true;
		}
		return false;
	};
};


Code:

#include "Win.h"

Win* x;

EXTERN_C int WINAPI UnloadDll(int TimeOut) {
	//x->ExitInstance();
	//delete x;
	return mIRC->Unload(TimeOut);
}

EXTERN_C void WINAPI LoadDll(LoadInfo *Load) {
	Load->Keep = 1; // stay loaded
	mIRC = new Dll;
	mIRC->Load(Load->Handle);
	x = new Win;
	x->InitInstance();
}

Func(Start) {
	x->CreateThread(CREATE_SUSPENDED) ;
	x->m_bAutoDelete = true ;
	x->ResumeThread() ;
	return 1;
}