473,797 Members | 2,893 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

COM Call inside thread

NG
Hi All
I am using interop blocking COM call from within a worker thread. This is a
part of Windows Application. I find that if I remove the blocking COM call
and instead use an infinite while loop, the Windows App works fine.
However, when I use the blocking COM call from withing the infinite while
loop, the Windows Application freezes. Can anyone please tell me what the
problem could be?

Thanks in advance for any help.

Regards
Nitesh Gupta

Pasted below is the code snipet:
I am trying to use ActiveX MQClient library from within the loop to get a
message from the queue.

public bool Get(ref string strMsg)

{

MQMessage getMsg=(MQMessa ge)m_MQSession. AccessMessage() ;

m_MQGetMsgOptio ns=(MQGetMessag eOptions)m_MQSe ssion.AccessGet MessageOptions( )
;

m_MQGetMsgOptio ns.Options=(int )((int)m_MQGetM sgOptions.Optio ns |
(int)MQ.MQGMO_C OMPLETE_MSG | (int)MQ.MQGMO_N O_SYNCPOINT |
(int)MQ.MQGMO_W AIT);

m_MQGetMsgOptio ns.WaitInterval =(int)MQ.MQWI_U NLIMITED;

m_MQQueue.Get(g etMsg, m_MQGetMsgOptio ns, System.Reflecti on.Missing.Valu e);

strMsg=getMsg.M essageData.ToSt ring();

if(m_MQSession. ReasonCode==(in t)MQ.MQRC_NO_MS G_AVAILABLE ||
m_MQSession.Com pletionCode==(i nt)MQ.MQCC_FAIL ED)

{

return false;

}

return true;

}
public virtual void OnMessage(strin g strMsg)

{

}

private void Process()

{

string str=string.Empt y;

while(!m_bAbort )

{

if(Get(ref str))

{

OnMessage(str);

}

}

}

public bool StartPolling()

{

ThreadStart start=new ThreadStart(thi s.Process);

m_MyThread=new Thread(start);

m_bAbort=false;

m_MyThread.Star t();

return true;

}
Nov 17 '05 #1
8 2200
why aren't you using the System.Messagin g namespace?

The System.Messagin g namespace provides classes that allow you to connect
to, monitor, and administer message queues on the network and send, receive,
or peek messages.

HTH

Ollie Riches

"NG" <xg******@yahoo .com> wrote in message
news:eX******** ******@TK2MSFTN GP14.phx.gbl...
Hi All
I am using interop blocking COM call from within a worker thread. This is
a
part of Windows Application. I find that if I remove the blocking COM
call
and instead use an infinite while loop, the Windows App works fine.
However, when I use the blocking COM call from withing the infinite while
loop, the Windows Application freezes. Can anyone please tell me what the
problem could be?

Thanks in advance for any help.

Regards
Nitesh Gupta

Pasted below is the code snipet:
I am trying to use ActiveX MQClient library from within the loop to get a
message from the queue.

public bool Get(ref string strMsg)

{

MQMessage getMsg=(MQMessa ge)m_MQSession. AccessMessage() ;

m_MQGetMsgOptio ns=(MQGetMessag eOptions)m_MQSe ssion.AccessGet MessageOptions( )
;

m_MQGetMsgOptio ns.Options=(int )((int)m_MQGetM sgOptions.Optio ns |
(int)MQ.MQGMO_C OMPLETE_MSG | (int)MQ.MQGMO_N O_SYNCPOINT |
(int)MQ.MQGMO_W AIT);

m_MQGetMsgOptio ns.WaitInterval =(int)MQ.MQWI_U NLIMITED;

m_MQQueue.Get(g etMsg, m_MQGetMsgOptio ns, System.Reflecti on.Missing.Valu e);

strMsg=getMsg.M essageData.ToSt ring();

if(m_MQSession. ReasonCode==(in t)MQ.MQRC_NO_MS G_AVAILABLE ||
m_MQSession.Com pletionCode==(i nt)MQ.MQCC_FAIL ED)

{

return false;

}

return true;

}
public virtual void OnMessage(strin g strMsg)

{

}

private void Process()

{

string str=string.Empt y;

while(!m_bAbort )

{

if(Get(ref str))

{

OnMessage(str);

}

}

}

public bool StartPolling()

{

ThreadStart start=new ThreadStart(thi s.Process);

m_MyThread=new Thread(start);

m_bAbort=false;

m_MyThread.Star t();

return true;

}

Nov 17 '05 #2
NG
I am using IBM Websphere MQ Series. Will System.Messagin g work with IBM MQ
Series also? Its works with MS Queuing as far as I know?
"Ollie Riches" <ol**********@p honeanalyser.ne t> wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
why aren't you using the System.Messagin g namespace?

