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 16 3844
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**********@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
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**********@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
"Neil Stevens" <ne**********@b lueyonder.co.uk > schrieb 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.
Out of interest: When do you need this?
--
Armin
"Neil Stevens" <ne**********@b lueyonder.co.uk > schrieb 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.
Out of interest: When do you need this?
--
Armin
> 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.
Give us more details on what you're really trying to do.
The fact there are threads and that these threads can be priorized in .NET
changes the whole picture. If you want to yield to another application just
lower your main threads priority, or higten the other app's thread, etc...
You don't give us enough info to really know what you want to do so I might
be totally off...
Alex.
> 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.
Give us more details on what you're really trying to do.
The fact there are threads and that these threads can be priorized in .NET
changes the whole picture. If you want to yield to another application just
lower your main threads priority, or higten the other app's thread, etc...
You don't give us enough info to really know what you want to do so I might
be totally off...
Alex.
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. The
following code is an example of the code i have
{Method that navigates to a page in a web browser control}
Set wb = New WebBrowser
wb.Navigate htmlPageToLoad
Dim hDoc as HTMLDocument
Set hDoc = wb.Document
If hDoc Is Nothing Then
Exit Function
End If
Do
Yield()
Loop Until (LCase$(hDoc.Re adyState) = "complete" Or LCase$(hDoc.Rea dyState)
= "interactiv e") And wb.Busy = False
{Returns hDoc if it is not nothing}
' This is the yield method, it process any post message on the stack - not
keyboard or mouse messages
Public Sub Yield()
Dim m As MSG
While PeekMessage(m, 0, 0, 0, PM_REMOVE Or PM_QS_POSTMESSA GE Or
PM_QS_PAINT)
TranslateMessag e m
DispatchMessage m
Wend
End Sub
I hope this makes things a little more clearer, i have other parts of the
code where this type of method is used.
I also use the PostMessage to post a close message from a handling UI class
to a form
Public Sub PostCloseMessag e(ByVal hWnd As Long)
Posts a WM_CLOSE message to the target hWnd
PostMessage hWnd, WM_CLOSE, 0, 0
End Sub
And would like to know if there is an equivalant .NET Framework method.
Thanks for your time in advance
Neil
"Sin" <br****@hotmail .com> wrote in message
news:NY******** ************@we ber.videotron.n et... 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.
Give us more details on what you're really trying to do.
The fact there are threads and that these threads can be priorized in .NET changes the whole picture. If you want to yield to another application
just lower your main threads priority, or higten the other app's thread, etc...
You don't give us enough info to really know what you want to do so I
might be totally off...
Alex.
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. The
following code is an example of the code i have
{Method that navigates to a page in a web browser control}
Set wb = New WebBrowser
wb.Navigate htmlPageToLoad
Dim hDoc as HTMLDocument
Set hDoc = wb.Document
If hDoc Is Nothing Then
Exit Function
End If
Do
Yield()
Loop Until (LCase$(hDoc.Re adyState) = "complete" Or LCase$(hDoc.Rea dyState)
= "interactiv e") And wb.Busy = False
{Returns hDoc if it is not nothing}
' This is the yield method, it process any post message on the stack - not
keyboard or mouse messages
Public Sub Yield()
Dim m As MSG
While PeekMessage(m, 0, 0, 0, PM_REMOVE Or PM_QS_POSTMESSA GE Or
PM_QS_PAINT)
TranslateMessag e m
DispatchMessage m
Wend
End Sub
I hope this makes things a little more clearer, i have other parts of the
code where this type of method is used.
I also use the PostMessage to post a close message from a handling UI class
to a form
Public Sub PostCloseMessag e(ByVal hWnd As Long)
Posts a WM_CLOSE message to the target hWnd
PostMessage hWnd, WM_CLOSE, 0, 0
End Sub
And would like to know if there is an equivalant .NET Framework method.
Thanks for your time in advance
Neil
"Sin" <br****@hotmail .com> wrote in message
news:NY******** ************@we ber.videotron.n et... 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.
Give us more details on what you're really trying to do.
The fact there are threads and that these threads can be priorized in .NET changes the whole picture. If you want to yield to another application
just lower your main threads priority, or higten the other app's thread, etc...
You don't give us enough info to really know what you want to do so I
might be totally off...
Alex.
* "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/> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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).
|
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 /...
|
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...
|
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
|
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
| |
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()
|
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...
|
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?
|
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;
|
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
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
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,...
|
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...
|
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...
|
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...
|
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();...
|
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
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |