Skip to main content
Filter by
Sorted by
Tagged with
0 votes
1 answer
83 views

As explained here, the Windows API GetMessage() blocks until a message is available. I would like to automatically wake after n seconds. Alternatively, I'd like to have the system post a WM after n ...
SRobertJames's user avatar
  • 9,367
-3 votes
1 answer
147 views

How can I ensure that a Message Loop in Win API doesn't use the CPU when no messages are available? In other words, I effectively want a Message Loop which says "Sleep until I have a new message&...
SRobertJames's user avatar
  • 9,367
-1 votes
1 answer
2k views

I was trying to program with Win32 API, but I came across an unusual behaviour that I wasn't expecting which left me kinda confused. In my while loop: while (IsWindow(hwnd)) { while (PeekMessage(&...
unicus's user avatar
  • 41
0 votes
2 answers
261 views

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 ...
Norzka's user avatar
  • 57
0 votes
0 answers
51 views

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 (...
Patrick's user avatar
  • 697
2 votes
0 answers
275 views

According to the documentation, if the COM library is initialized in "apartment threaded" mode, the thread must have a message loop. However, I found that using COM in a thread with no ...
Seth's user avatar
  • 83
0 votes
1 answer
106 views

I've seen several code examples that test the value of a message to determine that it's between WM_KEYFIRST and WM_KEYLAST before calling IsDialogMessage. I was wondering if that's technically ...
user avatar
1 vote
1 answer
177 views

TL;DR In a C++ MFC CListView, how to prevent automagic selection based on letters the user types when the CListView has keyboard focus? Situation: MFC application using a CListView to show a ...
user avatar
-2 votes
1 answer
496 views

How can I invoke into the message loop of the tread/form after calling Application.Run() without a dialog? The reason is that I want to prepare (and later show) a dialog that is clickable even if a ...
LionAM's user avatar
  • 1,431
0 votes
1 answer
536 views

I create a window and message loop in the child thread. When I sent a custom message through PostMessage, when I called DestroyWindow in the thread, DestroyWindow blocked and did not trigger ...
yoe's user avatar
  • 1
0 votes
2 answers
159 views

Microsoft had a knowledge base article describing how to modify the message loop in at ATL .exe so that modeless dialogs can receive appropriate messages. I was wondering how to elegantly do this if ...
user avatar
0 votes
1 answer
1k views

I want to break from the windows message loop. Just like C++ how to break message loop in windows hook . I came up with one solution, which works fine for Window Desktop Application, but fails for ...
hellohawaii's user avatar
  • 3,084
3 votes
1 answer
2k views

I am trying to create a WIN32 (C++) program in which I will have to simultaneously process messages and run a while loop. In order to do that, I want to use threads. When I moved the message loop to a ...
Mara Postolache's user avatar
0 votes
1 answer
37 views

I have a WinForms application, with a login form and main form. The login form contains two textboxes for the user to enter credentials, an OK button, and a Cancel button. The following code is the ...
user avatar
0 votes
0 answers
324 views

I need to implement the answer provided to the following StackOverflow thread: How to receive drag move and drag drop events using CefSharp winforms I've tried implementing the code, but I feel the ...
Krptodr's user avatar
  • 139
3 votes
2 answers
5k views

I was working with some Bluetooth library and for some Bluetooth callback, it is necessary to use Windows message loop. But as per my requirement, I need to create a normal C++ program without any GUI....
krishnakumarcn's user avatar
1 vote
0 answers
137 views

Pretty simple question. I was just curious why I would use PostQuitMessage(0) to break out of my Message Loop, instead of just doing something like: bool isRunning; case WM_DESTROY: { isRunning =...
user2776326's user avatar
1 vote
1 answer
224 views

I've added a splash-screen form to a C# WinForms application to display while the application is being initialized/checking for updates. I'm using Squirrel.Windows to check for updates in Program.cs. ...
afarley's user avatar
  • 874
-1 votes
1 answer
1k views

I am trying to subscribe to window messages using .Net Core I am able to receive initial messages to create a window ( through pinvoke) and destroy messages. But after that my created windows gets ...
Aistis Taraskevicius's user avatar
3 votes
1 answer
1k views

Can I wait for GUI events — that is, pump a message loop — and on an I/O completion port at the same time? I would like to integrate libuv with the Windows GUI.
Demi's user avatar
  • 3,631
0 votes
1 answer
48 views

I have a MFC application. I want to statistic every button click, including button ID and time. Can I do it in CWinApp::PreTranslateMessage(MSG* pMsg) or CWnd::PreTranslateMessage(MSG* pMsg)? And how?...
Pengcheng Zhang's user avatar
0 votes
0 answers
531 views

I want to detect when the mouse is pressed on my wallpaper. So I got the wallpaper handle and now I'm trying to add a message loop to it, but its not working for some reason. Here's my code so far: ...
user avatar
0 votes
0 answers
50 views

So I'm trying to build a simple input-handler to work against windows message-loop. But for some reason when I test the case of WM_MBUTTONDOWN I get the same wParam as if I press the "Shift-key". The ...
Hampus Siversson's user avatar
1 vote
2 answers
326 views

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 ...
Andrew Arnott's user avatar
2 votes
1 answer
95 views

The aim of my program is to trigger Save As dialog of Notepad via Save As item in Notepad's menu. SendMessage(hWndOfNotepad, WM_COMMAND, SaveAsMenuItemId, IntPtr.Zero); Console.log("Done!"); When run ...
CK01's user avatar
  • 431
4 votes
1 answer
518 views

In all the books regarding C#/.NET that I have seen till now, when they talk about Events, they talk about Creating and Consuming Events. I am curious to understand a bit how it works behind our code ...
spaceman's user avatar
  • 1,101
0 votes
1 answer
287 views

I'm working on a problem (How to Detect a form open inside the application) and stumbled over a Windows Message I can't understand: 0xC052. This is the first Message I receive in a MessageFilter when ...
Patrik's user avatar
  • 1,382
0 votes
1 answer
383 views

I'm writing a library that wraps some of Media Foundation functionality. I want to be able to notify a library user through a callback of when a webcam is connected/disconnected to/from the system. ...
Sam Sung's user avatar
1 vote
1 answer
685 views

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() {...
matt-pielat's user avatar
  • 1,819
1 vote
1 answer
3k views

I wanted to read out messages in my message loop right before I dispatch them to my window procedure. Most messages I tried reading like this were read correctly, but when I close the window, a ...
The Light Spark's user avatar
2 votes
3 answers
5k views

I have learned a bit about Win32 API, but now I want to learn MFC. In my ebook, they said that the CWinApp class manages main thread of application, but I can't find something like GetMessage, ...
Phùng Khánh Hiên's user avatar
1 vote
0 answers
1k views

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 ...
neogeek23's user avatar
  • 893
4 votes
2 answers
2k views

I'm making an online communication application, and I'd like to process messages asynchronously. I found async-await pattern useful in implementing message loop. Below is what I have got so far: ...
eivour's user avatar
  • 1,787
1 vote
0 answers
673 views

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. ...
vlad417's user avatar
  • 313
2 votes
1 answer
4k views

So as the title suggests, I'm trying to use WebBrowser control in a class library. I've gone through several SO questions like this excellent post, but the unique thing in my situation is that the ...
dotNET's user avatar
  • 35.7k
2 votes
1 answer
435 views

I need to close a download popup in web browser control (disallow user to downloading file). How i can achieve this? I found this: How to block downloads in .NET WebBrowser control? And i used ...
Yozer's user avatar
  • 658
0 votes
2 answers
347 views

My WinForms app moves the mouse cursor about the form simply by setting the Cursor.Position property in some kind of a loop with a timer. I would like this movement to continue only till the user ...
Water Cooler v2's user avatar
0 votes
1 answer
419 views

When using the Win32 API message loop (or any higher level abstraction of the same such as System.Windows.Forms.IMessageFilter) to get a message, how do I find out who/which control/which component/...
Water Cooler v2's user avatar
0 votes
1 answer
318 views

I'm reading about event loops that pass messages, as I have to design one for a project I am working on. To understand it better, I am trying to analogize it to other things that I know somewhat ...
Seb Silver's user avatar
1 vote
1 answer
166 views

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 ...
pascalh's user avatar
  • 5,876
1 vote
1 answer
3k views

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 ...
GurdeepS's user avatar
  • 67.6k
0 votes
1 answer
2k views

i created a MFC dialog application. now i want to use a messageloop, but i can not find it. I read that mfc will create it for me but that it will be hidden. so how can i manipulate the messageloop? ...
Laokoon's user avatar
  • 1,331
0 votes
2 answers
808 views

I have a simple WPF form with a textbox and button and on lost focus it simply simply shows a message box. My code looks like this private void TextBox_LostFocus(object sender, RoutedEventArgs e) ...
Ankit's user avatar
  • 663
1 vote
1 answer
200 views

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 ...
Aswathy's user avatar
  • 13
1 vote
4 answers
2k views

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 ...
Dan's user avatar
  • 45.8k
1 vote
2 answers
3k views

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 ...
Coder's user avatar
  • 3,745
1 vote
2 answers
927 views

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 ...
mxk's user avatar
  • 43.7k
0 votes
1 answer
2k views

A typical pattern is to create a child window in the message callback (WndProc) at message WM_CREATE: LRESULT APIENTRY WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { ... switch (...
Horst Walter's user avatar
  • 14.1k
1 vote
3 answers
3k views

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 ...
Horst Walter's user avatar
  • 14.1k
0 votes
3 answers
235 views

The following code works fine. It gives out the message when the user presses a key. But there are certain things I am not aware of. What is the role of Message Loop here ? I read that calling ...
Suhail Gupta's user avatar
  • 23.4k