Questions tagged [message-loop]

70 questions
0
votes
1 answer

Necessity of testing key value before calling IsDialogMessage

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 necessary. Wouldn't IsDialogMessage inherently do…
user15284017
0
votes
1 answer

Why is DestroyWindow blocked?

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 WM_DESTORY, so the message loop thread cannot exit…
yoe
  • 1
0
votes
2 answers

How to dispatch messages for multiple dialogs in an ATL exe

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 you have potentially multiple modeless dialogs,…
user15025873
0
votes
1 answer

How to quit/break from windows message loop in console app and deferences from windows desktop app?

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 Console Application. How can this happen? EDIT: I…
hellohawaii
  • 3,074
  • 6
  • 21
0
votes
1 answer

Difficulty displaying "login" and "main" forms correctly

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 event handler for the OK button: private…
Al2110
  • 566
  • 9
  • 25
0
votes
0 answers

CefSharp.WinForms Drag and Drop messageloop override

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 answer provided does not give me enough detail…
Krptodr
  • 139
  • 13
0
votes
0 answers

Why Is PostQuitMessage Necessary

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 = false; break; } Honestly, I don't really…
user2776326
  • 45
  • 1
  • 7
0
votes
1 answer

How to statistic every button click in mfc using message loop mechanics?

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?
0
votes
0 answers

[c++ windows]capturing mouse click event from a window that isn't mine

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: int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE…
user5473227
0
votes
0 answers

I get the wrong wParam from WV_MBUTTONDOWN

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 code I get when trying to click my middle mouse…
0
votes
1 answer

Unknown Windows Message 0xC052

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 a form opens. But since I didn't found any…
Patrik
  • 1,355
  • 12
  • 22
0
votes
1 answer

Use Windows message loop to receive an event in a library I'm writing

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. MSDN describes how to know when a camera is…
0
votes
1 answer

Why can't I get a WM_DESTROY or WM_CLOSE message outside a window procedure?

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 WM_CLOSE or WM_DESTROY message could not be read as it…
The Light Spark
  • 504
  • 4
  • 19
0
votes
2 answers

Distinguish between user generated and my own application generated mouse moves

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 does not wield the mouse himself to move it. As soon…
Water Cooler v2
  • 32,724
  • 54
  • 166
  • 336
0
votes
1 answer

Who sent/posted the WM_MOUSEMOVE?

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/which piece of code posted the WM_MOUSEMOVE? Does…
Water Cooler v2
  • 32,724
  • 54
  • 166
  • 336