473,831 Members | 2,055 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Message Queues

Hi,

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

dim myMsg as MSG
while (PeekMessage(my Msg, hWnd, 0, 0))
if myMsg.Msg = WM_QUIT Then
End
end if
TranslateMessag e(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
Nov 20 '05
16 3845
* "Neil Stevens" <ne**********@b lueyonder.co.uk > scripsit:
I would like to implements a message queue much like i used to in vb6 as
below:-

dim myMsg as MSG
while (PeekMessage(my Msg, hWnd, 0, 0))
if myMsg.Msg = WM_QUIT Then
End
end if
TranslateMessag e(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.


I think you can use the same code in VB.NET, but why do you need that?
Maybe there is a better, managed solution.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #11
"Neil Stevens" <ne**********@b lueyonder.co.uk > schrieb
I hope this makes things a little more clearer, i have other parts of
the code where this type of method is used.


I'd wait for the Documentcomplet e event, then show the form. Or, as the user
wants to know what's going on, I'd show the Form first.
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #12
"Neil Stevens" <ne**********@b lueyonder.co.uk > schrieb
I hope this makes things a little more clearer, i have other parts of
the code where this type of method is used.


I'd wait for the Documentcomplet e event, then show the form. Or, as the user
wants to know what's going on, I'd show the Form first.
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #13
Sin
> What i have in the application is a form that opens a web document, i have
a
method that sets the document property of the web browser control. The html document has an amount of processing that has to be completed before it can be shown to the user, so the form is hidden the web browser controls
document property is set to the html page and the html page starts
processing itself.

What i have then is a Yield method which processing the message queue so
that the application doesnt lock up while the html document is processing,
when the document is loaded then the method which sets up the document
property can continue to set up the form sizes and finally show the form.

As i said i have had some problems with the DoEvents method and personally
dont like this for of yielding execution, i have found that during a
DoEvents execution pops off to some other part of the application and i want to prevent this until the form has fully loaded and been shown.


I haven't had to work with a similar problem but I suppose you could kick a
thread in which you would assign the url to the web control and then do the
sizing stuff.... All while your mean thread continues to process events...
If you need to prevent mouse/keyboard input while that happens, just disable
the main form at start of thread and re-enable at end of thread...

Would that work?

Alex.
Nov 20 '05 #14
Sin
> What i have in the application is a form that opens a web document, i have
a
method that sets the document property of the web browser control. The html document has an amount of processing that has to be completed before it can be shown to the user, so the form is hidden the web browser controls
document property is set to the html page and the html page starts
processing itself.

What i have then is a Yield method which processing the message queue so
that the application doesnt lock up while the html document is processing,
when the document is loaded then the method which sets up the document
property can continue to set up the form sizes and finally show the form.

As i said i have had some problems with the DoEvents method and personally
dont like this for of yielding execution, i have found that during a
DoEvents execution pops off to some other part of the application and i want to prevent this until the form has fully loaded and been shown.


I haven't had to work with a similar problem but I suppose you could kick a
thread in which you would assign the url to the web control and then do the
sizing stuff.... All while your mean thread continues to process events...
If you need to prevent mouse/keyboard input while that happens, just disable
the main form at start of thread and re-enable at end of thread...

Would that work?

Alex.
Nov 20 '05 #15
Neil,
Is there a way that i can implements something similar to this in VB.NET, i
Yes: System.Windows. Forms.Applicati on.DoEvents

Or use Threads.
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. VB.NET is NOT VB6, problems you may or may not have had in VB6 do not
necessarily exist in VB.NET. New runtime, new framework, and sad to say new
problems.
Could somebody provide some example code of how to do this in VB.NET or
point me to a good resource on the internet. My first advice would be not to attempt it: as you are probably causing more
problems then helping in either VB6 or VB.NET, however you can use the same
technique in VB.NET that you used in VB6!

Declare your functions (PeekMessage,Tr anslateMessage, DispatchMessage ) at the
top of your source file & call the them. Remember that Integer is 32bit in
VB.NET while only 16 bit in VB6.

I would seriously look at using a thread rather then some "hack" that may
cause other "hidden" problems...

Hope this helps
Jay

"Neil Stevens" <ne**********@b lueyonder.co.uk > wrote in message
news:uP******** *****@tk2msftng p13.phx.gbl... Hi,

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

dim myMsg as MSG
while (PeekMessage(my Msg, hWnd, 0, 0))
if myMsg.Msg = WM_QUIT Then
End
end if
TranslateMessag e(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

Nov 20 '05 #16
Neil,
Is there a way that i can implements something similar to this in VB.NET, i
Yes: System.Windows. Forms.Applicati on.DoEvents

Or use Threads.
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. VB.NET is NOT VB6, problems you may or may not have had in VB6 do not
necessarily exist in VB.NET. New runtime, new framework, and sad to say new
problems.
Could somebody provide some example code of how to do this in VB.NET or
point me to a good resource on the internet. My first advice would be not to attempt it: as you are probably causing more
problems then helping in either VB6 or VB.NET, however you can use the same
technique in VB.NET that you used in VB6!

Declare your functions (PeekMessage,Tr anslateMessage, DispatchMessage ) at the
top of your source file & call the them. Remember that Integer is 32bit in
VB.NET while only 16 bit in VB6.

I would seriously look at using a thread rather then some "hack" that may
cause other "hidden" problems...

Hope this helps
Jay

"Neil Stevens" <ne**********@b lueyonder.co.uk > wrote in message
news:uP******** *****@tk2msftng p13.phx.gbl... Hi,

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

dim myMsg as MSG
while (PeekMessage(my Msg, hWnd, 0, 0))
if myMsg.Msg = WM_QUIT Then
End
end if
TranslateMessag e(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

Nov 20 '05 #17

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

Similar topics

0
1891
by: Aki Niimura | last post by:
Hello everyone. I'm trying to control a program from a Python program using IPC. Although using a socket is a common choice for such applications, I would like to use SysV message queues because I don't need to parse the stream. I thought Python had a support of SysV message queues (I have found almost anything I need in Python library modules so far).
0
2986
by: badtemper | last post by:
Is there any way to use perl or any other programming language to perform a "qchk -A" from a web page and see the listing? My problem is that I manage the network for a medical facility that is staffed 24/7/365 and when they are replacing the label stock on their barcode printers or the printer is taken offline, the queues are dropping. I would like to have a web page that would like the status of all the queues, along with a start /...
4
2773
by: Tingo | last post by:
Hi all, Is it possible to create a message queue with a specific ID? I want to do this because I'm trying to write a piece of software which restores communicating processes (which communicate through message queues) when there is a machine failure. When restarting the machine I need to setup the message queues as they were originally. I find that given the same key, when creating a queue, the queue ID is not always the same value. Is...
1
3264
by: Susan | last post by:
I've had to separate my application into 2 apps. I need to second app to poll the message queue for certain messages from the main app. Does someone have some code on how to do this? I have the first app sending the messages, but only have the second app able to respond once. The second app is started from the first app as an independent process. Thanks, Susan
3
1946
by: Brian Keating | last post by:
hello, doesn anyone know how to deploy message queues? I've got a program which uses message queues and i wish to deploy it, one click deployment in vs2005 doesn't allow me to specify message queues and a setup project doesn't allow me to specify message queues. Any help appreciated thanks Brian
0
1190
by: sam | last post by:
Hi, I have windows services appliaction. Application reads message from MS message queuing. I have short code example below of my application. I have different process points these point have queues in message queuing. Problem is application some time don't read messages from message queues. Messages and NOT pickedup from queue. public class Messages { public Messages()
0
1553
by: sam | last post by:
Hi, Im using windows froms exe application to read and send messages to private message queues. Using threads how can I keep reading all the messages from MS private message queuing without lossing any message thread. Its seem to me that some messages stays in the private message queue and want pickup by " MessageQueue.Receive()". I have short code example below which im using in my application, The code below won't read every time...
2
2274
by: DBC User | last post by:
Hi All, I am going to develop two application which will talk to each other using MSMQ. I have couple of questions 1. Do we need to install anything extra in client PC to use MSMQ? Since clients may not have all the XP components installed. Is there a way to work around this issue if any? 2. Does the user need to be an admin to use the MSMQ since the app will run under user permission?
1
1770
by: Safalra | last post by:
A long time ago when I used a browser that didn't support the shift or unshift methods of the array object, I came up with an implementation of queues that guaranteed amortised constant time dequeuing by only moving elements in the array when the 'space' at the front of the array was as long as the queue it represented. In modern Javascript it would look like this: function Queue(){ var queue=new Array(); var queueSpace=0;
1
3386
by: ericstein81 | last post by:
I am trying to write a program that uses three queues for inputs of numbers. The problem i am having is I am not quite sure how to designate the seperate queues. can they be named as queue(a), queue(b) and queue(c)? how can i define the different queues for the compiler to understand. Sorry if this is confusing, thank you
0
9794
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9642
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
10538
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
10210
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...
0
9319
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5622
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...
0
5788
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4419
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
3967
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.