473,698 Members | 2,084 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 RegisterWindowM essage 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 2215
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 RegisterWindowM essage 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
2463
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
12735
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 defined" error on the third line of code (Dim rs As ADODB.Recordset) I'm using below: " Function Next_Custom_Counter() On Error GoTo Next_Custom_Counter_Err Dim rs As ADODB.Recordset
2
5481
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, produce a "function not defined" message when the SELECT statement is executed, even having previously worked on that machine. What can I do to correct this difficulty when it occurs? What do I need to know about user-defined functions in SELECT...
23
3914
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 a way to stop the execution with user input. I was thinking something like this: while(user hasn't pressed 'any key'){ keepExecutingScript(); }
24
1912
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 deployment my app is 427KB (even with modem dialup speed it doesn't take long to download) -- the user gets a very friendly secure WindowsForm app (most of them don't even notice they're not under IE anymore) that performs considerably faster than...
0
1393
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 another class, I'll call Class1 (i.e. accesses its startup, shutdown, print reports methods). Basically, Class1 manages communication between two other classes: one is a class that listens for a socket connection from another application and the...
11
2242
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 weeks experience), so it could be some basic issue that im not aware of. Please let me know if any part is not clear. namespace newprogram { public partial class form1: Form
18
3245
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, and mostly server 2003. Everyone will have Python 2.5.1 on them, and the script would be running locally. Any ideas?
7
1987
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 browsing the website from the local machine. While investigating the problem, we added a second copy of the website, created a second virtual directory in IIS, tried to access it, and it worked. The original website was still not responding. ...
0
8672
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
0
8600
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9156
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9021
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8860
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
4361
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4614
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3038
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2323
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.