消息队列 [英] Message Queues

查看:91
本文介绍了消息队列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我想实现一个消息队列,就像我以前在vb6中一样,

如下: -


将myMsg调暗为MSG

while(PeekMessage(myMsg,hWnd,0,0))

如果myMsg.Msg = WM_QUIT那么

结束

结束如果

TranslateMessage(myMsg)

DispatchMessage(myMsg)

wend

(我知道语法可能不正确)


有没有办法可以在VB.NET中实现与此类似的东西,我

需要实现这种消息循环作为执行产量的一部分,我不想使用DoEvents(),因为我使用的问题需要

它在过去,这种方法在VB6中被证明是最好的yilding

执行。


有人可以提供一些示例代码,说明如何执行此操作VB.NET或

给我一个很好的互联网资源。


提前谢谢

Neil

Hi,

I would like to implements a message queue much like i used to in vb6 as
below:-

dim myMsg as MSG
while (PeekMessage(myMsg, hWnd, 0, 0))
if myMsg.Msg = WM_QUIT Then
End
end if
TranslateMessage(myMsg)
DispatchMessage(myMsg)
wend
(I know the syntax probably isnt correct)

Is there a way that i can implements something similar to this in VB.NET, i
need to implement this kind of message loop as part of an execution yield, i
dont want to use DoEvents() because of the propblems i have had with using
it in the past and this method has proved the best in VB6 for yilding
execution.

Could somebody provide some example code of how to do this in VB.NET or
point me to a good resource on the internet.

Thanks in advance
Neil

解决方案

在消息队列和消息类下查找帮助。例如,它的

已经在大多数情况下使用可覆盖的函数来拦截

来自Control类的WndProc。看看这可能是一个好的开始。


HTH,

CJ

" Neil Stevens" <是ne ********** @ blueyonder.co.uk>在留言中写道

news:uP ************* @ tk2msftngp13.phx.gbl ...
Look in your help under messagequeues, and message class. For instance, its
already intercepted for you in most cases with the overridable function
WndProc from the Control class. Check out that and it may be a good start.

HTH,
CJ
"Neil Stevens" <ne**********@blueyonder.co.uk> wrote in message
news:uP*************@tk2msftngp13.phx.gbl...


我想实现一个消息队列,就像我以前在vb6中使用的那样:

dim myMsg as MSG
while(PeekMessage(myMsg,hWnd) ,0,0))
如果myMsg.Msg = WM_QUIT那么结束
结束如果
TranslateMessage(myMsg)
DispatchMessage(myMsg)
wend
(我知道语法可能不正确)

有没有办法在VB.NET中实现类似的东西,
i需要实现这种消息循环执行产量的一部分,
i不想使用DoEvents()因为我过去使用过它的问题而且这种方法在VB6中被证明是最好的执行执行。

有人可以提供一些示例代码,说明如何在VB.NET中执行此操作或
指向我在互联网上的良好资源。

提前感谢
尼尔
Hi,

I would like to implements a message queue much like i used to in vb6 as
below:-

dim myMsg as MSG
while (PeekMessage(myMsg, hWnd, 0, 0))
if myMsg.Msg = WM_QUIT Then
End
end if
TranslateMessage(myMsg)
DispatchMessage(myMsg)
wend
(I know the syntax probably isnt correct)

Is there a way that i can implements something similar to this in VB.NET, i need to implement this kind of message loop as part of an execution yield, i dont want to use DoEvents() because of the propblems i have had with using
it in the past and this method has proved the best in VB6 for yilding
execution.

Could somebody provide some example code of how to do this in VB.NET or
point me to a good resource on the internet.

Thanks in advance
Neil



在消息队列和消息类下查找帮助。例如,它的

已经在大多数情况下使用可覆盖的函数来拦截

来自Control类的WndProc。看看这可能是一个好的开始。


HTH,

CJ

" Neil Stevens" <是ne ********** @ blueyonder.co.uk>在留言中写道

news:uP ************* @ tk2msftngp13.phx.gbl ...
Look in your help under messagequeues, and message class. For instance, its
already intercepted for you in most cases with the overridable function
WndProc from the Control class. Check out that and it may be a good start.

HTH,
CJ
"Neil Stevens" <ne**********@blueyonder.co.uk> wrote in message
news:uP*************@tk2msftngp13.phx.gbl...


我想实现一个消息队列,就像我以前在vb6中使用的那样:

dim myMsg as MSG
while(PeekMessage(myMsg,hWnd) ,0,0))
如果myMsg.Msg = WM_QUIT那么结束
结束如果
TranslateMessage(myMsg)
DispatchMessage(myMsg)
wend
(我知道语法可能不正确)

有没有办法在VB.NET中实现类似的东西,
i需要实现这种消息循环执行产量的一部分,
i不想使用DoEvents()因为我过去使用过它的问题而且这种方法在VB6中被证明是最好的执行执行。

有人可以提供一些示例代码,说明如何在VB.NET中执行此操作或
指向我在互联网上的良好资源。

提前感谢
尼尔
Hi,

I would like to implements a message queue much like i used to in vb6 as
below:-

dim myMsg as MSG
while (PeekMessage(myMsg, hWnd, 0, 0))
if myMsg.Msg = WM_QUIT Then
End
end if
TranslateMessage(myMsg)
DispatchMessage(myMsg)
wend
(I know the syntax probably isnt correct)

Is there a way that i can implements something similar to this in VB.NET, i need to implement this kind of message loop as part of an execution yield, i dont want to use DoEvents() because of the propblems i have had with using
it in the past and this method has proved the best in VB6 for yilding
execution.

Could somebody provide some example code of how to do this in VB.NET or
point me to a good resource on the internet.

Thanks in advance
Neil



" Neil Stevens" <是ne ********** @ blueyonder.co.uk> schrieb
"Neil Stevens" <ne**********@blueyonder.co.uk> schrieb
我想实现一个类似于我以前在vb6中使用的消息队列,如下所示: -

将myMsg调暗为MSG
while( PeekMessage(myMsg,hWnd,0,0))
如果myMsg.Msg = WM_QUIT那么结束
结束如果
TranslateMessage(myMsg)
DispatchMessage(myMsg)< (我知道语法可能不正确)

有没有办法在VB.NET中实现类似的东西,我需要实现这种消息循环作为执行产量的一部分,我不想使用DoEvents(),因为我过去使用过它的
问题,这种方法已经证明了最好的VB6用于执行yilding。
I would like to implements a message queue much like i used to in vb6
as below:-

dim myMsg as MSG
while (PeekMessage(myMsg, hWnd, 0, 0))
if myMsg.Msg = WM_QUIT Then
End
end if
TranslateMessage(myMsg)
DispatchMessage(myMsg)
wend
(I know the syntax probably isnt correct)

Is there a way that i can implements something similar to this in
VB.NET, i need to implement this kind of message loop as part of an
execution yield, i dont want to use DoEvents() because of the
propblems i have had with using it in the past and this method has
proved the best in VB6 for yilding execution.




出于兴趣:你什么时候需要这个?

-

Armin



Out of interest: When do you need this?
--
Armin


这篇关于消息队列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