diff --git a/cocos2dx/platform/win32/CCApplication_win32.cpp b/cocos2dx/platform/win32/CCApplication_win32.cpp index 2a37abcc15..f9760c8ec7 100644 --- a/cocos2dx/platform/win32/CCApplication_win32.cpp +++ b/cocos2dx/platform/win32/CCApplication_win32.cpp @@ -1,7 +1,12 @@ #include "CCApplication.h" #include "CCDirector.h" -#include "CCEGLView.h" + +/** +@brief This function change the PVRFrame show/hide setting in register. +@param bEnable If true show the PVRFrame window, otherwise hide. +*/ +static void PVRFrameEnableControlWindow(bool bEnable); NS_CC_BEGIN; @@ -26,6 +31,8 @@ CCApplication::~CCApplication() int CCApplication::run() { + PVRFrameEnableControlWindow(false); + // Main message loop: MSG msg; LARGE_INTEGER nFreq; @@ -119,3 +126,40 @@ CCApplication& CCApplication::sharedApplication() } NS_CC_END; + +////////////////////////////////////////////////////////////////////////// +// Local function +////////////////////////////////////////////////////////////////////////// +static void PVRFrameEnableControlWindow(bool bEnable) +{ + HKEY hKey = 0; + + // Open PVRFrame control key, if not exist create it. + if(ERROR_SUCCESS != RegCreateKeyExW(HKEY_CURRENT_USER, + L"Software\\Imagination Technologies\\PVRVFRame\\STARTUP\\", + 0, + 0, + REG_OPTION_NON_VOLATILE, + KEY_ALL_ACCESS, + 0, + &hKey, + NULL)) + { + return; + } + + const wchar_t * wszValue = L"hide_gui"; + const wchar_t * wszNewData = (bEnable) ? L"NO" : L"YES"; + wchar_t wszOldData[256] = {0}; + DWORD dwSize = sizeof(wszOldData); + LSTATUS status = RegQueryValueExW(hKey, wszValue, 0, NULL, (LPBYTE)wszOldData, &dwSize); + if (ERROR_FILE_NOT_FOUND == status // the key not exist + || (ERROR_SUCCESS == status // or the hide_gui value is exist + && 0 != wcscmp(wszNewData, wszOldData))) // but new data and old data not equal + { + dwSize = sizeof(wchar_t) * (wcslen(wszNewData) + 1); + RegSetValueEx(hKey, wszValue, 0, REG_SZ, (const BYTE *)wszNewData, dwSize); + } + + RegCloseKey(hKey); +}