473,397 Members | 2,099 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Intercepting windows messages

yuumei
5
Hi, this is my first post on a usergroup, please go easy on me :3

Im trying to intercept some input messages from a windows message loop:
Expand|Select|Wrap|Line Numbers
  1. //while (GetMessage(&wmsg, NULL, 0, 0))
  2. //while (PeekMessage(&wmsg, NULL, 0, 0, PM_REMOVE))
  3. {
  4. CallWindowProc(W32HandleWindowsMessage, hwnd, wmsg.message, wmsg.wParam, wmsg.lParam);
  5. }
  6.  
The GetMessage version seems to break when I get a WM_INPUT message, but then hangs and never gets out of the loop.
The PeekMessage dosent seems to break, so im assuming its not getting the WE_INPUT message.

Am I doing it right? Any pointers?

Thankyouuuu
Jun 10 '07 #1
2 2122
Banfa
9,065 Expert Mod 8TB
You need to look up the documentation on GetMessage and PeekMessage (Google is your friend in this).

GetMessage returns true unless the message it is processing is a WM_QUIT message otherwise it returns false. It should probably only be used in your programs main message loop (although there are times when setting up an alternate message loop is done).

PeekMessage only returns true if there was a message waiting in the message queue that it retrieved and returned, otherwise it returns false. since it is likely that most of the time there is not a message waiting it is like that your whole loop is never entered. PeekMessage is not really designed to be used as the control for a while loop but more in an if inside a loop of some sort to allow processing of messages to continue while the loop executes.
Jun 10 '07 #2
yuumei
5
Thanks for the advice, I found out that I was already getting the message before that part of the code x_x
So I was getting an empty queue
Jun 12 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

13
by: Scott Hathaway | last post by:
I want to write an NT service that will intercept any outgoing smtp traffic, like Norton Antivirus does. Can anyone tell me how I can do something like this in Python? I do not know how to...
6
by: Valery Polyakov | last post by:
I am drawing lines with a semi-transparent color (alpha=100). When these lines intercept, the color becomes more intense. Is there a way to avoid this, so that I would get the same intensity of...
0
by: VMI | last post by:
My Windows datagrid has two columns: one with the data that the user will see (col_X) and the other one (a hidden one: col_sort) that'll be used to sort data. When a user clicks on col_X's column...
0
by: Microsoft CSharp | last post by:
How can I intercept the messages coming from HTML Help (kind of hook...)? Thanks. PL
10
by: Steve McLellan | last post by:
Hi, Does anyone know if it's possible (and if so, how) to intercept presses on 'multimedia keys' you find on keyboards? Curiosity more than anything. Only manufacturers seem to put their own...
4
by: Curious Coder | last post by:
I have been tasked with a project that I do not think can be accomplished. Our company has an application that runs as an unmanaged ActiveX control on user desktops. It is designed to work with...
6
by: Alex Pierson | last post by:
I have searched and searched and cannot find any code in VB.net that would allow me to intercept messages from an external application (window). I have implemented a global keyboard hook...
5
by: Carlo | last post by:
Good morning I've not found an event that notify me when drop-down part of a BomboBox is closed. OnDropDown just notify when the drop-down is displayed, not when it is closed. Is there a...
5
by: aaa | last post by:
Is there a simple straight forward tool out there for intercepting my SOAP requests so that I can debug the XML that I am sending?
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.