473,387 Members | 1,517 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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=(MQMessage)m_MQSession.AccessMessage();

m_MQGetMsgOptions=(MQGetMessageOptions)m_MQSession .AccessGetMessageOptions()
;

m_MQGetMsgOptions.Options=(int)((int)m_MQGetMsgOpt ions.Options |
(int)MQ.MQGMO_COMPLETE_MSG | (int)MQ.MQGMO_NO_SYNCPOINT |
(int)MQ.MQGMO_WAIT);

m_MQGetMsgOptions.WaitInterval=(int)MQ.MQWI_UNLIMI TED;

m_MQQueue.Get(getMsg, m_MQGetMsgOptions, System.Reflection.Missing.Value);

strMsg=getMsg.MessageData.ToString();

if(m_MQSession.ReasonCode==(int)MQ.MQRC_NO_MSG_AVA ILABLE ||
m_MQSession.CompletionCode==(int)MQ.MQCC_FAILED)

{

return false;

}

return true;

}
public virtual void OnMessage(string strMsg)

{

}

private void Process()

{

string str=string.Empty;

while(!m_bAbort)

{

if(Get(ref str))

{

OnMessage(str);

}

}

}

public bool StartPolling()

{

ThreadStart start=new ThreadStart(this.Process);

m_MyThread=new Thread(start);

m_bAbort=false;

m_MyThread.Start();

return true;

}
Nov 17 '05 #1
8 2182
why aren't you using the System.Messaging namespace?

The System.Messaging 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**************@TK2MSFTNGP14.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=(MQMessage)m_MQSession.AccessMessage();

m_MQGetMsgOptions=(MQGetMessageOptions)m_MQSession .AccessGetMessageOptions()
;

m_MQGetMsgOptions.Options=(int)((int)m_MQGetMsgOpt ions.Options |
(int)MQ.MQGMO_COMPLETE_MSG | (int)MQ.MQGMO_NO_SYNCPOINT |
(int)MQ.MQGMO_WAIT);

m_MQGetMsgOptions.WaitInterval=(int)MQ.MQWI_UNLIMI TED;

m_MQQueue.Get(getMsg, m_MQGetMsgOptions, System.Reflection.Missing.Value);

strMsg=getMsg.MessageData.ToString();

if(m_MQSession.ReasonCode==(int)MQ.MQRC_NO_MSG_AVA ILABLE ||
m_MQSession.CompletionCode==(int)MQ.MQCC_FAILED)

{

return false;

}

return true;

}
public virtual void OnMessage(string strMsg)

{

}

private void Process()

{

string str=string.Empty;

while(!m_bAbort)

{

if(Get(ref str))

{

OnMessage(str);

}

}

}

public bool StartPolling()

{

ThreadStart start=new ThreadStart(this.Process);

m_MyThread=new Thread(start);

m_bAbort=false;

m_MyThread.Start();

return true;

}

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

The System.Messaging 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**************@TK2MSFTNGP14.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=(MQMessage)m_MQSession.AccessMessage();

m_MQGetMsgOptions=(MQGetMessageOptions)m_MQSession .AccessGetMessageOptions() ;

m_MQGetMsgOptions.Options=(int)((int)m_MQGetMsgOpt ions.Options |
(int)MQ.MQGMO_COMPLETE_MSG | (int)MQ.MQGMO_NO_SYNCPOINT |
(int)MQ.MQGMO_WAIT);

m_MQGetMsgOptions.WaitInterval=(int)MQ.MQWI_UNLIMI TED;

m_MQQueue.Get(getMsg, m_MQGetMsgOptions, System.Reflection.Missing.Value);
strMsg=getMsg.MessageData.ToString();

if(m_MQSession.ReasonCode==(int)MQ.MQRC_NO_MSG_AVA ILABLE ||
m_MQSession.CompletionCode==(int)MQ.MQCC_FAILED)

{

return false;

}

return true;

}
public virtual void OnMessage(string strMsg)

{

}

private void Process()

{

string str=string.Empty;

while(!m_bAbort)

{

if(Get(ref str))

{

OnMessage(str);

}

}

}

