Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > Avalon

How to intercept a Win32 Message in WPF App?

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 06-19-2006   #1 (permalink)
Fabio Galuppo
Guest


 

How to intercept a Win32 Message in WPF App?

I´m trying to intercept a Win32 Message (WM_TIMECHANGE) in my WPF
Application. In Windows Forms this is a simple task, but I didn´t found how
can I do to receive a Win32 Message in WPF.

My question is: How can I do to intercept "natively" a Win32 Message in WPF
Application (via code and/or XAML) ? Is possible (it means without any kind
of interop or host form) ?

Thanks in advanced,

--
Fabio Galuppo
fabiogaluppo.blogspot.com

My System SpecsSystem Spec
Old 06-21-2006   #2 (permalink)
Nick Kramer [MSFT]
Guest


 

Re: How to intercept a Win32 Message in WPF App?

No, there's no "native" WPF API for that. Not every window message has a
WPF equivalent -- there's a lot of window messages that have nothing to do
with presentation and UI. Often you can use Winforms's
System.Windows.Forms.SystemInformation class, although I don't remember if
wm_timechange is part of SystemInformation.

Of course, as you suggested, you can also use wndprocs and/or
HwndSource.AddHook.

--
-Nick Kramer [MSFT]
http://blogs.msdn.com/nickkramer

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

"Fabio Galuppo" <FabioGaluppo@discussions.microsoft.com> wrote in message
news:7104AA85-36B4-49F8-BBF5-8C3C19E9D765@microsoft.com...
> I´m trying to intercept a Win32 Message (WM_TIMECHANGE) in my WPF
> Application. In Windows Forms this is a simple task, but I didn´t found
> how
> can I do to receive a Win32 Message in WPF.
>
> My question is: How can I do to intercept "natively" a Win32 Message in
> WPF
> Application (via code and/or XAML) ? Is possible (it means without any
> kind
> of interop or host form) ?
>
> Thanks in advanced,
>
> --
> Fabio Galuppo
> fabiogaluppo.blogspot.com



My System SpecsSystem Spec
Old 06-22-2006   #3 (permalink)
Fabio Galuppo
Guest


 

Re: How to intercept a Win32 Message in WPF App?

Hello Nick,

Thanks for this information!

However, I hope in the "future" releases of WPF somekind of support to
receive these system messages. We have a lot of system messages that Windows
OS notifies an application (WM_TIMECHANGE, WM_POWER, WM_DEVICECHANGE to name
a few) and I don´t see the need to use classes from System.Windows.Interop to
receive a system message.

I understand this kind of feature must be Windows only (perhaps not
supported in WPF/E). However, suppose that I´m writing a "Battery Control UI"
app, I can do these only with Windows Forms (with MDX) or Win32 (with
DirectX), but I can´t with WPF without Interop AND hosting a control .

Thanks again,

--
Fabio Galuppo
fabiogaluppo.blogspot.com


"Nick Kramer [MSFT]" wrote:

> No, there's no "native" WPF API for that. Not every window message has a
> WPF equivalent -- there's a lot of window messages that have nothing to do
> with presentation and UI. Often you can use Winforms's
> System.Windows.Forms.SystemInformation class, although I don't remember if
> wm_timechange is part of SystemInformation.
>
> Of course, as you suggested, you can also use wndprocs and/or
> HwndSource.AddHook.
>
> --
> -Nick Kramer [MSFT]
> http://blogs.msdn.com/nickkramer
>
> This posting is provided "AS IS" with no warranties, and confers no rights.
> Use of included script samples are subject to the terms specified at
> http://www.microsoft.com/info/cpyright.htm
>
> "Fabio Galuppo" <FabioGaluppo@discussions.microsoft.com> wrote in message
> news:7104AA85-36B4-49F8-BBF5-8C3C19E9D765@microsoft.com...
> > I´m trying to intercept a Win32 Message (WM_TIMECHANGE) in my WPF
> > Application. In Windows Forms this is a simple task, but I didn´t found
> > how
> > can I do to receive a Win32 Message in WPF.
> >
> > My question is: How can I do to intercept "natively" a Win32 Message in
> > WPF
> > Application (via code and/or XAML) ? Is possible (it means without any
> > kind
> > of interop or host form) ?
> >
> > Thanks in advanced,
> >
> > --
> > Fabio Galuppo
> > fabiogaluppo.blogspot.com

