fixed win32 don't exit

This commit is contained in:
chuanweizhang2013 2014-03-17 20:46:49 +08:00
parent e89f20a0b3
commit 6b2ce283e4
2 changed files with 14 additions and 2 deletions

View File

@ -546,7 +546,13 @@ public:
void onShutDownApp(int fd, const std::string &args)
{
Director::getInstance()->getScheduler()->performFunctionInCocosThread([](){
exit(0);
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
extern void shutDownApp();
shutDownApp();
#else
exit(0);
#endif
});
}
private:

View File

@ -204,6 +204,12 @@ void onHelpAbout()
DialogBox(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_DIALOG_ABOUT), glfwGetWin32Window(g_eglView->getWindow()), AboutDialogCallback);
}
void shutDownApp()
{
HWND hWnd=glfwGetWin32Window(g_eglView->getWindow());
::SendMessage(hWnd,WM_CLOSE,NULL,NULL);
}
/*@brief new windows process*/
LRESULT CALLBACK SNewWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
@ -218,7 +224,7 @@ LRESULT CALLBACK SNewWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPar
switch (wmId)
{
case ID_FILE_EXIT:
exit(0);
shutDownApp();
break;
case ID_VIEW_PORTRAIT: