WNDCLASS wc; wc.style = CS_HREDRAW | CS_VREDRAW ; wc.lpfnWndProc = (WNDPROC)d3d::WndProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = hInstance; wc.hIcon = LoadIcon( 0 , IDI_APPLICATION ); wc.hCursor = LoadCursor( 0 , IDC_ARROW ); wc.hbrBackground = (HBRUSH)GetStockObject( WHITE_BRUSH ); wc.lpszMenuName = 0; wc.lpszClassName = "dx_IceFairy "; if( !RegisterClass( &wc ) ) { ::MessageBox( 0 , " Register class failed " , 0 , 0 ); return false; } HWND hWnd = 0 ; hWnd = ::CreateWindow("dx_IceFairy" , " dx-icefairy " ,WS_EX_TOPMOST , 300 ,200 , nWidth , nHeight , 0 , 0 ,hInstance , 0 ); if( !hWnd ) { ::MessageBox( 0 , " CreateWindow failed " , 0 , 0 ); return false; } 函数CreateWindow()其中第一个参数是 类名 , wc.lpszClassName = "dx_IceFairy"; 这个名字中不能出现空格 如果出现空格会导致创建窗口失败,但是编译能通过。。。