471,605 Members | 1,675 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,605 software developers and data experts.

responding to user defined message from other applications

Hi all,
please pardon me if this sounds too simple. Basically I need to have
inter process communication, between a native MFC applicationa nd my C#
program. Basically it works something like this, the MFC application is
asctual a keyboard hook which translate keyboard combinations into
special codes. The keyboard in this case is actual a USB remote control
which generates keyboard combinations in the range of F13 to F24, and VK
keys of SHIFT and CTRL. basically the codes are UINT which represents
the keys on the remote control, such as STOP, PLAY, FF, REW etc. So,
when the remote control is pressed, the MFC program will receive the KB
combination via the system wide hook, and translate it to the special
codes, and send it to the C# program via WM_USER or WM_APP message. with
the WPARAM parameter containing the translated key. So my question is,

1) how do I handle this special WM_USER or WM_APP message in my C#
program? I don't know of any SystemEvent which can handle that.

I also need to call RegisterWindowMessage to get the unique ID for
communicating with the remote control app, this will allow it to know my
c# program's presence, and during the registeration phase, i will pass
over a handle to my app window in order for it to use PostMessage to
send the KB message to.

2) How safe is it to do it this way? passing over the Handle of the
winform to native code? will it change even if the winform is not
destroyed ?

3) How do I handle receiving of Registered window message in C#?

4) I don't know if IPCChannel in .NET 2 can be used on native code, is
it possible? Is there a more efficient way for 2 C# programs to
communicate with each other using something similar to the WM_USER or
WM_APP message mechanism? I'm only passing "blittable" data types such
as UINT between them, not strings.

5) In native windows API, there is this waitable timer which can bring
the system out of sleep or hibernate, is there a native .NET/C# way of
handling it (meaning not using P/Invoke) ? So far I did it using
C++/CLI assembly which wraps the call into the native code to set the
watable timer. It would be nice to "not have" to do it via managed
assembly.

Sorry for my long posting, I am grateful for any enlightenment. Have a
great day ! :D
Jan 17 '06 #1
1 2141
Lonewolf wrote:
Hi all,
please pardon me if this sounds too simple. Basically I need to have
inter process communication, between a native MFC applicationa nd my C#
program. Basically it works something like this, the MFC application is
asctual a keyboard hook which translate keyboard combinations into
special codes. The keyboard in this case is actual a USB remote control
which generates keyboard combinations in the range of F13 to F24, and VK
keys of SHIFT and CTRL. basically the codes are UINT which represents
the keys on the remote control, such as STOP, PLAY, FF, REW etc. So,
when the remote control is pressed, the MFC program will receive the KB
combination via the system wide hook, and translate it to the special
codes, and send it to the C# program via WM_USER or WM_APP message. with
the WPARAM parameter containing the translated key. So my question is,

1) how do I handle this special WM_USER or WM_APP message in my C#
program? I don't know of any SystemEvent which can handle that.

I also need to call RegisterWindowMessage to get the unique ID for
communicating with the remote control app, this will allow it to know my
c# program's presence, and during the registeration phase, i will pass
over a handle to my app window in order for it to use PostMessage to
send the KB message to.

2) How safe is it to do it this way? passing over the Handle of the
winform to native code? will it change even if the winform is not
destroyed ?

3) How do I handle receiving of Registered window message in C#?

4) I don't know if IPCChannel in .NET 2 can be used on native code,
is it possible? Is there a more efficient way for 2 C# programs to
communicate with each other using something similar to the WM_USER or
WM_APP message mechanism? I'm only passing "blittable" data types such
as UINT between them, not strings.

5) In native windows API, there is this waitable timer which can
bring the system out of sleep or hibernate, is there a native .NET/C#
way of handling it (meaning not using P/Invoke) ? So far I did it using
C++/CLI assembly which wraps the call into the native code to set the
watable timer. It would be nice to "not have" to do it via managed
assembly.

Sorry for my long posting, I am grateful for any enlightenment. Have a
great day ! :D


*ding dong* no one has done it before? or is it too trivial to event
warrant an answer? please enlighten me for those who know.
Jan 17 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Earl Anderson | last post: by
23 posts views Thread by ern | last post: by
24 posts views Thread by Rob R. Ainscough | last post: by
reply views Thread by Mike Eaton | last post: by
11 posts views Thread by =?Utf-8?B?QWNoaWxsZXNfX19f?= | last post: by
18 posts views Thread by rdahlstrom | last post: by
1 post views Thread by XIAOLAOHU | last post: by
reply views Thread by MichaelMortimer | last post: by
reply views Thread by CCCYYYY | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.