The System.Messagin g namespace provides classes that allow you to connect
to, monitor, and administer message queues on the network and send, receive, or peek messages.

HTH

Ollie Riches

"NG" <xg******@yahoo .com> wrote in message
news:eX******** ******@TK2MSFTN GP14.phx.gbl...
Hi All
I am using interop blocking COM call from within a worker thread. This is a
part of Windows Application. I find that if I remove the blocking COM
call
and instead use an infinite while loop, the Windows App works fine.
However, when I use the blocking COM call from withing the infinite while loop, the Windows Application freezes. Can anyone please tell me what the problem could be?

Thanks in advance for any help.

Regards
Nitesh Gupta

Pasted below is the code snipet:
I am trying to use ActiveX MQClient library from within the loop to get a message from the queue.

public bool Get(ref string strMsg)

{

MQMessage getMsg=(MQMessa ge)m_MQSession. AccessMessage() ;

m_MQGetMsgOptio ns=(MQGetMessag eOptions)m_MQSe ssion.AccessGet MessageOptions( ) ;

m_MQGetMsgOptio ns.Options=(int )((int)m_MQGetM sgOptions.Optio ns |
(int)MQ.MQGMO_C OMPLETE_MSG | (int)MQ.MQGMO_N O_SYNCPOINT |
(int)MQ.MQGMO_W AIT);

m_MQGetMsgOptio ns.WaitInterval =(int)MQ.MQWI_U NLIMITED;

m_MQQueue.Get(g etMsg, m_MQGetMsgOptio ns, System.Reflecti on.Missing.Valu e);
strMsg=getMsg.M essageData.ToSt ring();

if(m_MQSession. ReasonCode==(in t)MQ.MQRC_NO_MS G_AVAILABLE ||
m_MQSession.Com pletionCode==(i nt)MQ.MQCC_FAIL ED)

{

return false;

}

return true;

}
public virtual void OnMessage(strin g strMsg)

{

}

private void Process()

{

string str=string.Empt y;

while(!m_bAbort )

{

if(Get(ref str))

{

OnMessage(str);

}

}

}

public bool StartPolling()

{

ThreadStart start=new ThreadStart(thi s.Process);

m_MyThread=new Thread(start);

m_bAbort=false;

m_MyThread.Star t();

return true;

}


Nov 17 '05 #3
As far as I am aware you can't, but this might help

http://www.csharphelp.com/archives3/archive477.html

Ollie Riches

"NG" <xg******@yahoo .com> wrote in message
news:uO******** ******@TK2MSFTN GP11.phx.gbl...
I am using IBM Websphere MQ Series. Will System.Messagin g work with IBM MQ
Series also? Its works with MS Queuing as far as I know?
"Ollie Riches" <ol**********@p honeanalyser.ne t> wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
why aren't you using the System.Messagin g namespace?

The System.Messagin g namespace provides classes that allow you to connect
to, monitor, and administer message queues on the network and send,

receive,
or peek messages.

HTH

Ollie Riches

"NG" <xg******@yahoo .com> wrote in message
news:eX******** ******@TK2MSFTN GP14.phx.gbl...
> Hi All
> I am using interop blocking COM call from within a worker thread. This is > a
> part of Windows Application. I find that if I remove the blocking COM
> call
> and instead use an infinite while loop, the Windows App works fine.
> However, when I use the blocking COM call from withing the infinite while > loop, the Windows Application freezes. Can anyone please tell me what the > problem could be?
>
> Thanks in advance for any help.
>
> Regards
> Nitesh Gupta
>
> Pasted below is the code snipet:
> I am trying to use ActiveX MQClient library from within the loop to get a > message from the queue.
>
> public bool Get(ref string strMsg)
>
> {
>
> MQMessage getMsg=(MQMessa ge)m_MQSession. AccessMessage() ;
>
> m_MQGetMsgOptio ns=(MQGetMessag eOptions)m_MQSe ssion.AccessGet MessageOptions( ) > ;
>
> m_MQGetMsgOptio ns.Options=(int )((int)m_MQGetM sgOptions.Optio ns |
> (int)MQ.MQGMO_C OMPLETE_MSG | (int)MQ.MQGMO_N O_SYNCPOINT |
> (int)MQ.MQGMO_W AIT);
>
> m_MQGetMsgOptio ns.WaitInterval =(int)MQ.MQWI_U NLIMITED;
>
> m_MQQueue.Get(g etMsg, m_MQGetMsgOptio ns, System.Reflecti on.Missing.Valu e); >
> strMsg=getMsg.M essageData.ToSt ring();
>
> if(m_MQSession. ReasonCode==(in t)MQ.MQRC_NO_MS G_AVAILABLE ||
> m_MQSession.Com pletionCode==(i nt)MQ.MQCC_FAIL ED)
>
> {
>
> return false;
>
> }
>
> return true;
>
> }
>
>
> public virtual void OnMessage(strin g strMsg)
>
> {
>
> }
>
> private void Process()
>
> {
>
> string str=string.Empt y;
>
> while(!m_bAbort )
>
> {
>
> if(Get(ref str))
>
> {
>
> OnMessage(str);
>
> }
>
> }
>
> }
>
> public bool StartPolling()
>
> {
>
> ThreadStart start=new ThreadStart(thi s.Process);
>
> m_MyThread=new Thread(start);
>
> m_bAbort=false;
>
> m_MyThread.Star t();
>
> return true;
>
> }
>
>



Nov 17 '05 #4
NG
Yes, I came across this but I could not find .NET support pack on this link.

http://www-3.ibm.com/software/integr...dual/ma7p.html
Any other active links that you can help me with?

Thanks,

Nitesh
"Ollie Riches" <ol**********@p honeanalyser.ne t> wrote in message
news:%2******** ********@TK2MSF TNGP14.phx.gbl. ..
As far as I am aware you can't, but this might help

http://www.csharphelp.com/archives3/archive477.html

Ollie Riches

"NG" <xg******@yahoo .com> wrote in message
news:uO******** ******@TK2MSFTN GP11.phx.gbl...
I am using IBM Websphere MQ Series. Will System.Messagin g work with IBM MQ Series also? Its works with MS Queuing as far as I know?
"Ollie Riches" <ol**********@p honeanalyser.ne t> wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
why aren't you using the System.Messagin g namespace?

The System.Messagin g namespace provides classes that allow you to connect to, monitor, and administer message queues on the network and send,

receive,
or peek messages.

HTH

Ollie Riches

"NG" <xg******@yahoo .com> wrote in message
news:eX******** ******@TK2MSFTN GP14.phx.gbl...
> Hi All
> I am using interop blocking COM call from within a worker thread. This
is
> a
> part of Windows Application. I find that if I remove the blocking
COM > call
> and instead use an infinite while loop, the Windows App works fine.
> However, when I use the blocking COM call from withing the infinite

while
> loop, the Windows Application freezes. Can anyone please tell me what the
> problem could be?
>
> Thanks in advance for any help.
>
> Regards
> Nitesh Gupta
>
> Pasted below is the code snipet:
> I am trying to use ActiveX MQClient library from within the loop to
get a
> message from the queue.
>
> public bool Get(ref string strMsg)
>
> {
>
> MQMessage getMsg=(MQMessa ge)m_MQSession. AccessMessage() ;
>
>

m_MQGetMsgOptio ns=(MQGetMessag eOptions)m_MQSe ssion.AccessGet MessageOptions( ) > ;
>
> m_MQGetMsgOptio ns.Options=(int )((int)m_MQGetM sgOptions.Optio ns |
> (int)MQ.MQGMO_C OMPLETE_MSG | (int)MQ.MQGMO_N O_SYNCPOINT |
> (int)MQ.MQGMO_W AIT);
>
> m_MQGetMsgOptio ns.WaitInterval =(int)MQ.MQWI_U NLIMITED;
>
> m_MQQueue.Get(g etMsg, m_MQGetMsgOptio ns,

System.Reflecti on.Missing.Valu e);
>
> strMsg=getMsg.M essageData.ToSt ring();
>
> if(m_MQSession. ReasonCode==(in t)MQ.MQRC_NO_MS G_AVAILABLE ||
> m_MQSession.Com pletionCode==(i nt)MQ.MQCC_FAIL ED)
>
> {
>
> return false;
>
> }
>
> return true;
>
> }
>
>
> public virtual void OnMessage(strin g strMsg)
>
> {
>
> }
>
> private void Process()
>
> {
>
> string str=string.Empt y;
>
> while(!m_bAbort )
>
> {
>
> if(Get(ref str))
>
> {
>
> OnMessage(str);
>
> }
>
> }
>
> }
>
> public bool StartPolling()
>
> {
>
> ThreadStart start=new ThreadStart(thi s.Process);
>
> m_MyThread=new Thread(start);
>
> m_bAbort=false;
>
> m_MyThread.Star t();
>
> return true;
>
> }
>
>



Nov 17 '05 #5
how about this:

http://www-1.ibm.com/support/docview...=utf-8&lang=en

HTH

Ollie Riches

"NG" <xg******@yahoo .com> wrote in message
news:eg******** ******@tk2msftn gp13.phx.gbl...
Yes, I came across this but I could not find .NET support pack on this
link.

http://www-3.ibm.com/software/integr...dual/ma7p.html
Any other active links that you can help me with?

Thanks,

Nitesh
"Ollie Riches" <ol**********@p honeanalyser.ne t> wrote in message
news:%2******** ********@TK2MSF TNGP14.phx.gbl. ..
As far as I am aware you can't, but this might help

