VMWare : Netwoking of Guest OS is not available after restoring

Stopping network related service will fix it. C:\WINDOWS\system32>net stop bits The Background Intelligent Transfer Service service is stopping.. The Background Intelligent Transfer Service service was stopped successfully.     C:\WINDOWS\system32>net stop wuauserv The Background Intelligent Transfer Service service is stopping.. The Background Intelligent Transfer Service service was stopped successfully.     C:\WINDOWS\system32>C:\WINDOWS\system32>net stop bits The… Continue reading VMWare : Netwoking of Guest OS is not available after restoring

MessageBox is not shown after Dialog was closed in MFC Dialog Application

In Win32, you can not show MessageBox after calling PostQuitMessage() until calling GetMessage to get out of message loop. In MFC dialog app, the dialog is set to m_pMainWnd and when dialog is closed, PostQuitMessage is called. If you want to show MessageBox after the dialog closed, there is two method to do this. Method… Continue reading MessageBox is not shown after Dialog was closed in MFC Dialog Application

How to create a C++ function that can take argment of both char* and wchar_t*

Source. Create a traits class that is used as specialized template. Specialize it for char and wchar_t. Generic template is not defined because this function is only for char and wchar_t. #include <wchar.h> #include <stdio.h>   template<typename T> struct kansuu_traits; template<> struct kansuu_traits<char> { static FILE* open(const char* p) { return fopen(p, "r"); } };… Continue reading How to create a C++ function that can take argment of both char* and wchar_t*

System global variable in win32

class CSessionGlobalBool { public: explicit CSessionGlobalBool(LPCSTR pName) { m_pName = (LPSTR)LocalAlloc(LMEM_FIXED, lstrlenA(pName)+sizeof(char)); lstrcpy(m_pName, pName); } ~CSessionGlobalBool(){ LocalFree(m_pName); }   operator bool() { return get(); }   operator =(const bool b) { HANDLE h = CreateEvent(NULL, TRUE, FALSE, m_pName);   if(b) SetEvent(h); else ResetEvent(h); } operator =(const CSessionGlobalBool& sgb) { *this = sgb.get(); } private: bool… Continue reading System global variable in win32

Show a “We are Busy” page when your server is too busy by using PHP

If you are apache fan. You shold have many virtual host in your apache conf. But after your site getting popular, sometimes your server can not handle all request and your visitor will have to wait in front of the browser. I could not find a nice solution for that so created one. First, create… Continue reading Show a “We are Busy” page when your server is too busy by using PHP