using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.InteropServices;
namespace sendmessage
{
class SendMsg
{
//C#中调用Win32中的API
[DllImport("user32.dll", EntryPoint = "FindWindow", SetLastError = true)]
private static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
[DllImport("user32.dll", EntryPoint = "FindWindowEx", SetLastError = true)]
private static extern IntPtr FindWindowEx(IntPtr hwndParent, uint hwndChildAfter, string lpszClass, string lpszWindow);
[DllImport("user32.dll", EntryPoint = "SendMessage", SetLastError = true, CharSet = CharSet.Auto)]
private static extern int SendMessage(IntPtr hwnd, uint wMsg, int wParam, int lParam);
[DllImport("user32.dll")]
private sta
c#向MFC窗体发送消息
最新推荐文章于 2024-07-06 14:21:48 发布
本文介绍了如何使用C#编写代码,通过SendMsg类向MFC窗体发送特定的消息,例如传递字符串数据。在示例中,'界面'是目标窗口的标识,0x3ee是消息类型,'发送的数据'是实际传递的信息。
摘要由CSDN通过智能技术生成