responding to user defined message from other applications

L

Lonewolf

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
 
L

Lonewolf

Lonewolf said:
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.
 

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