473,507 Members | 11,134 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to get the string passed by SendMessage?

1. I am using SendMessage (HWND_BROADCAST, WM_FONTCHANGE, 0,
(LPARAM)pFileName); in C++ side
2. In WndProc, I wanted to get the fileName from m.lparam, which is a
IntPtr. How can I convert it to a string in C#

Thanks.
Aug 15 '06 #1
2 2496
Gary,

You can pass this to the IntPtr to the static PtrToStringAnsi or
PtrToStringUni methods on the Marshal class depending on what version of
SendMessage was called (SendMessageA, or SendMessageW).

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

"Gary" <Ga**@discussions.microsoft.comwrote in message
news:87**********************************@microsof t.com...
1. I am using SendMessage (HWND_BROADCAST, WM_FONTCHANGE, 0,
(LPARAM)pFileName); in C++ side
2. In WndProc, I wanted to get the fileName from m.lparam, which is a
IntPtr. How can I convert it to a string in C#

Thanks.

Aug 15 '06 #2
Gary wrote:
1. I am using SendMessage (HWND_BROADCAST, WM_FONTCHANGE, 0,
(LPARAM)pFileName); in C++ side
2. In WndProc, I wanted to get the fileName from m.lparam, which is a
IntPtr. How can I convert it to a string in C#

Thanks.
I'm not sure that pointer is valid in other applications/processes
(other than one that call SendMessage). Check WM_COPYDATA if you need IPC.

Regards,
Goran
Aug 15 '06 #3

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

Similar topics

5
5843
by: Adam Clauss | last post by:
I am attempting to set the text on a richedit control in another application using EM_SETTEXTEX:...
0
1007
by: Tim Mulholland | last post by:
I asked this a few days ago and never got a response. Hopefully someone can help me now as i'm giving more information I have an MFC app that i'm trying to send messages to using the SendMessage...
10
5734
by: muntyanu | last post by:
Hi all, In C# system service I need to get some string from MFC mainframe window by SendMessage() API call. I managed to send message, but can not find the way to return string to C# app. Is...
1
1664
by: Daniel Halan | last post by:
Hello, I want to send a SendMessage(hwnd,...) to an another application containing eighter a "String" or a PIDL... I know that the pointer lives in its own process so the other app will have...
14
1815
by: Erik | last post by:
Hi, i'm trying to do this : #include <stdlib.h> #include <stdio.h> #define FILE "/tmp/myfile" #define USERS_LIST "/tmp/userslist" int main() { //open file
3
2654
by: growse | last post by:
Right, I've got a 2 c# programs here. Lets call them A and B. My aim is to send a simple string from B to A. A is always running. I've overridden the WndProc method to give me messages that are...
4
2121
by: Abubakar | last post by:
Hi, My application has a lot of threads which at some point call SendMessage api passing it the handle of the gui window. The calls r a lot. My question is that should I call the SendMessage api...
2
12512
by: Mayur | last post by:
I tried followinf but working fine fo int but how to do it for string using user custome message in c# public static extern int FindWindow(string strClassName,string strWindowName);
14
12610
by: Kerem Gümrükcü | last post by:
Hi, i want to emulate a (synchronous) BroadCastSystemMessage with EnumWindows and SendMessage. I dont want to use the BroadcastSystemMessage because it needs the SE_TCB_NAME Privilege (you...
0
7110
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
7314
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,...
0
7372
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
7482
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
5623
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,...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3191
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...
0
1540
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 ...
0
411
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.