http://www.csharphelp.com/archives3/archive477.html

Ollie Riches

"NG" <xg******@yahoo .com> wrote in message
news:uO******** ******@TK2MSFTN GP11.phx.gbl...
>I am using IBM Websphere MQ Series. Will System.Messagin g work with IBM MQ > Series also? Its works with MS Queuing as far as I know?
>
>
> "Ollie Riches" <ol**********@p honeanalyser.ne t> wrote in message
> news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
>> why aren't you using the System.Messagin g namespace?
>>
>> The System.Messagin g namespace provides classes that allow you to connect >> to, monitor, and administer message queues on the network and send,
> receive,
>> or peek messages.
>>
>> HTH
>>
>> Ollie Riches
>>
>> "NG" <xg******@yahoo .com> wrote in message
>> news:eX******** ******@TK2MSFTN GP14.phx.gbl...
>> > Hi All
>> > I am using interop blocking COM call from within a worker thread. This > is
>> > a
>> > part of Windows Application. I find that if I remove the blocking COM >> > call
>> > and instead use an infinite while loop, the Windows App works fine.
>> > However, when I use the blocking COM call from withing the infinite
> while
>> > loop, the Windows Application freezes. Can anyone please tell me what > the
>> > problem could be?
>> >
>> > Thanks in advance for any help.
>> >
>> > Regards
>> > Nitesh Gupta
>> >
>> > Pasted below is the code snipet:
>> > I am trying to use ActiveX MQClient library from within the loop to get > a
>> > message from the queue.
>> >
>> > public bool Get(ref string strMsg)
>> >
>> > {
>> >
>> > MQMessage getMsg=(MQMessa ge)m_MQSession. AccessMessage() ;
>> >
>> >
> m_MQGetMsgOptio ns=(MQGetMessag eOptions)m_MQSe ssion.AccessGet MessageOptions( ) >> > ;
>> >
>> > m_MQGetMsgOptio ns.Options=(int )((int)m_MQGetM sgOptions.Optio ns |
>> > (int)MQ.MQGMO_C OMPLETE_MSG | (int)MQ.MQGMO_N O_SYNCPOINT |
>> > (int)MQ.MQGMO_W AIT);
>> >
>> > m_MQGetMsgOptio ns.WaitInterval =(int)MQ.MQWI_U NLIMITED;
>> >
>> > m_MQQueue.Get(g etMsg, m_MQGetMsgOptio ns,
> System.Reflecti on.Missing.Valu e);
>> >
>> > strMsg=getMsg.M essageData.ToSt ring();
>> >
>> > if(m_MQSession. ReasonCode==(in t)MQ.MQRC_NO_MS G_AVAILABLE ||
>> > m_MQSession.Com pletionCode==(i nt)MQ.MQCC_FAIL ED)
>> >
>> > {
>> >
>> > return false;
>> >
>> > }
>> >
>> > return true;
>> >
>> > }
>> >
>> >
>> > public virtual void OnMessage(strin g strMsg)
>> >
>> > {
>> >
>> > }
>> >
>> > private void Process()
>> >
>> > {
>> >
>> > string str=string.Empt y;
>> >
>> > while(!m_bAbort )
>> >
>> > {
>> >
>> > if(Get(ref str))
>> >
>> > {
>> >
>> > OnMessage(str);
>> >
>> > }
>> >
>> > }
>> >
>> > }
>> >
>> > public bool StartPolling()
>> >
>> > {
>> >
>> > ThreadStart start=new ThreadStart(thi s.Process);
>> >
>> > m_MyThread=new Thread(start);
>> >
>> > m_bAbort=false;
>> >
>> > m_MyThread.Star t();
>> >
>> > return true;
>> >
>> > }
>> >
>> >
>>
>>
>
>



Nov 17 '05 #6
NG
Looks like this would work. But, I am wondering whether this can be used on
a MQServer too. I am giving it a try.

Regards
Nitesh
"Ollie Riches" <ol**********@p honeanalyser.ne t> wrote in message
news:eS******** ******@TK2MSFTN GP10.phx.gbl...
how about this:

http://www-1.ibm.com/support/docview...=utf-8&lang=en
HTH

Ollie Riches

"NG" <xg******@yahoo .com> wrote in message
news:eg******** ******@tk2msftn gp13.phx.gbl...
Yes, I came across this but I could not find .NET support pack on this
link.

http://www-3.ibm.com/software/integr...dual/ma7p.html Any other active links that you can help me with?

Thanks,

Nitesh
"Ollie Riches" <ol**********@p honeanalyser.ne t> wrote in message
news:%2******** ********@TK2MSF TNGP14.phx.gbl. ..
As far as I am aware you can't, but this might help

http://www.csharphelp.com/archives3/archive477.html

Ollie Riches

