Re: How to Access Window Messages



As I wrote in other posts, what I'm looking for is a mechanism to
record all the interaction activities between a user and a defined
application (in other words input activities and most relevant changes
to the application occurred), where the recording is controlled be my
appl.
The best thing should be to have the abitity to treat compiled
applications.

The hooking mechanism could be the best, but, as we saw, ic CF it is
limited to input recording, so an alternative could be the
Pre-filtering of messages, but how can I controll it by my appl?

I hope to have been clear.

Andrea

Paul G. Tobey [eMVP] ha scritto:

No. I don't understand why you'd want to do that, anyway.

OpenNETCF was there first, before there was such a thing in .NET CF. I
haven't used the .NET CF 2.0 version from MS, but I'd guess that it's the
same.

Please tell us *what* you're trying to do, not *how* you've decided to go
about it.

Paul T.

<andrerus@xxxxxxxxx> wrote in message
news:1157040502.606821.52320@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
If I decide to launch an external application by a link in my appl, is
there a system to catch messages delivered to the external appl?

I tried to attach a messagefilter to my appl, and then to launch the
external with a link (using System.Diagnostics.Process.Start(ApplPath,
""), but the filter acts only on messages delivered to my appl.

Am I able to attach a messagefilter ONLY to an application or does it
exist a way to attach it ALSO to processes?

I noticed that IMessageFilter is also present inside CF and that
Application inside CF provide a method to add a messageFilter, what is
the difference with those declared in OpenNetCF?

Thanks,

Andrea


Paul G. Tobey [eMVP] ha scritto:

The only option for processing all messages sent to the message queue of
the
application would be something like ApplicationEx/IMessageFilter from the
OpenNETCF Smart Device Framework, which you can get from
www.opennetcf.org.
I don't see any reason to go that way here, since you're just trying to
get
a notification of a custom event that it seems to me could be sent to any
window you want, but it works if you need it.

Paul T.

<andrerus@xxxxxxxxx> wrote in message
news:1156875345.653614.297300@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
And if I would process the message sent to that specific window handle?
Remember that my propose was to override WndProc of my appl, but that
this is unpermitted under CF.

Andrea


Paul G. Tobey [eMVP] ha scritto:

Remember that not every message sent to every window will go through
the
MessageWindow!!! Your other program must be posting the message to
*that
specific window handle*!

Paul T.

<andrerus@xxxxxxxxx> wrote in message
news:1156873476.597249.64620@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Even if remove the creaton of a messageBox and put a breakpoint on
the
fist useful line on WndProc, nothig change, the appl seems to not
receive any message (no access to WndProc noticed).
What I don't understand is why the WndProc doesn't receive any
standard
message, such as tap, keystroke, ecc...

Into the appl I declare an instance of MyMessageWindow passing a ref
to
the appl (this), and implement the method to use to treat the
message,
according to the sample aforesaid.

Andrea


Paul G. Tobey [eMVP] ha scritto:

MessageWindow *does* work. Maybe you are not posting the message
to
that
window, though. You don't want to be popping up message boxes
during
processing of other messages. Set a breakpoint in the procedure
and
you
should see your custom message, if you're posting it to the right
place.

Paul T.

<andrerus@xxxxxxxxx> wrote in message
news:1156868088.650797.256570@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi,
I'd like to process costumized window messages receiver by my
appl.
Il
developing in C#, and this avoid me to override WndProc. I tried
to
use
MessageWindow, following the how to available on MSDN
(http://msdn2.microsoft.com/en-us/library/5143xwd8.aspx), but it
seems
to not intercept any message, neither cusomized nor standards (I
tried
to monitor which message I received showing it into a
MessageBox,
before processing the switch block).

Why this happening? Can anybody suggest me another solution?

Here is my code:

private class MyMsgWin : MessageWindow
{
private FrmMain Frm;

public MyMsgWin(FrmMain frm)
{
this.Frm = frm;

// Register the unique message for this
application.
THIS_MSG =
RegisterWindowMessage(

"MESSAGE_55B71366_F217_4061_9FBE_F601FE4EB920");
}

#region Message Registration

// Used to register the special Windows messages
// used for this application.
[DllImport("coredll")]
public static extern UInt32 RegisterWindowMessage(
String Msg);

// Three variables used to store the unique message
values.
UInt32 THIS_MSG;

#endregion

protected override void WndProc(ref Message m)
{
MessageBox.Show("received message " + m.Msg);
// switch (m.Msg)
{
// If message is of interest, invoke the method
on
the form that
// functions as a callback to perform actions
in
response to the message.
if(m.Msg == THIS_MSG)// Detect my message.
//TODO: HandleMessage
}

// Default processing. Don't touch this or you
could
cause the
// system to freeze (among other things).
base.WndProc(ref m);
}
}
}
}

The message registered is also registered into an unmanaged
portion,
used be the appl, ad usually is sent by the unmanaged portion to
the
appl.

Andrea





.



Relevant Pages

  • Re: How to Access Window Messages
    ... Paul G. Tobey ha scritto: ... fist useful line on WndProc, nothig change, the appl seems to not ... // Register the unique message for this application. ...
    (microsoft.public.windowsce.app.development)
  • Re: How to Access Window Messages
    ... own window procedure for the window, in place of the one that the guy who ... Paul G. Tobey ha scritto: ... but how can I controll it by my appl? ... // Used to register the special Windows messages ...
    (microsoft.public.windowsce.app.development)
  • Re: How to Access Window Messages
    ... window and then CallWindowProcto call the original one after you've seen ... but how can I controll it by my appl? ... Paul G. Tobey ha scritto: ... // Used to register the special Windows messages ...
    (microsoft.public.windowsce.app.development)
  • Re: How to Access Window Messages
    ... Even if remove the creaton of a messageBox and put a breakpoint on the ... receive any message (no access to WndProc noticed). ... Into the appl I declare an instance of MyMessageWindow passing a ref to ... // Register the unique message for this application. ...
    (microsoft.public.windowsce.app.development)
  • Re: How to Access Window Messages
    ... And if I would process the message sent to that specific window handle? ... fist useful line on WndProc, nothig change, the appl seems to not ... // Register the unique message for this application. ...
    (microsoft.public.windowsce.app.development)

Loading