|
So you must have some sort of deadlock, the question is where, and I don't think we can help you here without all the code.
I think that a single thread can 'Wait' for a Mutex multiple times and the wait will always complete immediately. But each wait must be accompanied with a matching ReleaseMutex. Perhaps there's something like that but with insufficient releases happening in your code flow?
Paul
|
|
|
|
|
You only check the WAIT_OBJECT_0 returned from WaitForSingleObject(). Check for other possible return values.
Post the code that creates the mutex in the EXE.
Kuphryn
|
|
|
|
|
I noticed that whenever I use the "<<" bitwise left shift operator. The result value is incorrect. The bitwise right shift is correct. Whats up with this? Any ideas? ie 49<<3 should be 136, but I get 392.
Thanks
|
|
|
|
|
|
I assume he is taking it as 8bits and therefore the top bit falls off the end!
Ant.
|
|
|
|
|
Then you should be shifting an 8bit variable, like 'unsigned char'. You are probably shifting 'int' or something. Or cut it to 8 bits with AND 255
|
|
|
|
|
I see what you have done. You need to AND with 255 to get the answer.
Ant.
|
|
|
|
|
one time right shift is like divide with 2 and one time left shift is like multiple wiht 2. So How can you find 136 result
|
|
|
|
|
I am running my application in Visual Studio .NET & am getting the following error "It is illegal to call out while inside message filter"
What can be causing this error to occur?
Thanks
|
|
|
|
|
Hi,
From my experience - this is caused by COM re-entrancy.
For example, COM server has called back into your app (via eventing) and you are then calling back into the COM server.
COM's telling you its blocking the call because it hasn't finished processing the previous method call.
I did the following which still blocks but without the annoying message
class CBusyState
{
public:
CBusyState(BOOL bEnterBusyState = TRUE,
SERVERCALL scBusyReply = SERVERCALL_RETRYLATER)
: m_bBusy(FALSE)
{
m_pMessageFilter = AfxOleGetMessageFilter();
if (bEnterBusyState)
Begin(scBusyReply);
}
~COasisBusyState()
{
End();
};
BOOL Begin(SERVERCALL scBusyReply = SERVERCALL_RETRYLATER)
{
if (m_pMessageFilter && !m_bBusy)
{
m_pMessageFilter->SetBusyReply(scBusyReply);
m_pMessageFilter->BeginBusyState();
m_bBusy = TRUE;
}
return m_bBusy;
}
void End()
{
if (m_pMessageFilter && m_bBusy)
{
m_pMessageFilter->EndBusyState();
m_bBusy = FALSE;
}
}
private:
BOOL m_bBusy;
COleMessageFilter* m_pMessageFilter;
};
Then whenever we call the COM server, I'd put the object on the stack, e.g.
function xyzxyzxyz()
{
CBusyState blocker(TRUE);
MyCOMServer->method(xyz)
}
Hope this helps,
Andy
|
|
|
|
|
Thanks alot for your response, I will try your idea, for now I put some workaround in my code.
Thanks again for the info.
|
|
|
|
|
I am getting server errors when trying to download a CAB file from a webserver.
I think the problem is that the default headers don't allow for CAB file mime type.
What string do I need to use in my call to
CHttpFile.AddRequestheaders(); to get this file?
I believe this is the problem, because if I change the URL to point to an HTML page, but leave everything else the same, then the file downloads just fine.
Thanks!
(I am also posting this in the Web Develpment forum)
//placeholder for witty verbiage
|
|
|
|
|
does "GET /.../.../foo.cab" really not work?
Don't try it, just do it!
|
|
|
|
|
|
I have set a MSChart control in my dialog,a error happened.
m_Chart.SetColumn(i);
when i=5,compiler shows :index given is out of bound and i=4,all right. Why?
|
|
|
|
|
I think the default column count in the control is 4.You can set the number of columns from the properties of the control.
|
|
|
|
|
thanks a lot,I have resulved this problem.
|
|
|
|
|
How can i calculate the idle time of machine in VC++.
|
|
|
|
|
Does GetLastInputInfo() help?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
i have used GetLastInputInfo() but its not working.
|
|
|
|
|
Anonymous wrote:
...its not working.
Meaning what? You get a compiler/linker error? It doesn't produce the desired result? Please explain further.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Use Profiler in Build menu.
It may help
Kamyar Souri
Booria CAD/CAM Systems
www.booria.com
|
|
|
|
|
I want to implement a funtion.The follwing is its prototype:
CRuntimeClass* FindClass(CString &strClassName)
Parameter strClassName is the name of some class. I want to get the CRuntimeClass member variable of the class whose name is strClassName.
For example :
CString strClassName="CMyView";
CRuntimeClass * pRtc=FineClass(strClassName);
~~~~~~~~ I hope that I can get the pointer of CRuntimeClass member variable of CMyView;
Thanks for your help
I love sea
|
|
|
|
|
Hi,
My first thought would be to add a CMapStringToPtr object into your CDocument class
Then, on the constructor of each and every object you'll need, add a call to the object, e.g.
CMyView::CMyView() : CFormView(CMyView::IDD)
{
CMyDoc* pDoc = GetDocument();
if (pDoc) pDoc->RegisterClass(GetRuntimeClass()->m_lpszClassName, GetRuntimeClass());
}
We then need to remember to add an 'unregister' to the destructor...MOST important if you have any objects that will get destroyed/recreated during the lifetime of the application - otherwise the pointer held in the map will point to junk memory
CMyView::~CMyView()
{
CMyDoc* pDoc = GetDocument();
if (pDoc) pDoc->UnregisterClass(GetRuntimeClass()->m_lpszClassName);
}
Here are the functions in the Document...
BOOL CMyDoc::RegisterClass(const CString& strClassName, const CRuntimeClass* pClass)
{
CRuntimeClass* pLookup = NULL;
if (m_mapRuntimeClasses.Lookup(strClassName, (void*&)pLookup))
UnregisterClass(strClassName);
m_mapRuntimeClasses.SetAt(strClassName, ( void*& )pClass);
return TRUE;
}
BOOL CMyDoc::UnregisterClass(const CString& strClassName)
{
BOOL bRet = FALSE;
CRuntimeClass* pLookup = NULL;
if (m_mapRuntimeClasses.Lookup(strClassName, (void*&)pLookup))
bRet = m_mapRuntimeClasses.RemoveKey(strClassName);
return bRet;
}
The m_mapRuntimeClasses is the CMapStringToPtr object - if you wanted to be all OO about it, then best to encapsulate the functions you want into a derived CMapStringToPtr object and have this in your CDocument.
For any objects that need access to the document (other than views that already do), then preferred approach is:
CFrameWnd* pFrame = (CFrameWnd*)AfxGetApp()->m_pMainWnd;
if (pFrame && pFrame->GetSafeHwnd())
{
CMyDoc* pDoc = (CMyDoc*)pFrame->GetActiveDocument();
if (pDoc) pDoc->Register(.....);
}
Hope this helps,
Andy
|
|
|
|
|