MSDN說爲什麼WaitForSingleObject的返回WAIT_FAILED
如果函數調用失敗,返回值爲WAIT_FAILED。要獲得擴展的錯誤信息,請調用GetLastError。
的代碼是:
HANDLE m_mutex_handle; /**< m_mutex_handle. The handle to the created mutex. */
m_mutex_handle = ::CreateMutex(0, false, NULL);
::WaitForSingleObject(m_mutex_handle, INFINITE);
但什麼是可能發生的原因是什麼?
那麼,GetLastError()返回什麼?這通常會給你一個很好的線索。 – Ferruccio 2008-10-17 01:22:35