473,395 Members | 1,404 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 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 2202
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

26
by: Simon | last post by:
I'm doing a survey. When do you think GNU/Linux will be ready for the average Joe? What obstacles must it overcome first?
6
by: Earl Anderson | last post by:
In A97 on WinXP, I'm trying to use a KB function to provide the next sequential number in a custom counter (a table with two fields-- and ). When I run it, I get the "User-defined type not...
2
by: David Emme | last post by:
Access 97 I have a number of SELECT statements which contain references to user-defined VBA functions. These typically work as expected, but occasionally, on one user's machine or another,...
23
by: ern | last post by:
I have a program that runs scripts. If the user types "script myScript.dat" the program will grab commands from the text file, verify correctness, and begin executing the script UNTIL... I need...
24
by: Rob R. Ainscough | last post by:
VS 2005 I have: ClickOnce deployment User's that hate and or don't want to use an IE Client (don't blame them) I don't see how ASPX web pages are going to survive? With .NET 2.0 and clickonce...
0
by: Mike Eaton | last post by:
Hi there, I have an app whose structure is as follows: a module calls a custom application context containing a notify icon and associated context menu, which in turn acts upon an instance of...
11
by: =?Utf-8?B?QWNoaWxsZXNfX19f?= | last post by:
Im finding problem with this code. When i try to display the newindow, its not responding. It does create the new window, but doesnt respond at all. Just stays blank. I'm fairly new to c#(just a...
18
by: rdahlstrom | last post by:
Does anyone know how to determine the window status (Running or Not Responding)? I've tried various methods with no success... This would be on a variety of Windows systems, but all at least XP,...
7
by: mills.toby | last post by:
We have a Windows 2003 Server, serving an asp.net (2.0) website. Recently the website stopped responding. When trying to access the website, no response is received at all. This includes when...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.