473,405 Members | 2,445 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,405 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 6205
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. ...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
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:
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.