473,657 Members | 2,597 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to run message pump in .NET?

Hi, all,

Can I run message pump in C# to yield cotrol to other
window messages while my main thread is waiting for
lengthy procesing to finish?

In C++, PeekMessage(), TranslateMessag e(), and
DispatchMessage () will do the job. For some reason, this
seems not working in managed C++.

Any suggestions?

Thanks in advance.

Jianxin
Nov 13 '05 #1
1 11533
Simple, spawn a new thread to run your "lengthy processing", a UI thread shouldn't do anything else than handle the UI.

Willy.

Jianxin wrote:
|| Hi, all,
||
|| Can I run message pump in C# to yield cotrol to other
|| window messages while my main thread is waiting for
|| lengthy procesing to finish?
||
|| In C++, PeekMessage(), TranslateMessag e(), and
|| DispatchMessage () will do the job. For some reason, this
|| seems not working in managed C++.
||
|| Any suggestions?
||
|| Thanks in advance.
||
|| Jianxin
Nov 13 '05 #2

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

Similar topics

2
6903
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 to an already running (not ours) service using an API DLL, where it will do houskeeping and monitoring tasks. This is where it all gets strange. Although I can make calls into the API and do things proactively, when I register a callback for...
2
1405
by: Ken Williams | last post by:
Hi I have a DLL written in C/C++ that is passed Hwnd when it is called. When the DLL has data for the calling program it uses Hwnd to post a windows message back to the calling program saying it wants attention. I have looked at Delegates and events, but it's not obvious how I can replicate this feature in C#. Anyone got a sample of code that does something similar in C# ?
3
2844
by: Andrew Baker | last post by:
OK this has me perplexed, puzzled and bamboozled! I have a remoting service which I displayed a message box in. I then wondered what would happen if a client made a call to the service while the message box was being displayed. Since the call comes in on a different thread the client call was not blocked. This seemed to make sense to me. Next I thought, what will happen when the client calls into the server if I try to use a delegate...
8
16337
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 of? Thanks for any help Brian
6
20066
by: orekin | last post by:
Hi There I have been trying to come to grips with Application.Run(), Application.Exit() and the Message Pump and I would really appreciate some feedback on the following questions .. There are quite a few words in this post but the questions are actually quite similar and should be fairly quick to answer ... (1) What is Happening with the Threads
0
2437
by: | last post by:
Hi there movers & shakers, The example below demonstrates a behaviour that is anoying the tits off of me! It doesn't happen whilst debugging from the IDE only when you run the compiled exe from windows explorer. I'm basically trying to display a splash screen in a seperate thread which has it's own message pump. When the call to Application.ExitThread() closes down the splash screen's thread, form and message pump, the main form (and...
17
23700
by: nicolas.hilaire | last post by:
Hi all, i'm doing a quite long treatment in a function, and i'm showing the progress of the treatment with a progressbar. The code is something like this : for each(entry in entries) // about 100 entries { TreatmentForOneOr2Secs(); this->progressBar1->PerformStep();
8
5256
by: Dave | last post by:
I am trying to write an event-driven application with no main window that runs "forever". It waits on a named event and then displays a window depending on data pased in a memory-mapped file. I started with a standard console application and it all works fine, except that it does not terminate tidily when the user logs off/shuts down. So, I figured I needed a message loop to pick up WM_QUIT. I studied the code in "Waiting in a message loop"...
2
1273
by: sean.j.forbes | last post by:
Is there an easy way to access the numer of messages queued (pending invocation) on the message pump? This doesn't have to be from code, maybe some application like Spy++ provides this information? Thanks, Sean
0
1000
by: cold80 | last post by:
I would like to understand more about how message pumps work in Windows applications, especially in .NET applications. Can you give me some good references? Above all I would like to know more about the connections between the message pump, the forms of my application and the threads. Thank you in advance Cold
0
8305
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,...
0
8823
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8730
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 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...
1
6163
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 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...
0
4151
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
4301
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
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
1950
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1607
bsmnconsultancy
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...

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.