Clear Message queue

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
 
T

tolemaC

sorry:

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

..I.
 
T

tolemaC

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

thank you

..tolemaC.
 
T

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.
 
A

Alex Feinman [MVP]

[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
 
A

Alex Feinman [MVP]

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
 
T

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top