Hey Friends
Has anybody used Named Events in Windows 7 ?
Struggling with Named Events, Works on XP , but not on Windows 7.
SharedEvent = CreateEvent(NULL, FALSE, FALSE, "ProblemWithWin7Events");
if (SharedEvent == NULL)
{
AfxMessageBox("Cannot create named event!");
}
AfxBeginThread(ThreadProc,this);
and in Thread Waiting for the Event to Signal
DWORD WaitStatus;
for(int vl_iIndex = 1; vl_iIndex <=1000;vl_iIndex ++)
{
WaitStatus = WaitForSingleObject(SharedEvent, INFINITE);
if (WaitStatus != WAIT_OBJECT_0)
{
TRACE("%d WaitForSingleObject Failed\n",vl_iIndex );
}
else
{
TRACE("%d WaitForSingleObject Works\n",vl_iIndex );
}
}
Also created a Button to Signal the Event
void CTestApplicationForEventsDlg::OnBnClickedSignalEvent()
{
HANDLE vl_hEvent = OpenEvent(SYNCHRONIZE ,FALSE,"ProblemWithWin7Events");
if(vl_hEvent ==NULL)
{
AfxMessageBox("Could not Open Event");
return;
}
::SetEvent(vl_hEvent);
}
Any idea of what i am doing wrong ?
Regards