L
luser
Hi all!
I've been trying for a couple of days now to understand how i can
ignore VW_CLOSE.
I'm using ApplicationEx and IMessageFilter from opennetcf, and are able
to catch the
VW_CLOSE message. But from there it's just no go...
When i have caught the WM_CLOSE event, i have tried to look at the
message queue, and ignore the message if it's the VW_CLOSE. But, when
using PeekMessage, there's no message at the queue.
Firstly i need help with understanding the IMessageFilter. When i
have caught a message, is that; a) before it's in the message queue,
b) while it's in the message queue, or c) after it has been on the
message queue?
I've been using the ApplicationEx sample code, and have added
case WinMsg.WM_CLOSE:
System.Windows.Forms.MessageBox.Show("WM_CLOSE caught!");
MsgProcessing.SuppressCloseEvent();
break;
to the public bool PrefilterMessage(ref Message m) method in the
Filters class.
MsgProcessing.SuppressCloseEvent() looks like this:
public static bool SuppressCloseEvent()
{
//Microsoft.WindowsCE.Forms.Message lpMsg;
MSG lpMsg;
// check for messages
while(PeekMessage(out lpMsg, IntPtr.Zero, 0, 0, PM_NOREMOVE))
{
// there is, so get the top one
if(GetMessage(out lpMsg, IntPtr.Zero, 0, 0))
{
if (lpMsg.Msg == (int)WinMsg.WM_CLOSE)
{
}
else
{
TranslateMessage(out lpMsg);
DispatchMessage(ref lpMsg);
}
}
}
return true;
}
I can step through the code, and see that the while-loop never is
true, i.e no messages exists in the message queue?
I have read a lot of post where the author says that have managed
to catch the WM_CLOSE message, and then just ignore the message.
But how the h-ll do you ingore the WM_CLOSE message?
Any help would be really appriciated, since this is slowly driving
me mad (and I have already reached the 100 mph mark...).
//Kind regards, Torbjörn.
PS. This is posted in both
microsoft.public.dotnet.framework.compactframework
and the opennetcf.org forum. DS
I've been trying for a couple of days now to understand how i can
ignore VW_CLOSE.
I'm using ApplicationEx and IMessageFilter from opennetcf, and are able
to catch the
VW_CLOSE message. But from there it's just no go...
When i have caught the WM_CLOSE event, i have tried to look at the
message queue, and ignore the message if it's the VW_CLOSE. But, when
using PeekMessage, there's no message at the queue.
Firstly i need help with understanding the IMessageFilter. When i
have caught a message, is that; a) before it's in the message queue,
b) while it's in the message queue, or c) after it has been on the
message queue?
I've been using the ApplicationEx sample code, and have added
case WinMsg.WM_CLOSE:
System.Windows.Forms.MessageBox.Show("WM_CLOSE caught!");
MsgProcessing.SuppressCloseEvent();
break;
to the public bool PrefilterMessage(ref Message m) method in the
Filters class.
MsgProcessing.SuppressCloseEvent() looks like this:
public static bool SuppressCloseEvent()
{
//Microsoft.WindowsCE.Forms.Message lpMsg;
MSG lpMsg;
// check for messages
while(PeekMessage(out lpMsg, IntPtr.Zero, 0, 0, PM_NOREMOVE))
{
// there is, so get the top one
if(GetMessage(out lpMsg, IntPtr.Zero, 0, 0))
{
if (lpMsg.Msg == (int)WinMsg.WM_CLOSE)
{
}
else
{
TranslateMessage(out lpMsg);
DispatchMessage(ref lpMsg);
}
}
}
return true;
}
I can step through the code, and see that the while-loop never is
true, i.e no messages exists in the message queue?
I have read a lot of post where the author says that have managed
to catch the WM_CLOSE message, and then just ignore the message.
But how the h-ll do you ingore the WM_CLOSE message?
Any help would be really appriciated, since this is slowly driving
me mad (and I have already reached the 100 mph mark...).
//Kind regards, Torbjörn.
PS. This is posted in both
microsoft.public.dotnet.framework.compactframework
and the opennetcf.org forum. DS