public bool StartPolling()

{

ThreadStart start=new ThreadStart(this.Process);

m_MyThread=new Thread(start);

m_bAbort=false;

m_MyThread.Start();

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**************@TK2MSFTNGP11.phx.gbl...
I am using IBM Websphere MQ Series. Will System.Messaging work with IBM MQ
Series also? Its works with MS Queuing as far as I know?
"Ollie Riches" <ol**********@phoneanalyser.net> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
why aren't you using the System.Messaging namespace?

The System.Messaging 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**************@TK2MSFTNGP14.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=(MQMessage)m_MQSession.AccessMessage();
>
> m_MQGetMsgOptions=(MQGetMessageOptions)m_MQSession .AccessGetMessageOptions() > ;
>
> m_MQGetMsgOptions.Options=(int)((int)m_MQGetMsgOpt ions.Options |
> (int)MQ.MQGMO_COMPLETE_MSG | (int)MQ.MQGMO_NO_SYNCPOINT |
> (int)MQ.MQGMO_WAIT);
>
> m_MQGetMsgOptions.WaitInterval=(int)MQ.MQWI_UNLIMI TED;
>
> m_MQQueue.Get(getMsg, m_MQGetMsgOptions, System.Reflection.Missing.Value); >
> strMsg=getMsg.MessageData.ToString();
>
> if(m_MQSession.ReasonCode==(int)MQ.MQRC_NO_MSG_AVA ILABLE ||
> m_MQSession.CompletionCode==(int)MQ.MQCC_FAILED)
>
> {
>
> return false;
>
> }
>
> return true;
>
> }
>
>
> public virtual void OnMessage(string strMsg)
>
> {
>
> }
>
> private void Process()
>
> {
>
> string str=string.Empty;
>
> while(!m_bAbort)
>
> {
>
> if(Get(ref str))
>
> {
>
> OnMessage(str);
>
> }
>
> }
>
> }
>
> public bool StartPolling()
>
> {
>
> ThreadStart start=new ThreadStart(this.Process);
>
> m_MyThread=new Thread(start);
>
> m_bAbort=false;
>
> m_MyThread.Start();
>
> 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**********@phoneanalyser.net> wrote in message
news:%2****************@TK2MSFTNGP14.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**************@TK2MSFTNGP11.phx.gbl...
I am using IBM Websphere MQ Series. Will System.Messaging work with IBM MQ Series also? Its works with MS Queuing as far as I know?
"Ollie Riches" <ol**********@phoneanalyser.net> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
why aren't you using the System.Messaging namespace?

The System.Messaging 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**************@TK2MSFTNGP14.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=(MQMessage)m_MQSession.AccessMessage();
>
>

m_MQGetMsgOptions=(MQGetMessageOptions)m_MQSession .AccessGetMessageOptions() > ;
>
> m_MQGetMsgOptions.Options=(int)((int)m_MQGetMsgOpt ions.Options |
> (int)MQ.MQGMO_COMPLETE_MSG | (int)MQ.MQGMO_NO_SYNCPOINT |
> (int)MQ.MQGMO_WAIT);
>
> m_MQGetMsgOptions.WaitInterval=(int)MQ.MQWI_UNLIMI TED;
>
> m_MQQueue.Get(getMsg, m_MQGetMsgOptions,

System.Reflection.Missing.Value);
>
> strMsg=getMsg.MessageData.ToString();
>
> if(m_MQSession.ReasonCode==(int)MQ.MQRC_NO_MSG_AVA ILABLE ||
> m_MQSession.CompletionCode==(int)MQ.MQCC_FAILED)
>
> {
>
> return false;
>
> }
>
> return true;
>
> }
>
>
> public virtual void OnMessage(string strMsg)
>
> {
>
> }
>
> private void Process()
>
> {
>
> string str=string.Empty;
>
> while(!m_bAbort)
>
> {
>
> if(Get(ref str))
>
> {
>
> OnMessage(str);
>
> }
>
> }
>
> }
>
> public bool StartPolling()
>
> {
>
> ThreadStart start=new ThreadStart(this.Process);
>
> m_MyThread=new Thread(start);
>
> m_bAbort=false;
>
> m_MyThread.Start();
>
> 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**************@tk2msftngp13.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**********@phoneanalyser.net> wrote in message
news:%2****************@TK2MSFTNGP14.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**************@TK2MSFTNGP11.phx.gbl...
>I am using IBM Websphere MQ Series. Will System.Messaging work with IBM MQ > Series also? Its works with MS Queuing as far as I know?
>
>
> "Ollie Riches" <ol**********@phoneanalyser.net> wrote in message
> news:%2****************@TK2MSFTNGP12.phx.gbl...
>> why aren't you using the System.Messaging namespace?
>>
>> The System.Messaging 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**************@TK2MSFTNGP14.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=(MQMessage)m_MQSession.AccessMessage();
>> >
>> >
> m_MQGetMsgOptions=(MQGetMessageOptions)m_MQSession .AccessGetMessageOptions() >> > ;
>> >
>> > m_MQGetMsgOptions.Options=(int)((int)m_MQGetMsgOpt ions.Options |
>> > (int)MQ.MQGMO_COMPLETE_MSG | (int)MQ.MQGMO_NO_SYNCPOINT |
>> > (int)MQ.MQGMO_WAIT);
>> >
>> > m_MQGetMsgOptions.WaitInterval=(int)MQ.MQWI_UNLIMI TED;
>> >
>> > m_MQQueue.Get(getMsg, m_MQGetMsgOptions,
> System.Reflection.Missing.Value);
>> >
>> > strMsg=getMsg.MessageData.ToString();
>> >
>> > if(m_MQSession.ReasonCode==(int)MQ.MQRC_NO_MSG_AVA ILABLE ||
>> > m_MQSession.CompletionCode==(int)MQ.MQCC_FAILED)
>> >
>> > {
>> >
>> > return false;
>> >
>> > }
>> >
>> > return true;
>> >
>> > }
>> >
>> >
>> > public virtual void OnMessage(string strMsg)
>> >
>> > {
>> >
>> > }
>> >
>> > private void Process()
>> >
>> > {
>> >
>> > string str=string.Empty;
>> >
>> > while(!m_bAbort)
>> >
>> > {
>> >
>> > if(Get(ref str))
>> >
>> > {
>> >
>> > OnMessage(str);
>> >
>> > }
>> >
>> > }
>> >
>> > }
>> >
>> > public bool StartPolling()
>> >
>> > {
>> >
>> > ThreadStart start=new ThreadStart(this.Process);
>> >
>> > m_MyThread=new Thread(start);
>> >
>> > m_bAbort=false;
>> >
>> > m_MyThread.Start();
>> >
>> > 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**********@phoneanalyser.net> wrote in message
news:eS**************@TK2MSFTNGP10.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**************@tk2msftngp13.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**********@phoneanalyser.net> wrote in message
news:%2****************@TK2MSFTNGP14.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**************@TK2MSFTNGP11.phx.gbl...
>I am using IBM Websphere MQ Series. Will System.Messaging work with IBM
MQ
> Series also? Its works with MS Queuing as far as I know?
>
>
> "Ollie Riches" <ol**********@phoneanalyser.net> wrote in message
> news:%2****************@TK2MSFTNGP12.phx.gbl...
>> why aren't you using the System.Messaging namespace?
>>
>> The System.Messaging 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**************@TK2MSFTNGP14.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=(MQMessage)m_MQSession.AccessMessage();
>> >
>> >
>

m_MQGetMsgOptions=(MQGetMessageOptions)m_MQSession .AccessGetMessageOptions() >> > ;
>> >
>> > m_MQGetMsgOptions.Options=(int)((int)m_MQGetMsgOpt ions.Options |
>> > (int)MQ.MQGMO_COMPLETE_MSG | (int)MQ.MQGMO_NO_SYNCPOINT |
>> > (int)MQ.MQGMO_WAIT);
>> >
>> > m_MQGetMsgOptions.WaitInterval=(int)MQ.MQWI_UNLIMI TED;
>> >
>> > m_MQQueue.Get(getMsg, m_MQGetMsgOptions,
> System.Reflection.Missing.Value);
>> >
>> > strMsg=getMsg.MessageData.ToString();
>> >
>> > if(m_MQSession.ReasonCode==(int)MQ.MQRC_NO_MSG_AVA ILABLE ||
>> > m_MQSession.CompletionCode==(int)MQ.MQCC_FAILED)
>> >
>> > {
>> >
>> > return false;
>> >
>> > }
>> >
>> > return true;
>> >
>> > }
>> >
>> >
>> > public virtual void OnMessage(string strMsg)
>> >
>> > {
>> >
>> > }
>> >
>> > private void Process()
>> >
>> > {
>> >
>> > string str=string.Empty;
>> >
>> > while(!m_bAbort)
>> >
>> > {
>> >
>> > if(Get(ref str))
>> >
>> > {
>> >
>> > OnMessage(str);
>> >
>> > }
>> >
>> > }
>> >
>> > }
>> >
>> > public bool StartPolling()
>> >
>> > {
>> >
>> > ThreadStart start=new ThreadStart(this.Process);
>> >
>> > m_MyThread=new Thread(start);
>> >
>> > m_bAbort=false;
>> >
>> > m_MyThread.Start();
>> >
>> > 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**************@TK2MSFTNGP14.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**********@phoneanalyser.net> wrote in message
news:eS**************@TK2MSFTNGP10.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**************@tk2msftngp13.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**********@phoneanalyser.net> wrote in message
> news:%2****************@TK2MSFTNGP14.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**************@TK2MSFTNGP11.phx.gbl...
>> >I am using IBM Websphere MQ Series. Will System.Messaging work with IBM > MQ
>> > Series also? Its works with MS Queuing as far as I know?
>> >
>> >
>> > "Ollie Riches" <ol**********@phoneanalyser.net> wrote in message
>> > news:%2****************@TK2MSFTNGP12.phx.gbl...
>> >> why aren't you using the System.Messaging namespace?
>> >>
>> >> The System.Messaging 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**************@TK2MSFTNGP14.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=(MQMessage)m_MQSession.AccessMessage();
>> >> >
>> >> >
>> >
> m_MQGetMsgOptions=(MQGetMessageOptions)m_MQSession .AccessGetMessageOptions() >> >> > ;
>> >> >
>> >> > m_MQGetMsgOptions.Options=(int)((int)m_MQGetMsgOpt ions.Options |
>> >> > (int)MQ.MQGMO_COMPLETE_MSG | (int)MQ.MQGMO_NO_SYNCPOINT |
>> >> > (int)MQ.MQGMO_WAIT);
>> >> >
>> >> > m_MQGetMsgOptions.WaitInterval=(int)MQ.MQWI_UNLIMI TED;
>> >> >
>> >> > m_MQQueue.Get(getMsg, m_MQGetMsgOptions,
>> > System.Reflection.Missing.Value);
>> >> >
>> >> > strMsg=getMsg.MessageData.ToString();
>> >> >
>> >> > if(m_MQSession.ReasonCode==(int)MQ.MQRC_NO_MSG_AVA ILABLE ||
>> >> > m_MQSession.CompletionCode==(int)MQ.MQCC_FAILED)
>> >> >
>> >> > {
>> >> >
>> >> > return false;
>> >> >
>> >> > }
>> >> >
>> >> > return true;
>> >> >
>> >> > }
>> >> >
>> >> >
>> >> > public virtual void OnMessage(string strMsg)
>> >> >
>> >> > {
>> >> >
>> >> > }
>> >> >
>> >> > private void Process()
>> >> >
>> >> > {
>> >> >
>> >> > string str=string.Empty;
>> >> >
>> >> > while(!m_bAbort)
>> >> >
>> >> > {
>> >> >
>> >> > if(Get(ref str))
>> >> >
>> >> > {
>> >> >
>> >> > OnMessage(str);
>> >> >
>> >> > }
>> >> >
>> >> > }
>> >> >
>> >> > }
>> >> >
>> >> > public bool StartPolling()
>> >> >
>> >> > {
>> >> >
>> >> > ThreadStart start=new ThreadStart(this.Process);
>> >> >
>> >> > m_MyThread=new Thread(start);
>> >> >
>> >> > m_bAbort=false;
>> >> >
>> >> > m_MyThread.Start();
>> >> >
>> >> > 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**********@phoneanalyser.net> wrote in message
news:eQ*************@TK2MSFTNGP12.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**************@TK2MSFTNGP14.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**********@phoneanalyser.net> wrote in message
news:eS**************@TK2MSFTNGP10.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**************@tk2msftngp13.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**********@phoneanalyser.net> wrote in message
> news:%2****************@TK2MSFTNGP14.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**************@TK2MSFTNGP11.phx.gbl...
>> >I am using IBM Websphere MQ Series. Will System.Messaging work with IBM
> MQ
>> > Series also? Its works with MS Queuing as far as I know?
>> >
>> >
>> > "Ollie Riches" <ol**********@phoneanalyser.net> wrote in message
>> > news:%2****************@TK2MSFTNGP12.phx.gbl...
>> >> why aren't you using the System.Messaging namespace?
>> >>
>> >> The System.Messaging 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**************@TK2MSFTNGP14.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=(MQMessage)m_MQSession.AccessMessage();
>> >> >
>> >> >
>> >
>

m_MQGetMsgOptions=(MQGetMessageOptions)m_MQSession .AccessGetMessageOptions() >> >> > ;
>> >> >
>> >> > m_MQGetMsgOptions.Options=(int)((int)m_MQGetMsgOpt ions.Options | >> >> > (int)MQ.MQGMO_COMPLETE_MSG | (int)MQ.MQGMO_NO_SYNCPOINT |
>> >> > (int)MQ.MQGMO_WAIT);
>> >> >
>> >> > m_MQGetMsgOptions.WaitInterval=(int)MQ.MQWI_UNLIMI TED;
>> >> >
>> >> > m_MQQueue.Get(getMsg, m_MQGetMsgOptions,
>> > System.Reflection.Missing.Value);
>> >> >
>> >> > strMsg=getMsg.MessageData.ToString();
>> >> >
>> >> > if(m_MQSession.ReasonCode==(int)MQ.MQRC_NO_MSG_AVA ILABLE ||
>> >> > m_MQSession.CompletionCode==(int)MQ.MQCC_FAILED)
>> >> >
>> >> > {
>> >> >
>> >> > return false;
>> >> >
>> >> > }
>> >> >
>> >> > return true;
>> >> >
>> >> > }
>> >> >
>> >> >
>> >> > public virtual void OnMessage(string strMsg)
>> >> >
>> >> > {
>> >> >
>> >> > }
>> >> >
>> >> > private void Process()
>> >> >
>> >> > {
>> >> >
>> >> > string str=string.Empty;
>> >> >
>> >> > while(!m_bAbort)
>> >> >
>> >> > {
>> >> >
>> >> > if(Get(ref str))
>> >> >
>> >> > {
>> >> >
>> >> > OnMessage(str);
>> >> >
>> >> > }
>> >> >
>> >> > }
>> >> >
>> >> > }
>> >> >
>> >> > public bool StartPolling()
>> >> >
>> >> > {
>> >> >
>> >> > ThreadStart start=new ThreadStart(this.Process);
>> >> >
>> >> > m_MyThread=new Thread(start);
>> >> >
>> >> > m_bAbort=false;
>> >> >
>> >> > m_MyThread.Start();
>> >> >
>> >> > return true;
>> >> >
>> >> > }
>> >> >
>> >> >
>> >>
>> >>
>> >
>> >
>>
>>
>
>



Nov 17 '05 #9

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

Similar topics

1
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...
26
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...
20
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...
1
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...
5
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...
2
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) ...
8
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....
3
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...
2
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.