Message + Windows Service

  • Thread starter Thread starter Jacek
  • Start date Start date
J

Jacek

Hello
Is there any function to override in Windows Service to
get message from oter application? Something like WinProc
in Windows Application.
brgds
Jacek
 
Jacek,

You can do this. Create a class that extends the NativeWindow class in
the System.Windows.Forms namespace. Then, get the handle to the window that
you want to intercept the messages of. Once you have that, assign it to
your new class (which derives from NativeWindow and overrides WndProc), and
then you should be set.

Hope this helps.
 
Nicholas,

Not a good idea, that way you force people to run Services in the context of
the interactive user (Interact with desktop).
Better would be to use remoting, or even COM.
Willy.

Nicholas Paldino said:
Jacek,

You can do this. Create a class that extends the NativeWindow class in
the System.Windows.Forms namespace. Then, get the handle to the window that
you want to intercept the messages of. Once you have that, assign it to
your new class (which derives from NativeWindow and overrides WndProc), and
then you should be set.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Jacek said:
Hello
Is there any function to override in Windows Service to
get message from oter application? Something like WinProc
in Windows Application.
brgds
Jacek
 
Wow, I didn't even see the "service" part in the title, I just read the
message.

Good point.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Willy Denoyette said:
Nicholas,

Not a good idea, that way you force people to run Services in the context of
the interactive user (Interact with desktop).
Better would be to use remoting, or even COM.
Willy.

message news:%[email protected]...
Jacek,

You can do this. Create a class that extends the NativeWindow class in
the System.Windows.Forms namespace. Then, get the handle to the window that
you want to intercept the messages of. Once you have that, assign it to
your new class (which derives from NativeWindow and overrides WndProc), and
then you should be set.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Jacek said:
Hello
Is there any function to override in Windows Service to
get message from oter application? Something like WinProc
in Windows Application.
brgds
Jacek
 
Thank You,
The problem is I have to use dll written in MFC C++
without posibility to change code inside, and have to
write Windows Service do catch messages incoming from dll.
I will try something. Thanks a lot
brgds
Jacek
-----Original Message-----
Wow, I didn't even see the "service" part in the title, I just read the
message.

Good point.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Nicholas,

Not a good idea, that way you force people to run
Services in the context
of
the interactive user (Interact with desktop).
Better would be to use remoting, or even COM.
Willy.

"Nicholas Paldino [.NET/C# MVP]"
in
message news:%[email protected]...
Jacek,

You can do this. Create a class that extends the
NativeWindow class
in
the System.Windows.Forms namespace. Then, get the
handle to the window
that
you want to intercept the messages of. Once you have that, assign it to
your new class (which derives from NativeWindow and
overrides WndProc),
and
then you should be set.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Hello
Is there any function to override in Windows Service to
get message from oter application? Something like WinProc
in Windows Application.
brgds
Jacek


.
 
Back
Top