473,473 Members | 2,215 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Hadnling windows messages when in big loop

I have a project, that loops through a lot of wmi queries, and while its
looping, the window will not repaint, I can't move or size the window.
I remember having a similar problem back in an excel macro, and I ran a
command that told the application to process windows messages.
Is there such a thing in vb.net, or is there a way to make sure windows
messages get processed in big cpu greedy loops?

Also, Is it a big deal to make code multy threaded? Where should a person
start looking for info regarding multitreaded programming in vb.net?
Nov 21 '05 #1
3 2025
In your loop you can call: Application.DoEvents()
--
Mike

Mike McIntyre
Visual Basic MVP
www.getdotnetcode.com
"Fred Flintstone" <de**********@rogers.com> wrote in message
news:8d********************@rogers.com...
I have a project, that loops through a lot of wmi queries, and while its
looping, the window will not repaint, I can't move or size the window.
I remember having a similar problem back in an excel macro, and I ran a
command that told the application to process windows messages.
Is there such a thing in vb.net, or is there a way to make sure windows
messages get processed in big cpu greedy loops?

Also, Is it a big deal to make code multy threaded? Where should a person
start looking for info regarding multitreaded programming in vb.net?

Nov 21 '05 #2
Thanks, that was just the sort of answer I was looking for.

"Mike McIntyre" <mi****@dotnetshowandtell.com> wrote in message
news:eZ****************@TK2MSFTNGP11.phx.gbl...
In your loop you can call: Application.DoEvents()
--
Mike

Mike McIntyre
Visual Basic MVP
www.getdotnetcode.com
"Fred Flintstone" <de**********@rogers.com> wrote in message
news:8d********************@rogers.com...
I have a project, that loops through a lot of wmi queries, and while its
looping, the window will not repaint, I can't move or size the window.
I remember having a similar problem back in an excel macro, and I ran a
command that told the application to process windows messages.
Is there such a thing in vb.net, or is there a way to make sure windows
messages get processed in big cpu greedy loops?

Also, Is it a big deal to make code multy threaded? Where should a
person start looking for info regarding multitreaded programming in
vb.net?


Nov 21 '05 #3
Hey Fred,

My first answer will help with repainting but not with moving the window.
Sorry I missed that requirement on my first read.

Any easy way to use threading is to get started with asynchronous delegates.

Here is a good article:
http://msdn.microsoft.com/msdnmag/is...s/default.aspx

Once you create a Delegate through which to call the method with your big
loop, repainting, moving, and other user interface actions will work while
the big loop is processing your wmi queries.
--
Mike

Mike McIntyre
Visual Basic MVP
www.getdotnetcode.com


"Fred Flintstone" <de**********@rogers.com> wrote in message
news:8d********************@rogers.com...
I have a project, that loops through a lot of wmi queries, and while its
looping, the window will not repaint, I can't move or size the window.
I remember having a similar problem back in an excel macro, and I ran a
command that told the application to process windows messages.
Is there such a thing in vb.net, or is there a way to make sure windows
messages get processed in big cpu greedy loops?

Also, Is it a big deal to make code multy threaded? Where should a person
start looking for info regarding multitreaded programming in vb.net?

Nov 21 '05 #4

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

Similar topics

2
by: Cantankerous Old Git | last post by:
I am trying to write a program that I hope to get working as a command-line app to start with, and then eventually use a windows service wrapper to call it as a service. Its purpose is to attach...
4
by: davidstummer | last post by:
I was wondering if anyone could point me to an example. Currently i have a c++ program which calls and c++ dll (i created both). The dll uses SendMessage to pass messages back to the calling .exe,...
14
by: Brian Keating EI9FXB | last post by:
I wonder can anyone reccomment a solution to this problem. Let me explain, I've services running on my system, my application receives diagnostic messages from these services, what i want to do...
3
by: Brian Keating EI9FXB | last post by:
Hello again, I've already placed a few posts on this topic. This time i've a simple application that exhibits my problem, I've placed sample solution 8k on my website should anyone be interested...
8
by: Brian Keating EI9FXB | last post by:
Would I be correct in saying that the only way to get a user message into a Windows form would be to use P/Invoke with Message? Of is there some part of the .NET API that I am totally un aware...
1
by: benmorganpowell | last post by:
I have a small windows service which connects to a POP3 server at defined intervals, scans the available messages, extracts the required information and inserts the data into a SQL database. I am...
14
by: | last post by:
Hi All, I am little confused here, hope you can help me. While processing WM_POWERBROADCAST (wParam=PBT_APMQUERYSUSPEND), I MUST to do some lengthy operation(30 sec) before system Suspends or...
3
by: Neal | last post by:
managed C++ VS 2003 I have a beginner question about windows forms.... I need to call a function when a certain limit has been reached, now with the way VS sets up the .NET windows Form I get...
28
by: | last post by:
I have a multi threaded windows form application that runs great after calling Application.Run(). Application.Run is required for a COM component I a using in the app (required for message loop). ...
0
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...
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,...
0
jinu1996
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...
1
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...
0
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...
1
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
muto222
php
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.