Click here to Skip to main content
15,892,005 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralBitwise Left Shift Pin
Anthony988720-May-04 5:08
Anthony988720-May-04 5:08 
GeneralRe: Bitwise Left Shift Pin
Michael Dunn20-May-04 5:13
sitebuilderMichael Dunn20-May-04 5:13 
GeneralRe: Bitwise Left Shift Pin
Antony M Kancidrowski20-May-04 5:26
Antony M Kancidrowski20-May-04 5:26 
GeneralRe: Bitwise Left Shift Pin
mirex20-May-04 21:39
mirex20-May-04 21:39 
GeneralRe: Bitwise Left Shift Pin
Antony M Kancidrowski20-May-04 5:25
Antony M Kancidrowski20-May-04 5:25 
GeneralRe: Bitwise Left Shift Pin
deniz79s20-May-04 9:01
deniz79s20-May-04 9:01 
GeneralIt is illegal to call out while inside message filter Pin
Member 53435720-May-04 4:55
Member 53435720-May-04 4:55 
GeneralRe: It is illegal to call out while inside message filter Pin
Andrew Quinn AUS20-May-04 5:14
Andrew Quinn AUS20-May-04 5:14 
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:

	// Constructor - by default the busy state is entered
	CBusyState(BOOL bEnterBusyState = TRUE, 
		SERVERCALL scBusyReply = SERVERCALL_RETRYLATER)
		: m_bBusy(FALSE)
	{
		// get the MFC message filter implementation. This will return NULL if called from a DLL.
		m_pMessageFilter = AfxOleGetMessageFilter();
		if (bEnterBusyState)
		   Begin(scBusyReply); // enter the busy state
	}

	// Destructor - ends the busy state (if previously entered)
	~COasisBusyState()
	{	
		End(); // end the busy state
	};

	// Begins the busy state. By default, any incoming COM calls will be
	// rejected, but retried later
	BOOL Begin(SERVERCALL scBusyReply = SERVERCALL_RETRYLATER)
	{	// check that we have a message filter, and that we're not already
		// busy.
		if (m_pMessageFilter && !m_bBusy)
		{	// set the reply code for IMessageFilter::HandlingIncomingCall()
			m_pMessageFilter->SetBusyReply(scBusyReply);
			// enter the busy state
			m_pMessageFilter->BeginBusyState();
			m_bBusy = TRUE;
		}
		return m_bBusy;
	}

	// Ends the busy state, if previously entered
	void End()
	{	// check that we have a message filter, and that we're busy
		if (m_pMessageFilter && m_bBusy)
		{	// end the busy state
			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
GeneralRe: It is illegal to call out while inside message filter Pin
Member 53435720-May-04 6:27
Member 53435720-May-04 6:27 
QuestionHow do I form the HTTP headers to DL a .CAB file? Pin
Terry O'Nolley20-May-04 4:39
Terry O'Nolley20-May-04 4:39 
AnswerRe: How do I form the HTTP headers to DL a .CAB file? Pin
Alexander M.,20-May-04 5:26
Alexander M.,20-May-04 5:26 
GeneralRe: How do I form the HTTP headers to DL a .CAB file? Pin
Terry O'Nolley20-May-04 6:29
Terry O'Nolley20-May-04 6:29 
Generalabout MSChart Pin
yingkou20-May-04 3:16
yingkou20-May-04 3:16 
GeneralRe: about MSChart Pin
*Dreamz20-May-04 4:13
*Dreamz20-May-04 4:13 
GeneralRe: about MSChart Pin
yingkou20-May-04 14:03
yingkou20-May-04 14:03 
GeneralIdle time in VC++ Pin
Anonymous20-May-04 3:08
Anonymous20-May-04 3:08 
GeneralRe: Idle time in VC++ Pin
David Crow20-May-04 4:16
David Crow20-May-04 4:16 
GeneralRe: Idle time in VC++ Pin
Anonymous22-May-04 3:46
Anonymous22-May-04 3:46 
GeneralRe: Idle time in VC++ Pin
David Crow22-May-04 17:01
David Crow22-May-04 17:01 
GeneralRe: Idle time in VC++ Pin
Kamyar Souri20-May-04 9:29
Kamyar Souri20-May-04 9:29 
GeneralA question about CRuntimeClass and Dynamic Creation Pin
SmilingHeart20-May-04 2:48
SmilingHeart20-May-04 2:48 
GeneralRe: A question about CRuntimeClass and Dynamic Creation Pin
Andrew Quinn AUS20-May-04 3:39
Andrew Quinn AUS20-May-04 3:39 
GeneralRe: A question about CRuntimeClass and Dynamic Creation Pin
SmilingHeart21-May-04 18:54
SmilingHeart21-May-04 18:54 
GeneralRe: A question about CRuntimeClass and Dynamic Creation Pin
igor196020-May-04 11:06
igor196020-May-04 11:06 
GeneralRe: A question about CRuntimeClass and Dynamic Creation Pin
SmilingHeart21-May-04 18:52
SmilingHeart21-May-04 18:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.