473,395 Members | 1,675 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.

Send Message(string) c# exe to vc++ exe(unmanaged) using WindowsSendMessage

I tried followinf but working fine fo int but how to do it for string using
user custome message

in c#
[DllImport("User32.dll")]

public static extern int FindWindow(string strClassName,string
strWindowName);

[DllImport("User32.dll")]

public static extern Int32 SendMessage(

int hWnd, // handle to destination window

int Msg, // message

int wParam, // first message parameter

[MarshalAs(UnmanagedType.LPStr)] string lParam);

public const int WM_APP = 0x8000;

public const int WM_DELETEALL =WM_APP + 0x100;

int wnd=FindWindow(null,"TestMfcSendMsgExe");

Form1.SendMessage(wnd,WM_DELETEALL,0,55);

and MFC Exe is like this

#define WM_DELETEALL WM_APP + 0x100

BEGIN_MESSAGE_MAP(CTestMfcSendMsgExeDlg, CDialog)

ON_MESSAGE (WM_DELETEALL, OnDeleteAll)
END_MESSAGE_MAP()

LRESULT CTestMfcSendMsgExeDlg::OnDeleteAll(WPARAM wParam, LPARAM lParam)

{

MessageBox("Hello","Mayur",MB_OK);

}

I am getting the message box after using SendMessage() in c# exe but i want
to send text(string ) information.

I need help..

Regards,

Mayur.


Nov 24 '06 #1
1 1698

"Mayur" <ma***@activelement.comwrote in message
news:uO**************@TK2MSFTNGP06.phx.gbl...
>I tried followinf but working fine fo int but how to do it for string using
user custome message
go directly to www.pinvoke.net, do not pass go, do not collect 200 MB.
>
in c#
[DllImport("User32.dll")]

public static extern int FindWindow(string strClassName,string
strWindowName);

[DllImport("User32.dll")]

public static extern Int32 SendMessage(

int hWnd, // handle to destination window

int Msg, // message

int wParam, // first message parameter

[MarshalAs(UnmanagedType.LPStr)] string lParam);

public const int WM_APP = 0x8000;

public const int WM_DELETEALL =WM_APP + 0x100;

int wnd=FindWindow(null,"TestMfcSendMsgExe");

Form1.SendMessage(wnd,WM_DELETEALL,0,55);

and MFC Exe is like this

#define WM_DELETEALL WM_APP + 0x100

BEGIN_MESSAGE_MAP(CTestMfcSendMsgExeDlg, CDialog)

ON_MESSAGE (WM_DELETEALL, OnDeleteAll)
END_MESSAGE_MAP()

LRESULT CTestMfcSendMsgExeDlg::OnDeleteAll(WPARAM wParam, LPARAM lParam)

{

MessageBox("Hello","Mayur",MB_OK);

}

I am getting the message box after using SendMessage() in c# exe but i
want
to send text(string ) information.

I need help..

Regards,

Mayur.


Nov 24 '06 #2

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

Similar topics

5
by: Andrew Connell | last post by:
Having fits transforming an XML string using an XSL file. In the 1.1 version of the framework, I see that the XmlResolver is heavily used in the XslTransform class. However, that looks like I am...
4
by: Dan Diephouse | last post by:
I am attempting to write a DLL which wraps C# code. The issue at hand is a print driver allows you to extend it by writing a DLL. Seeing that VC++ seems to be hopelessly out of my mental reach, I...
2
by: Maziar Aflatoun | last post by:
Hi guys, I'm using Windows authentication to connect to SQL Server 2000. On my computer the connection is fine. Now if I move it to a remote server, how to I hard code my Username/Password in...
2
by: Bruno | last post by:
Hello friends I'm creating one application that will send content to another app using HTTP connection. To authenticate my connection, I need to send a string with the username and password...
3
by: minguskhan | last post by:
Does anyone know how to reverse a string using a loop?
5
by: Rodger | last post by:
I have a script that I want to run however I cannot get it to work. Every time I run the script I get . . . . . HERE IS THE CODE (ASP) set wshell = CreateObject("WScript.Shell") wshell.run...
2
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);
0
by: amitsaxena | last post by:
hi, I am using c#.net 2005, i am using .net port class to access the com ports but i m confused to send the message string with present com port .i want to send the message and also return the...
6
by: Volodia | last post by:
Hi, I have a problem to find information how to add unmanaged dll build in VC++ 2005 to the asp.net web site What I have tried: 1. use DllImport("MyDll.dll") to declare function in...
6
by: koutoo | last post by:
How do I delete or remove values from a list or string using the index. If a = and I want to get rid of 1 -5, how would I do that? Thanks.
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...
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
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...

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.