cocos2d设置窗口标题

	//窗口标题
#ifdef WIN32
		CCEGLView* pGlView=CCDirector::sharedDirector()->getOpenGLView();
		if (pGlView)
		{
			std::string temp = U8ToA(name.c_str());
			int len=MultiByteToWideChar(CP_ACP, 0, (LPCSTR)temp.c_str(), -1, NULL,0); 
			wchar_t * wszUtf8 = new wchar_t[len+1]; 
			memset(wszUtf8, 0, len * 2 + 2); 
			MultiByteToWideChar(CP_ACP, 0, (LPCSTR)temp.c_str(), -1, (LPWSTR)wszUtf8, len);
			std::wstring szDst = wszUtf8;
			delete[] wszUtf8;

			//LPCWSTR
			HWND _handle= pGlView->getHWnd(); 
			SetWindowTextW(_handle,szDst.c_str());

			
		}
		
#endif

  

posted @ 2019-10-18 17:40  冷夜 - 网游编程技术  阅读(366)  评论(0编辑  收藏  举报