>
>
>

My System SpecsSystem Spec
Old 11-05-2007   #4 (permalink)
Jen
Guest


 

Re: How to intercept a Win32 Message in WPF App?

How did you resolve the problem as WPF uses <Window> element instead of Form?
Available articles out there only show how to intercept using WinForm. I have
the same problem and am stuck. Appreciate that you will share your experience
on this issue.

"Fabio Galuppo" wrote:
Quote:

> Hello Nick,
>
> Thanks for this information!
>
> However, I hope in the "future" releases of WPF somekind of support to
> receive these system messages. We have a lot of system messages that Windows
> OS notifies an application (WM_TIMECHANGE, WM_POWER, WM_DEVICECHANGE to name
> a few) and I don´t see the need to use classes from System.Windows.Interop to
> receive a system message.
>
> I understand this kind of feature must be Windows only (perhaps not
> supported in WPF/E). However, suppose that I´m writing a "Battery Control UI"
> app, I can do these only with Windows Forms (with MDX) or Win32 (with
> DirectX), but I can´t with WPF without Interop AND hosting a control .
>
> Thanks again,
>
> --
> Fabio Galuppo
> fabiogaluppo.blogspot.com
>
>
> "Nick Kramer [MSFT]" wrote:
>
Quote:

> > No, there's no "native" WPF API for that. Not every window message has a
> > WPF equivalent -- there's a lot of window messages that have nothing to do
> > with presentation and UI. Often you can use Winforms's
> > System.Windows.Forms.SystemInformation class, although I don't remember if
> > wm_timechange is part of SystemInformation.
> >
> > Of course, as you suggested, you can also use wndprocs and/or
> > HwndSource.AddHook.
> >
> > --
> > -Nick Kramer [MSFT]
> > http://blogs.msdn.com/nickkramer
> >
> > This posting is provided "AS IS" with no warranties, and confers no rights.
> > Use of included script samples are subject to the terms specified at
> > http://www.microsoft.com/info/cpyright.htm
> >
> > "Fabio Galuppo" <FabioGaluppo@xxxxxx> wrote in message
> > news:7104AA85-36B4-49F8-BBF5-8C3C19E9D765@xxxxxx
Quote:

> > > I´m trying to intercept a Win32 Message (WM_TIMECHANGE) in my WPF
> > > Application. In Windows Forms this is a simple task, but I didn´t found
> > > how
> > > can I do to receive a Win32 Message in WPF.
> > >
> > > My question is: How can I do to intercept "natively" a Win32 Message in
> > > WPF
> > > Application (via code and/or XAML) ? Is possible (it means without any
> > > kind
> > > of interop or host form) ?
> > >
> > > Thanks in advanced,
> > >
> > > --
> > > Fabio Galuppo
> > > fabiogaluppo.blogspot.com
> >
> >
> >
My System SpecsSystem Spec
Closed Thread
Update your Vista Drivers Update Your Drivers Now!!

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
is not a valid Win32 application message, while clicking on device anoop Vista hardware & devices 3 07-14-2008 11:34 AM
Pictures will not open. Message: not a valid win32 application Susan Marsh Vista music pictures video 1 06-08-2008 08:01 PM
"*.pps is not a valid Win32 application" error message in Windows RaeWeniger Vista installation & setup 2 02-19-2008 05:43 PM
keep getting 'not a valid WIN32 App error message LCMJ Vista General 4 06-25-2007 04:56 AM
Trying to install Directx, keep getting Win32 Cabinet Error message Zach23 Vista installation & setup 2 08-12-2006 11:05 AM


Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51