How to write and send text to mIRC in C#/Win32?

穿精又带淫゛_ 提交于 2019-11-28 11:26:08

This code works for me (mirc 6.31):

IntPtr mainHandle = FindWindow("mIRC", null);
IntPtr serverHandle = FindWindowEx(mainHandle, new IntPtr(0), "MDIClient", null);  
IntPtr chanHandle = FindWindowEx(serverHandle, new IntPtr(0), "mIRC_Channel", null);  
IntPtr editHandle = FindWindowEx(chanHandle, new IntPtr(0), "richEdit20A", null);
SendMessage(editHandle, 0x000C, 0, "Hello World");

Notice the changed window class (richedit20A instead of edit). Just found the correct class by using Spy++.

As for the window handles, one possibility is to use the EnumWindows or EnumChildWindows API.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!