"NG" <xg******@yahoo .com> wrote in message
news:uO******** ******@TK2MSFTN GP11.phx.gbl...
>I am using IBM Websphere MQ Series. Will System.Messagin g work with IBM
MQ
> Series also? Its works with MS Queuing as far as I know?
>
>
> "Ollie Riches" <ol**********@p honeanalyser.ne t> wrote in message
> news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
>> why aren't you using the System.Messagin g namespace?
>>
>> The System.Messagin g namespace provides classes that allow you to

connect
>> to, monitor, and administer message queues on the network and send,
> receive,
>> or peek messages.
>>
>> HTH
>>
>> Ollie Riches
>>
>> "NG" <xg******@yahoo .com> wrote in message
>> news:eX******** ******@TK2MSFTN GP14.phx.gbl...
>> > Hi All
>> > I am using interop blocking COM call from within a worker thread.

This
> is
>> > a
>> > part of Windows Application. I find that if I remove the blocking

COM
>> > call
>> > and instead use an infinite while loop, the Windows App works
fine. >> > However, when I use the blocking COM call from withing the infinite > while
>> > loop, the Windows Application freezes. Can anyone please tell me

what
> the
>> > problem could be?
>> >
>> > Thanks in advance for any help.
>> >
>> > Regards
>> > Nitesh Gupta
>> >
>> > Pasted below is the code snipet:
>> > I am trying to use ActiveX MQClient library from within the loop to get
> a
>> > message from the queue.
>> >
>> > public bool Get(ref string strMsg)
>> >
>> > {
>> >
>> > MQMessage getMsg=(MQMessa ge)m_MQSession. AccessMessage() ;
>> >
>> >
>

m_MQGetMsgOptio ns=(MQGetMessag eOptions)m_MQSe ssion.AccessGet MessageOptions( ) >> > ;
>> >
>> > m_MQGetMsgOptio ns.Options=(int )((int)m_MQGetM sgOptions.Optio ns |
>> > (int)MQ.MQGMO_C OMPLETE_MSG | (int)MQ.MQGMO_N O_SYNCPOINT |
>> > (int)MQ.MQGMO_W AIT);
>> >
>> > m_MQGetMsgOptio ns.WaitInterval =(int)MQ.MQWI_U NLIMITED;
>> >
>> > m_MQQueue.Get(g etMsg, m_MQGetMsgOptio ns,
> System.Reflecti on.Missing.Valu e);
>> >
>> > strMsg=getMsg.M essageData.ToSt ring();
>> >
>> > if(m_MQSession. ReasonCode==(in t)MQ.MQRC_NO_MS G_AVAILABLE ||
>> > m_MQSession.Com pletionCode==(i nt)MQ.MQCC_FAIL ED)
>> >
>> > {
>> >
>> > return false;
>> >
>> > }
>> >
>> > return true;
>> >
>> > }
>> >
>> >
>> > public virtual void OnMessage(strin g strMsg)
>> >
>> > {
>> >
>> > }
>> >
>> > private void Process()
>> >
>> > {
>> >
>> > string str=string.Empt y;
>> >
>> > while(!m_bAbort )
>> >
>> > {
>> >
>> > if(Get(ref str))
>> >
>> > {
>> >
>> > OnMessage(str);
>> >
>> > }
>> >
>> > }
>> >
>> > }
>> >
>> > public bool StartPolling()
>> >
>> > {
>> >
>> > ThreadStart start=new ThreadStart(thi s.Process);
>> >
>> > m_MyThread=new Thread(start);
>> >
>> > m_bAbort=false;
>> >
>> > m_MyThread.Star t();
>> >
>> > return true;
>> >
>> > }
>> >
>> >
>>
>>
>
>



Nov 17 '05 #7
to quote the page:

' This package also contains the classes that allow WebSphere MQ clients to
be invoked from Microsoft .NET applications. These classes were previously
available in SupportPac MA7P (now withdrawn).
The classes for .NET are in amqmdnet.dll . '

Ollie Riches

"NG" <xg******@yahoo .com> wrote in message
news:u8******** ******@TK2MSFTN GP14.phx.gbl...
Looks like this would work. But, I am wondering whether this can be used
on
a MQServer too. I am giving it a try.

Regards
Nitesh
"Ollie Riches" <ol**********@p honeanalyser.ne t> wrote in message
news:eS******** ******@TK2MSFTN GP10.phx.gbl...
how about this:

http://www-1.ibm.com/support/docview...=utf-8&lang=en

HTH

Ollie Riches

