Hi
I am having an issue with a window I am creating - in its wndproc, if I call
PostMessage(hWn d, WM_QUIT, 0, 0) in response to WM_DESTROY, then GetMessage
returns a non-zero value and the loop carries on. But if I post quit message
in response to WM_CLOSE - it works fine!
I thought you were supposed to post WM_QUIT in response to WM_DESTROY though? 4 2115
You're not supposed to use PostMessage for WM_QUIT. Use PostQuitMessage
instead.
"Bonj" <Bo**@discussio ns.microsoft.co m> wrote in message
news:E6******** *************** ***********@mic rosoft.com... Hi I am having an issue with a window I am creating - in its wndproc, if I call PostMessage(hWn d, WM_QUIT, 0, 0) in response to WM_DESTROY, then GetMessage returns a non-zero value and the loop carries on. But if I post quit message in response to WM_CLOSE - it works fine! I thought you were supposed to post WM_QUIT in response to WM_DESTROY though?
Please read my other posts on the same issue for the reasons as to why I don't.
"Alexander Grigoriev" wrote: You're not supposed to use PostMessage for WM_QUIT. Use PostQuitMessage instead.
"Bonj" <Bo**@discussio ns.microsoft.co m> wrote in message news:E6******** *************** ***********@mic rosoft.com... Hi I am having an issue with a window I am creating - in its wndproc, if I call PostMessage(hWn d, WM_QUIT, 0, 0) in response to WM_DESTROY, then GetMessage returns a non-zero value and the loop carries on. But if I post quit message in response to WM_CLOSE - it works fine! I thought you were supposed to post WM_QUIT in response to WM_DESTROY though?
Anyway, during WM_DESTROY, HWND may be already invalid. Actually, the reason
for failure is that when you do GetMessage, the window will already be
destroyed and the message will be discarded as invalid.
You're better with PostThreadMessa ge(GetCurrentTh readId(), WM_QUIT).
"Bonj" <Bo**@discussio ns.microsoft.co m> wrote in message
news:58******** *************** ***********@mic rosoft.com... Please read my other posts on the same issue for the reasons as to why I don't.
"Alexander Grigoriev" wrote:
You're not supposed to use PostMessage for WM_QUIT. Use PostQuitMessage instead.
"Bonj" <Bo**@discussio ns.microsoft.co m> wrote in message news:E6******** *************** ***********@mic rosoft.com... > Hi > I am having an issue with a window I am creating - in its wndproc, if I > call > PostMessage(hWn d, WM_QUIT, 0, 0) in response to WM_DESTROY, then > GetMessage > returns a non-zero value and the loop carries on. But if I post quit > message > in response to WM_CLOSE - it works fine! > I thought you were supposed to post WM_QUIT in response to WM_DESTROY > though? > >
I eventually found the cause of this ish.
It was that I was calling
while(GeMessage (&msg, hWnd, 0, 0) != 0)
instead of
while(GetMessag e(&msg, NULL, 0, 0) != 0)
and due to this, PostQuitMessage doesn't actually post a message to the
hWnd, just to the thread. So the WM_QUIT message was being issued correctly,
it just wasn't getting through!
"Alexander Grigoriev" <al***@earthlin k.net> wrote in message
news:u4******** ******@TK2MSFTN GP09.phx.gbl... Anyway, during WM_DESTROY, HWND may be already invalid. Actually, the reason for failure is that when you do GetMessage, the window will already be destroyed and the message will be discarded as invalid.
You're better with PostThreadMessa ge(GetCurrentTh readId(), WM_QUIT).
"Bonj" <Bo**@discussio ns.microsoft.co m> wrote in message news:58******** *************** ***********@mic rosoft.com... Please read my other posts on the same issue for the reasons as to why I don't.
"Alexander Grigoriev" wrote:
You're not supposed to use PostMessage for WM_QUIT. Use PostQuitMessage instead.
"Bonj" <Bo**@discussio ns.microsoft.co m> wrote in message news:E6******** *************** ***********@mic rosoft.com... > Hi > I am having an issue with a window I am creating - in its wndproc, if > I > call > PostMessage(hWn d, WM_QUIT, 0, 0) in response to WM_DESTROY, then > GetMessage > returns a non-zero value and the loop carries on. But if I post quit > message > in response to WM_CLOSE - it works fine! > I thought you were supposed to post WM_QUIT in response to WM_DESTROY > though? > >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: hellrazor |
last post by:
Hi there,
First of all, I'm very much a C++ amateur (i.e., a newb). I'm having to
program a win32 system service for my employer, and I'm almost done with
the task, but I need help with something that appears to be very basic.
I have a function within the cpp file called StopService:
void StopService()
{
|
by: Nerox |
last post by:
Hi, If i write:
#include <stdio.h>
int foo(int);
int main(void){
int a = 3;
foo(a);
}
|
by: Sean |
last post by:
Hi,
I would like to know where I can get the value for
Windows API Notification?
For example:
private const int WM_ACTIVATEAPP = 0x01C;
private const int WM_NCACTIVATE = 0x086;
I couldn't find it in the Windows API documentation.
|
by: Jose Fernandez |
last post by:
Hello.
I'm building a web service and I get this error.
NEWS.News.CoverNews(string)': not all code paths return a value
This is the WebMethod
public SqlDataReader CoverNews(string Sport)
{
|
by: Bonj |
last post by:
Is PostQuitMessage(?) different to PostMessage(hWnd, WM_QUIT, ... ) ?
I've got a window in a DLL (the same one experiencing the issue below,
"return value of WM_QUIT") in which PostMessage(hWnd, WM_QUIT, ... ) works,
but PostQuitMessage doesn't.
I would assume this to be the case as PostQuitMessage can't possibly know
the hWnd I'm wanting...
| |
by: tshad |
last post by:
I am trying to set up a class to handle my database accesses.
I can't seem to figure out how to get the return value from my dataReader
from these routines (most of which I got elsewhere). They do work pretty
well, except for the change I made to get the return value.
For example, I have the following:...
|
by: Michael Maes |
last post by:
Hello,
I have a BaseClass and many Classes which all inherit (directly) from the BaseClass.
One of the functions in the BaseClass is to (de)serialize the (inherited) Class to/from disk.
1. The Deserialization goes like:
#Region " Load "
|
by: swell |
last post by:
I have a COM server that throw events that i catch after running the
event loop thanks to pythoncom.PumpMessages(). How can i stop and exit
this loop? I tried to use win32api.PostQuitMessage() but this has no
effect ( the doc says that WM_QUIT stops the PumpMessages loop but it
doesn't)
Does someone know how to exit gracefully from this...
|
by: KoreyAusTex |
last post by:
If anyone can help me figure out the what the missing return statements are, I think it might be the fact that I need to add a return false in the getValue()?
import java.util.*;
public class Card
{
// instance variables
//suits
private int suit;
private int spades;
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |