473,407 Members | 2,598 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,407 software developers and data experts.

RegisterWindowMessage

Hi,
I am sending windoew message from a c# application to c++(unmanage)
application using this code
System.UInt32 rm= RegisterWindowMessage("12345");

System.IntPtr ptr=(IntPtr)HWND_BROADCAST;

PostMessage(ptr,(int)rm,5,5);

PostMessage(ptr,WM_AAA,5,5);

but the c++(vc-6 mfc) dont catch the message, when i use the
RegisterWindowMessage("12345"); in the c++ application it return a diffrent
number from that in the c# application why?

Thanks.
Nov 17 '05 #1
1 6206
Dave,

It shouldn't return a different number. The window messages and the
strings they are mapped to are scoped on the machine level. The only way
they could be different was if the strings were not the same.

Are you sure that the strings match? Also, what is the version of the
API that is called by the unmanaged C++ application? Is it the Ansi version
(A) or the Unicode version (W)? If so, you should make sure that you are
calling the same conversion (so that you don't have issues with marshaling).

The same goes for the call to PostMessage.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Dave" <be******@netvision.net.il> wrote in message
news:ut**************@TK2MSFTNGP15.phx.gbl...
Hi,
I am sending windoew message from a c# application to c++(unmanage)
application using this code
System.UInt32 rm= RegisterWindowMessage("12345");

System.IntPtr ptr=(IntPtr)HWND_BROADCAST;

PostMessage(ptr,(int)rm,5,5);

PostMessage(ptr,WM_AAA,5,5);

but the c++(vc-6 mfc) dont catch the message, when i use the
RegisterWindowMessage("12345"); in the c++ application it return a
diffrent
number from that in the c# application why?

Thanks.

Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Dave | last post by:
Hi, I am sending windoew message from a c# application to c++(unmanage) application using this code System.UInt32 rm= RegisterWindowMessage("12345"); System.IntPtr ptr=(IntPtr)HWND_BROADCAST; ...
0
by: Brad | last post by:
Hi all, I've been using the well document Click Yes program for auto sending emails for some time now and it has done it's job perfectly. In fact I have been so impressed with this that I've...
0
by: TonyG | last post by:
I need to send a message to a window in another application. The name of the window is known at design time and set in the constant App2_MONITOR_CAPTION. The message is defined as X_GenerateEvent....
1
by: Dan Baker | last post by:
I am working in C# .Net. I would like to register a windows message (which I can do), and then post that message to a second application (which also works). The question: How can I detect when...
4
by: GTi | last post by:
Do anyone have a simple solution how I can send a simple message (int) from a C program to a C# program/service ? Preferred both ways C <-> C# (Windows messages - how ?) It must be extremely...
1
by: Dave | last post by:
Hi, I am sending windoew message from a c# application to c++(unmanage) application using this code System.UInt32 rm= RegisterWindowMessage("12345"); System.IntPtr ptr=(IntPtr)HWND_BROADCAST; ...
4
by: LamNgo | last post by:
Hi group, I have two application that need to communicate with each other, one written in C++ and the other in VB.NET. To communicate, I use "SendMessage" API to send message from C++ app to...
3
by: knikkix | last post by:
Hi, I created a form in VB.Net with only one button. This is the code in button click event Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles...
22
by: SQACSharp | last post by:
I'm trying to get the control name of an editbox in another window. The following code set the value "MyPassword" in the password EditBox but it fail to return the control name of the EditBox. ...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.