"NG" <xg******@yahoo .com> wrote in message
news:eg******** ******@tk2msftn gp13.phx.gbl...
> Yes, I came across this but I could not find .NET support pack on this
> link.
>
> http://www-3.ibm.com/software/integr...dual/ma7p.html > Any other active links that you can help me with?
>
> Thanks,
>
> Nitesh
>
>
> "Ollie Riches" <ol**********@p honeanalyser.ne t> wrote in message
> news:%2******** ********@TK2MSF TNGP14.phx.gbl. ..
>> As far as I am aware you can't, but this might help
>>
>> http://www.csharphelp.com/archives3/archive477.html
>>
>> Ollie Riches
>>
>> "NG" <xg******@yahoo .com> wrote in message
>> news:uO******** ******@TK2MSFTN GP11.phx.gbl...
>> >I am using IBM Websphere MQ Series. Will System.Messagin g work with IBM > MQ
>> > Series also? Its works with MS Queuing as far as I know?
>> >
>> >
>> > "Ollie Riches" <ol**********@p honeanalyser.ne t> wrote in message
>> > news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
>> >> why aren't you using the System.Messagin g namespace?
>> >>
>> >> The System.Messagin g namespace provides classes that allow you to
> connect
>> >> to, monitor, and administer message queues on the network and send,
>> > receive,
>> >> or peek messages.
>> >>
>> >> HTH
>> >>
>> >> Ollie Riches
>> >>
>> >> "NG" <xg******@yahoo .com> wrote in message
>> >> news:eX******** ******@TK2MSFTN GP14.phx.gbl...
>> >> > Hi All
>> >> > I am using interop blocking COM call from within a worker thread.
> This
>> > is
>> >> > a
>> >> > part of Windows Application. I find that if I remove the
>> >> > blocking
> COM
>> >> > call
>> >> > and instead use an infinite while loop, the Windows App works fine. >> >> > However, when I use the blocking COM call from withing the infinite >> > while
>> >> > loop, the Windows Application freezes. Can anyone please tell me
> what
>> > the
>> >> > problem could be?
>> >> >
>> >> > Thanks in advance for any help.
>> >> >
>> >> > Regards
>> >> > Nitesh Gupta
>> >> >
>> >> > Pasted below is the code snipet:
>> >> > I am trying to use ActiveX MQClient library from within the loop to > get
>> > a
>> >> > message from the queue.
>> >> >
>> >> > public bool Get(ref string strMsg)
>> >> >
>> >> > {
>> >> >
>> >> > MQMessage getMsg=(MQMessa ge)m_MQSession. AccessMessage() ;
>> >> >
>> >> >
>> >
> m_MQGetMsgOptio ns=(MQGetMessag eOptions)m_MQSe ssion.AccessGet MessageOptions( ) >> >> > ;
>> >> >
>> >> > m_MQGetMsgOptio ns.Options=(int )((int)m_MQGetM sgOptions.Optio ns |
>> >> > (int)MQ.MQGMO_C OMPLETE_MSG | (int)MQ.MQGMO_N O_SYNCPOINT |
>> >> > (int)MQ.MQGMO_W AIT);
>> >> >
>> >> > m_MQGetMsgOptio ns.WaitInterval =(int)MQ.MQWI_U NLIMITED;
>> >> >
>> >> > m_MQQueue.Get(g etMsg, m_MQGetMsgOptio ns,
>> > System.Reflecti on.Missing.Valu e);
>> >> >
>> >> > strMsg=getMsg.M essageData.ToSt ring();
>> >> >
>> >> > if(m_MQSession. ReasonCode==(in t)MQ.MQRC_NO_MS G_AVAILABLE ||
>> >> > m_MQSession.Com pletionCode==(i nt)MQ.MQCC_FAIL ED)
>> >> >
>> >> > {
>> >> >
>> >> > return false;
>> >> >
>> >> > }
>> >> >
>> >> > return true;
>> >> >
>> >> > }
>> >> >
>> >> >
>> >> > public virtual void OnMessage(strin g strMsg)
>> >> >
>> >> > {
>> >> >
>> >> > }
>> >> >
>> >> > private void Process()
>> >> >
>> >> > {
>> >> >
>> >> > string str=string.Empt y;
>> >> >
>> >> > while(!m_bAbort )
>> >> >
>> >> > {
>> >> >
>> >> > if(Get(ref str))
>> >> >
>> >> > {
>> >> >
>> >> > OnMessage(str);
>> >> >
>> >> > }
>> >> >
>> >> > }
>> >> >
>> >> > }
>> >> >
>> >> > public bool StartPolling()
>> >> >
>> >> > {
>> >> >
>> >> > ThreadStart start=new ThreadStart(thi s.Process);
>> >> >
>> >> > m_MyThread=new Thread(start);
>> >> >
>> >> > m_bAbort=false;
>> >> >
>> >> > m_MyThread.Star t();
>> >> >
>> >> > return true;
>> >> >
>> >> > }
>> >> >
>> >> >
>> >>
>> >>
>> >
>> >
>>
>>
>
>



