Questions tagged [message-loop]
70 questions
1
vote
1 answer
Win32: What is making my message loop work incorrectly in that example?
I recently ran into a situation where I wanted to use a modeless dialog in Win32's.
Win32: Toolbar dialog seems to never get focus and causes the main window to process slow!?
And I figured out that this was my message loop:
int WINAPI…

Will Marcouiller
- 23,773
- 22
- 96
- 162
1
vote
2 answers
How to push a message loop in WinForms?
In WPF, I can push a message loop using Dispatcher.PushFrame.
What is the equivalent in WinForms? I'm familiar with DoEvents but that must be called in a loop which can spin the CPU instead of the very efficient approach of just waiting for a…

Andrew Arnott
- 80,040
- 26
- 132
- 171
1
vote
1 answer
Listening for incoming messages from TCP server causes StackOverflow
I need to continuously listen for messages from my C# TCP server, so I do it in separate thread:
private void StartMessageReceivingLoop()
{
new Thread(){
public void run()
{
String msg = null;
try
…

matt-pielat
- 1,659
- 3
- 20
- 33
1
vote
0 answers
Why does (or how to detect when) my DDE conversation hang randomly from Excel?
Nature of the Problem:
I have a macro enabled excel sheet that successfully establishes a DDE connection and conversation with a terminal application for the ManMan database system, Minisoft. About 95% of the time the DDE works properly, however…

neogeek23
- 813
- 1
- 12
- 23
1
vote
0 answers
Low Level Keyboard Hook called intermittently, GetMessage never returns
I set up a low level keyboard hook in a worker thread that also runs a message loop. About 1/3 of my key strokes trigger the hook function and none release the GetMessage function in my message loop. Because of something related to the latter,…

vlad417
- 313
- 1
- 3
- 10
1
vote
1 answer
How to run multiple plug-in-like XNA games in one WinForms window
I want to create a (WinForms) application which consists of multiple panels. For each panel, I want to be able to assign a .dll file:
Those .dll files should contain XNA games that should be rendered into the respective panel.
I can load those…

pascalhein
- 5,700
- 4
- 31
- 44
1
vote
1 answer
Application.DoEvents() and freezing on some machine
I have a winforms application which makes calls to Application.DoEvents(). Now the app freezes around the time this method is called (no surprise).
However, this only happens on some machines. Is it fair to say that this would be due to machine…

GurdeepS
- 65,107
- 109
- 251
- 387
1
vote
2 answers
Window moving and resizing interferes with MsgWaitForMultipleObjects
I have an application that message-loops using MsgWaitForMultipleObjects to catch additional events while pumping ui messages. It seems that as soon as a window is being moved or resized, DefWindowProc begins it's own message loop until the mouse is…

sold
- 2,041
- 5
- 25
- 32
1
vote
1 answer
Unable to update the UI components in C#
I am writing a program to monitor the status of various devices across a network. The details of these devices are stored in a file. The HandleClientComm class reads information about these devices from the file and establishes a tcp connection with…

Aswathy
- 13
- 3
1
vote
4 answers
Application.Run(), Application.Exit() and timers
I have a winforms application that I will be calling through the task scheduler to download files and insert them to a database. However it is unpredictable when the files are available so I have used timer (System.Windws.Forms.Timer) to poll for…

Dan
- 45,079
- 17
- 88
- 157
1
vote
2 answers
What is the cleanest way to notify GUI to update in wxWidgets?
I have a small application that needs to update GUI elements if some event occurs in lower levels, say, socket goes off-line, or something like that.
In Windows, I could use PostMessage which would be sent through the chain to all Windows, and the…

Coder
- 3,695
- 7
- 27
- 42
1
vote
2 answers
Runnable posted by handler sees wrong object state (race condition?)
I'm running into a very strange issue here with wrong object state that I see in methods posted as Runnables using Handler.postDelayed. I use this to schedule draw calls for 2D drawing, and this draw code checks certain state fields (like ints and…

mxk
- 43,056
- 28
- 105
- 132
1
vote
3 answers
Sleep() in windows message loop?
Does a Sleep(sometime) serve a purpose in the typical infinite window message loop, or is it just useless or even harmful?
Some examples contain the Sleep, most of them do not.
// Main message loop:
MSG msg;
while (GetMessage(&msg, NULL,…

Horst Walter
- 13,663
- 32
- 126
- 228
0
votes
2 answers
C++ How to allowing for Low Level Mouse callback to get called in a loop/ when wait for input
So I am trying to create a console button base (using low level mouse hook) for a console menu (which uses arrow keys and enter key for controls) that I have created before and both work fine alone but I have ran into a couple issues. the mouse hook…

Norzka
- 47
- 3
- 10
0
votes
0 answers
Translate sequences of virtual keycodes into the resulting character message
My understanding is that TranslateMessage collates a sequence of key events and adds a WM_CHAR message to the queue if it results in a character. So on my computer what happens when I press Alt+1234 (6 relevant events/messages, including releasing…

Patrick
- 677
- 5
- 14