Why does my app not receive the WM_CREATE message? - vb6

I want to get notified of new windows before they are shown.
Therefore I subclass my application and listen for the WM_CREATE message.
I am using Paul Caton's VB6 subclasser.
Subclassing and listening to Windows Messages usually works fine for me, but I just don't receive any WM_CREATE message.
Neither when I open any additional window in my app nor when other apps show new windows.
What am I missing?
Thank you!

Related

What's the Window Message that the parent window receive when a new WindowControl is opened from it?

When a user click in a button for example and open a new form, what's the Message that the parent window receive to detect that a new window was opened from it?
I saw that the parent window receive a messages like WM_PAINT. But this messages happens everytime a control has to be painted on the screen.
There's a unique message that the parent can identify a new opened window from it? If it's not, what can I do?
Thanks.
WM_PARENTNOTIFY Message (http://msdn.microsoft.com/en-us/library/windows/desktop/ms632638(v=vs.85).aspx)
With WM_CREATE (0x0001) - LOWORD(wParam).
EDIT:
Like others said in comments, WM_PARENTNOTIFY will not work.
The another approach that I find is to Superclassing all WINDOW class after my MainWindow start to execute. In that way Windows OS will cal my own WndProc before the control initialize and then I can get the WM_NCREATE e WM_CREATE messages for the Window that will be created.
Thank you guys.

OnMouseWheel event with MFC

I am having some problems with the ON_WM_MOUSEWHEEL event and MFC. The function handling the event does get called, but not when scrolling, just when "pinching" the touchpad. Is it supposed to behave like this?
I am using Visual Studio 2010 and Windows 7.
I've noticed that some touchpad drivers implement scrolling using the WM_VSCROLL message, however since the java AWT's mouseWheelListener is working, my recommendation would be:
Open Spy++ and verify whether or not WM_MOUSEWHEEL messages are being posted.
If messages are not being posted the control might not have focus.
If messages are being posted, it might be a problem with the way the control is attempting to receive the message. In this case, showing us the message map might help.
Take a look at the WM_TOUCH message.

WM_TOUCH is not immediately sent with touch down event

I am working with a touch screen and using Windows 7 built in drivers (as it never prompted me to install any). it works fine, except for one small issue. When I touch the screen, it will not send the WM_LBUTTONDOWN until I move my finger off the screen. It appears to do this to determine if I intend to hold down to emulate WM_RBUTTONDOWN or not. (Also, I tried to disable the hold down emulate gesture, but it never disables in practice.)
So I thought I would just receive the WM_TOUCH messages. And I found that WM_TOUCH (0x240) is also not sent to my window until I move my finger off the screen. I sort of thought that defeats the purpose of WM_TOUCH altogether.
Both before and after registering to receive WM_TOUCH messages, I received three messages immediately upon touching the screen:
1. Send: 0x02CC (undocumented tablet messages)
2. Post: 0x011B (undocumented)
3. Send: 0x011A (WM_GESTURENOTIFY)
0x011A is WM_GESTURENOTIFY, which my code is to respond to (perhaps I am not responding correctly?). I reply with a standard response (using sample code from MS) to receive full notifications.
Another thing, I began getting WM_TOUCH when I register for touch messages, but I continue to get the WM_GESTURENOTIFY message as well. According to the MS documentation, once I register to get WM_TOUCH, I no longer get gesture messages.
If anyone can tell me how to get WM_TOUCH messages immediately (e.g. when I am getting the WM_GESTURENOTIFY messages), and not after I let my finger up off the touch scree, I would appreciate it much.
Check out this tutorial on touch events:
http://msdn.microsoft.com/en-us/gg464991
What you want to use is the RegisterTouchWindow function, as such:
RegisterTouchWindow(handle, 0);
Windows will now send WM_TOUCH messages instead of WM_GESTURE messages to your window. Keep in mind that you will have to compile against Windows SDK version 7.0 or newer for this to work.
I almost got the same issue and solved it by using :
RegisterTouchWindow( hWnd, TWF_WANTPALM );

Help please - WM_SYSCOMMAND message from Aero Shake/3D flip

HI
I have an application written in Delphi 2006. I have noticed that when running under windows 7 the application does not receive the WM_SYSCOMMAND message from Aero Shake. However if I run the application as administrator then it does receive the WM_SYSCOMMAND when performing Aero Shake.
I've tried calling ChangeWindowMessageFilter for WM_SYSCOMMAND and get a result of True indicating that the call succeeded but I still can't get the WM_SYSCOMMAND message frmo Aero Shake.
Does anyone know why and how I can fix this?
Thank you
This discussion of the behaviour of AeroSnap/Shake in the presence (or otherwise) of MOVE message handling and/or specific window frame styles may provide some assistance.
I've solved this, in order to get the WM_SYSCOMMAND message you need to elevate the application to at least highestAvailable using an application manifest. After doing this everything works perfectly except that you now get the elevation confirmation dialog when starting the application.

WM_POWERBROADCAST handler for CMainDlg in ATL app not invoked

I have an ATL app where I want to handle WM_POWERBROADCAST. I have a CMainDlg (CAxDialogImpl) in whose MSG_MAP I defined the handler.
BEGIN_MSG_MAP(CMainDlg)
...
MESSAGE_HANDLER(WM_POWERBROADCAST, OnPowerChange)
...
END_MSG_MAP()
However, the handler isn't invoked when I do things that should invoke it, for instance change power settings or put the machine to sleep.
Any ideas about what might be going on, and how to fix this? Does CMainDlg not get notified of power events, for some reason?
I suspect your dialog not being a top level window (WS_POPUP styled).
Just tested with a WTL AppWizard non modal dialog app that WM_POWERBROADCAST is received (without any registration) on AC plugged/unplugged.
Did you register to receive the power events?
To add to answers above, you might want to use Spy++ tool to make sure the messages of interest are posted to your application in first place. You will also see which windows they are posted to, and if it is your window where you are waiting for this message.

Resources