Nov 17 '05 #8
NG
Yes, I have just downloaded this and going to use it.
Thanks very much for your help.

Best regards
Nitesh Gupta
"Ollie Riches" <ol**********@p honeanalyser.ne t> wrote in message
news:eQ******** *****@TK2MSFTNG P12.phx.gbl...
to quote the page:

' This package also contains the classes that allow WebSphere MQ clients to be invoked from Microsoft .NET applications. These classes were previously
available in SupportPac MA7P (now withdrawn).
The classes for .NET are in amqmdnet.dll . '

Ollie Riches

"NG" <xg******@yahoo .com> wrote in message
news:u8******** ******@TK2MSFTN GP14.phx.gbl...
Looks like this would work. But, I am wondering whether this can be used
on
a MQServer too. I am giving it a try.

Regards
Nitesh
"Ollie Riches" <ol**********@p honeanalyser.ne t> wrote in message
news:eS******** ******@TK2MSFTN GP10.phx.gbl...
how about this:

http://www-1.ibm.com/support/docview...=utf-8&lang=en

HTH

Ollie Riches

"NG" <xg******@yahoo .com> wrote in message
news:eg******** ******@tk2msftn gp13.phx.gbl...
> Yes, I came across this but I could not find .NET support pack on this > link.
>
>

http://www-3.ibm.com/software/integr...dual/ma7p.html
> Any other active links that you can help me with?
>
> Thanks,
>
> Nitesh
>
>
> "Ollie Riches" <ol**********@p honeanalyser.ne t> wrote in message
> news:%2******** ********@TK2MSF TNGP14.phx.gbl. ..
>> As far as I am aware you can't, but this might help
>>
>> http://www.csharphelp.com/archives3/archive477.html
>>
>> Ollie Riches
>>
>> "NG" <xg******@yahoo .com> wrote in message
>> news:uO******** ******@TK2MSFTN GP11.phx.gbl...
>> >I am using IBM Websphere MQ Series. Will System.Messagin g work with IBM
> MQ
>> > Series also? Its works with MS Queuing as far as I know?
>> >
>> >
>> > "Ollie Riches" <ol**********@p honeanalyser.ne t> wrote in message
>> > news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
>> >> why aren't you using the System.Messagin g namespace?
>> >>
>> >> The System.Messagin g namespace provides classes that allow you to
> connect
>> >> to, monitor, and administer message queues on the network and
send, >> > receive,
>> >> or peek messages.
>> >>
>> >> HTH
>> >>
>> >> Ollie Riches
>> >>
>> >> "NG" <xg******@yahoo .com> wrote in message
>> >> news:eX******** ******@TK2MSFTN GP14.phx.gbl...
>> >> > Hi All
>> >> > I am using interop blocking COM call from within a worker thread. > This
>> > is
>> >> > a
>> >> > part of Windows Application. I find that if I remove the
>> >> > blocking
> COM
>> >> > call
>> >> > and instead use an infinite while loop, the Windows App works

fine.
>> >> > However, when I use the blocking COM call from withing the

infinite
>> > while
>> >> > loop, the Windows Application freezes. Can anyone please tell me > what
>> > the
>> >> > problem could be?
>> >> >
>> >> > Thanks in advance for any help.
>> >> >
>> >> > Regards
>> >> > Nitesh Gupta
>> >> >
>> >> > Pasted below is the code snipet:
>> >> > I am trying to use ActiveX MQClient library from within the loop to
> get
>> > a
>> >> > message from the queue.
>> >> >
>> >> > public bool Get(ref string strMsg)
>> >> >
>> >> > {
>> >> >
>> >> > MQMessage getMsg=(MQMessa ge)m_MQSession. AccessMessage() ;
>> >> >
>> >> >
>> >
>

m_MQGetMsgOptio ns=(MQGetMessag eOptions)m_MQSe ssion.AccessGet MessageOptions( ) >> >> > ;
>> >> >
>> >> > m_MQGetMsgOptio ns.Options=(int )((int)m_MQGetM sgOptions.Optio ns | >> >> > (int)MQ.MQGMO_C OMPLETE_MSG | (int)MQ.MQGMO_N O_SYNCPOINT |
>> >> > (int)MQ.MQGMO_W AIT);
>> >> >
>> >> > m_MQGetMsgOptio ns.WaitInterval =(int)MQ.MQWI_U NLIMITED;
>> >> >
>> >> > m_MQQueue.Get(g etMsg, m_MQGetMsgOptio ns,
>> > System.Reflecti on.Missing.Valu e);
>> >> >
>> >> > strMsg=getMsg.M essageData.ToSt ring();
>> >> >
>> >> > if(m_MQSession. ReasonCode==(in t)MQ.MQRC_NO_MS G_AVAILABLE ||
>> >> > m_MQSession.Com pletionCode==(i nt)MQ.MQCC_FAIL ED)
>> >> >
>> >> > {
>> >> >
>> >> > return false;
>> >> >
>> >> > }
>> >> >
>> >> > return true;
>> >> >
>> >> > }
>> >> >
>> >> >
>> >> > public virtual void OnMessage(strin g strMsg)
>> >> >
>> >> > {
>> >> >
>> >> > }
>> >> >
>> >> > private void Process()
>> >> >
>> >> > {
>> >> >
>> >> > string str=string.Empt y;
>> >> >
>> >> > while(!m_bAbort )
>> >> >
>> >> > {
>> >> >
>> >> > if(Get(ref str))
>> >> >
>> >> > {
>> >> >
>> >> > OnMessage(str);
>> >> >
>> >> > }
>> >> >
>> >> > }
>> >> >
>> >> > }
>> >> >
>> >> > public bool StartPolling()
>> >> >
>> >> > {
>> >> >
>> >> > ThreadStart start=new ThreadStart(thi s.Process);
>> >> >
>> >> > m_MyThread=new Thread(start);
>> >> >
>> >> > m_bAbort=false;
>> >> >
>> >> > m_MyThread.Star t();
>> >> >
>> >> > return true;
>> >> >
>> >> > }
>> >> >
>> >> >
>> >>
>> >>
>> >
>> >
>>
>>
>
>



