bool GameWnd::Init() { std::string strConfigPath; StringTools::Format( strConfigPath, "%s/%s", PathMngr::GetSingleton().GetExePath(), DEF_CONFIG_FILE ); IniFile config; if( !config.LoadFile( strConfigPath.c_str() ) ) return false; int width = config.GetInteger( "window", "width" ); int height = config.GetInteger( "window", "height" ); bool bFullScreen = config.GetBool( "window", "bFullScreen" ); WNDCLASS wc; ZeroMemory( &wc, sizeof( wc ) ); wc.hbrBackground = (HBRUSH)GetStockObject( WHITE_BRUSH ); wc.hCursor = LoadCursor( NULL, IDC_ARROW ); wc.hIcon = LoadIcon( NULL, IDI_APPLICATION ); wc.hInstance = GetModuleHandle( NULL ); wc.lpfnWndProc = WndProc; wc.lpszClassName = szClassName; wc.lpszMenuName = NULL; wc.style = CS_HREDRAW | CS_VREDRAW; if( !RegisterClass( &wc ) ) return false; HWND hwnd = NULL; if( bFullScreen ) { hwnd = CreateWindow( szClassName, _TEXT(""), WS_EX_TOPMOST|WS_VISIBLE|WS_POPUP, 0, 0, width, height, NULL, NULL, wc.hInstance, NULL ); } else { hwnd = CreateWindow( szClassName, _TEXT(""), WS_OVERLAPPEDWINDOW|WS_VISIBLE, 0, 0, width, height, NULL, NULL, wc.hInstance, NULL ); } if( hwnd == NULL ) return false; m_Hwnd = hwnd; m_Hinstance = wc.hInstance; m_Width = width; m_Height = height; m_bFullScreen = bFullScreen; return true; }