一个关于在MFC中用WIN32API编程的有关问题,请大家帮忙

一个关于在MFC中用WIN32API编程的问题,请大家帮忙!
我建立一个MFC工程,然后在界面上加了一个按钮,我想用WIN32API的函数创建一个窗口,编译成功了,但在点击按钮时想要得窗口不出现,不知什麽原因,请大家给与指点,多谢!代码如下:


void   CFire06Dlg::OnButton1()  
{

HINSTANCE   hInst=NULL;

WNDCLASSEX   wc   =   {   sizeof(WNDCLASSEX),   CS_CLASSDC,   MsgProc,   0L,   0L,GetModuleHandle(NULL),                             LoadIcon(hInst,   MAKEINTRESOURCE(IDR_MAINFRAME)),               NULL,   NULL,   NULL,CLASSNAME,   NULL   };

//   Create   the   application 's   window
HWND   hWnd   =   CreateWindow(   CLASSNAME,   CLASSNAME,
WS_OVERLAPPEDWINDOW,   100,   100,   300,   300,
NULL,   NULL,   wc.hInstance,   NULL   );

        ::ShowWindow(   hWnd,   SW_SHOWDEFAULT   );
        ::UpdateWindow(   hWnd   );

}


------解决方案--------------------
给个完整的例子,在mfc中最好不要用sdk代码,这样难以维护和管理
#include <windows.h>

// Global variable

HINSTANCE hinst;

// Function prototypes.

int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int);
InitApplication(HINSTANCE);
InitInstance(HINSTANCE, int);
LRESULT CALLBACK MainWndProc(HWND, UINT, WPARAM, LPARAM);

// Application entry point.

int WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
{
MSG msg;

if (!InitApplication(hinstance))
return FALSE;

if (!InitInstance(hinstance, nCmdShow))
return FALSE;

while (GetMessage(&msg, (HWND) NULL, 0, 0) != 0 && GetMessage(&msg, (HWND) NULL, 0, 0) != -1)
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
UNREFERENCED_PARAMETER(lpCmdLine);
}

BOOL InitApplication(HINSTANCE hinstance)
{
WNDCLASSEX wcx;

// Fill in the window class structure with parameters
// that describe the main window.

wcx.cbSize = sizeof(wcx); // size of structure
wcx.style = CS_HREDRAW |
CS_VREDRAW; // redraw if size changes
wcx.lpfnWndProc = MainWndProc; // points to window procedure
wcx.cbClsExtra = 0; // no extra class memory
wcx.cbWndExtra = 0; // no extra window memory
wcx.hInstance = hinstance; // handle to instance
wcx.hIcon = LoadIcon(NULL,
IDI_APPLICATION); // predefined app. icon
wcx.hCursor = LoadCursor(NULL,
IDC_ARROW); // predefined arrow
wcx.hbrBackground = GetStockObject(
WHITE_BRUSH); // white background brush
wcx.lpszMenuName = "MainMenu "; // name of menu resource
wcx.lpszClassName = "MainWClass "; // name of window class
wcx.hIconSm = LoadImage(hinstance, // small class icon
MAKEINTRESOURCE(5),
IMAGE_ICON,
GetSystemMetrics(SM_CXSMICON),
GetSystemMetrics(SM_CYSMICON),
LR_DEFAULTCOLOR);

// Register the window class.

return RegisterClassEx(&wcx);
}

BOOL InitInstance(HINSTANCE hinstance, int nCmdShow)
{
HWND hwnd;