Nov 17 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1222
by: Alex Glass | last post by:
I have a component I'm using in my application. When I call a method myComponent.slowMethod() my entire application hangs until slowMethod() completes. I have tried using the .net threading model to trigger the slowMethod inside a thread wrapper class but I still have the same behavior. Is there anything I might be missing here? Thanks for any help, Alex
26
45527
by: Dave Hammond | last post by:
In document "A.html" I have defined a function and within the document body have included an IFRAME element who's source is document "B.html". In document "B.html" I am trying to call the function defined in "A.html", but every attempt results in an "is not a function" error. I have tried to invoke the function using parent.document.funcname(), top.document.funcname(), and various other identifying methods, but all result in the above...
20
3980
by: Cybertof | last post by:
Hello, Is there a good way to call a big time-consumming function from an ActiveX DLL (interoped) through a thread without blocking the main UI ? Here are the details : I have a class CInteropCall encapsulating a call to a visual basic ActiveX DLL function named FillAlloc_ArrayStruct_Double(), which is allocating a big struct array an fills it using a inner loop
1
2191
by: Allan Ebdrup | last post by:
I'm inside a function where I have a static cache, when the cache needs to be updated I want to do it asyncronously, because updating the cache takes a while. I want to use thread safety when writing and reading the cache (a Mutex?) Private Function Count(ByVal Guid)As Int32 Static Dim countResults As Hashtable = New Hashtable Static Dim countResultTimestamps As Hashtable = New Hashtable 'Here I want to call...
5
3223
by: Waleed AlRashoud | last post by:
Hi, I hope u can help me I asked this question before but I didn't explain it very well. Let say I hvae a thread 'A', creates object 'O', and start thread 'B' to do some work on 'O', OK? I want thread 'B' to fire event of 'O' BUT MUST THAT EVENT DONE BY THREAD 'A' not 'B'!!
2
3218
by: Claudio Biagioli | last post by:
I start a parallel thread inside a control with the following code: Private Sub StartParallelProc(ByVal Command As SqlClient.SqlCommand) Dim T As New Threading.Thread(AddressOf ParallelProc) Command.Parameters("MyID").Value = Guid.NewGuid.ToString System.Web.HttpContext.Current.Session("ID") = Command
8
3076
by: Peter S. | last post by:
Hello, 99% of the time I can find information by reading newsgroup posts or reading books but I am having a hard time putting together information on how to update a control inside a C# thread. I am running .NET 2.0 and apparently alot of newsgroup posts center around pre-V2.0. Basically I have a thread that I start and inside the thread I want to update a TextBox that is on my GUI. If someone can supply a tried and true
3
1601
by: Sidanalism | last post by:
I miss the old way when asynchronous calls are driven my window messages. Yes a thread pool might greatly improve application performance but there are time I don't want my event to be fire in a thread differ from the calling thread. When a delegate is called in another thread it could be frustrating for I have to consider thread occurrence issues in all the codes it may invoke along my event chain. Sure the "Control.BeginInvoke()" could...
2
4298
by: =?Utf-8?B?c29jYXRvYQ==?= | last post by:
Hi, I have a DLL in VC6, when a specific function is called it will spawns a few threads and then return. The threads stay running and inside one of these threads an event is created using the win32 CreateEvent() call: Code Snippet static HANDLE hReadyEvent;
0
9536
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10205
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10021
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7559
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6802
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5458
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4131
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3748
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2933
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.