Clear Message queue

  • Thread starter Thread starter tolemaC
  • Start date Start date
T

tolemaC

how to clear the Message queue in a window or application?

I´m looking for something like Application.DoEvents() but it must clear que
queue.

tolemaC
 
sorry:

I´m looking for something like Application.DoEvents() but it must clear
"the"
queue.

..I.
 
DoEvents process messages and clears the queue but I don´t want to process
messages, i want clear the queue only.

thank you

..tolemaC.
 
erm, Where is PeekMessage?
What DLL?

I´m trying it:

[DllImport("Msgque.dll")]
extern static bool PeekMessage(out MessageWindow Msg, uint hWnd, uint
wMsgFilterMin, uint wMsgFilterMax, uint wRemoveMsg);
public static void ClearMessages()
{
MessageWindow msg = new MessageWindow();
while (PeekMessage(ref msg, 0, 0, 0, 1))
{

I get a 'System.NotSupportedException' exception in PeekMessage call.

hmn?

..tolemaC.
 
[DllImport("coredll")]
extern static bool PeekMessage(out Message Msg, uint hWnd, uint
wMsgFilterMin, uint wMsgFilterMax, uint wRemoveMsg);

public static void ClearMessages()
{
Message msg;;
while (PeekMessage(out msg, 0, 0, 0, 1))


tolemaC said:
erm, Where is PeekMessage?
What DLL?

I´m trying it:

[DllImport("Msgque.dll")]
extern static bool PeekMessage(out MessageWindow Msg, uint hWnd, uint
wMsgFilterMin, uint wMsgFilterMax, uint wRemoveMsg);
public static void ClearMessages()
{
MessageWindow msg = new MessageWindow();
while (PeekMessage(ref msg, 0, 0, 0, 1))
{

I get a 'System.NotSupportedException' exception in PeekMessage call.

hmn?

.tolemaC.

Alex Feinman said:
PeekMessage with PM_REMOVE. GetMessage will wait indefinitely if invoked on
empty queue
 
Actually, the CF Message structure won't do.
Define the MSG structure like this:

struct MSG {
IntPtr hwnd;
uint message;
IntPtr wParam;
IntPtr lParam;
int time;
int ptX;
int ptY
}

Alex Feinman said:
[DllImport("coredll")]
extern static bool PeekMessage(out Message Msg, uint hWnd, uint
wMsgFilterMin, uint wMsgFilterMax, uint wRemoveMsg);

public static void ClearMessages()
{
Message msg;;
while (PeekMessage(out msg, 0, 0, 0, 1))


tolemaC said:
erm, Where is PeekMessage?
What DLL?

I´m trying it:

[DllImport("Msgque.dll")]
extern static bool PeekMessage(out MessageWindow Msg, uint hWnd, uint
wMsgFilterMin, uint wMsgFilterMax, uint wRemoveMsg);
public static void ClearMessages()
{
MessageWindow msg = new MessageWindow();
while (PeekMessage(ref msg, 0, 0, 0, 1))
{

I get a 'System.NotSupportedException' exception in PeekMessage call.

hmn?

.tolemaC.

Alex Feinman said:
PeekMessage with PM_REMOVE. GetMessage will wait indefinitely if
invoked
on
empty queue

Manually P/Invoke GetMessage and don't call DispatchMessage.

--
Chris Tacke, eMVP
Advisory Board Member
www.OpenNETCF.org
---
Windows CE Product Manager
Applied Data Systems
www.applieddata.net


DoEvents process messages and clears the queue but I don´t want to
process
messages, i want clear the queue only.

thank you

.tolemaC.

DoEvents will "clear the queue"

sorry:

I´m looking for something like Application.DoEvents() but it must
clear
"the"
queue.

.I.

how to clear the Message queue in a window or application?

I´m looking for something like Application.DoEvents() but it must
clear
que
queue.

tolemaC
 
Alex, thank you very much

..tolemaC.

Alex Feinman said:
Actually, the CF Message structure won't do.
Define the MSG structure like this:

struct MSG {
IntPtr hwnd;
uint message;
IntPtr wParam;
IntPtr lParam;
int time;
int ptX;
int ptY
}

Alex Feinman said:
[DllImport("coredll")]
extern static bool PeekMessage(out Message Msg, uint hWnd, uint
wMsgFilterMin, uint wMsgFilterMax, uint wRemoveMsg);

public static void ClearMessages()
{
Message msg;;
while (PeekMessage(out msg, 0, 0, 0, 1))


tolemaC said:
erm, Where is PeekMessage?
What DLL?

I´m trying it:

[DllImport("Msgque.dll")]
extern static bool PeekMessage(out MessageWindow Msg, uint hWnd, uint
wMsgFilterMin, uint wMsgFilterMax, uint wRemoveMsg);
public static void ClearMessages()
{
MessageWindow msg = new MessageWindow();
while (PeekMessage(ref msg, 0, 0, 0, 1))
{

I get a 'System.NotSupportedException' exception in PeekMessage call.

hmn?

.tolemaC.

PeekMessage with PM_REMOVE. GetMessage will wait indefinitely if invoked
on
empty queue

Manually P/Invoke GetMessage and don't call DispatchMessage.

--
Chris Tacke, eMVP
Advisory Board Member
www.OpenNETCF.org
---
Windows CE Product Manager
Applied Data Systems
www.applieddata.net


DoEvents process messages and clears the queue but I don´t want to
process
messages, i want clear the queue only.

thank you

.tolemaC.

DoEvents will "clear the queue"

sorry:

I´m looking for something like Application.DoEvents() but it must
clear
"the"
queue.

.I.

how to clear the Message queue in a window or application?

I´m looking for something like Application.DoEvents() but it
must
clear
que
queue.

tolemaC
 
Back
Top