void* CMapPtrToPtr::GetValueAt(void* key) const
// find value (or return NULL -- NULL values not different as a result)
{
-> if (m_pHashTable == NULL)
return NULL;
UINT nHash = HashKey(key) % m_nHashTableSize;
// see if it exists
CAssoc* pAssoc;
for (pAssoc = m_pHashTable[nHash]; pAssoc != NULL; pAssoc = pAssoc->pNext)
{
if (pAssoc->key == key)
return pAssoc->value;
}
return NULL;
}
MFC сокеты и процессы
Я пробую использовать сокет в отдельном потоке и сталкиваюсь с такой проблемой ”Unhandled exception in MyExe.exe: 0XC0000005: Access Violation”. А дебагер жалуется в указанном месте:
Код:
Процесс я создаю следующим образом:
Код:
m_pThread = ::AfxBeginThread( MyFunction, (LPVOID) this, THREAD_PRIORITY_BELOW_NORMAL );
и описаие MyFunction
Код:
UINT CMyExeView:: MyFunction (LPVOID pVoid)
{
CMyExeView * pThis = (CMyExeView *)pVoid;
// advise main thread that this thread has started
pThis->PostMessage( UWM_GETFILEEVENT, GFE_THREADSTART, 0L );
// create client socket and connect to server
AfxSocketInit(NULL); // make certain this is done somewhere in each thread (usually in InitInstance for main thread)
CSocket m_sockClient;
-> m_sockClient.Create();
{
CMyExeView * pThis = (CMyExeView *)pVoid;
// advise main thread that this thread has started
pThis->PostMessage( UWM_GETFILEEVENT, GFE_THREADSTART, 0L );
// create client socket and connect to server
AfxSocketInit(NULL); // make certain this is done somewhere in each thread (usually in InitInstance for main thread)
CSocket m_sockClient;
-> m_sockClient.Create();
Помогите, пожалуйста, разобраться с этой проблемой .
Заранее благодарю.
Если у кого-то возникнет токая проблема, установите сервис пак. Я установил VisualStudioSP5 и все нормализовалось.
где взять?
А под какую студию сервис пак?
Хотя на дворе уже вовсю юзается студия8