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

后端 未结 1 676
终归单人心
终归单人心 2020-12-18 05:43

In a previous question, I asked how to send text to Notepad. It helped me immensely. For part 2, here\'s a simplified version of the same applied mIRC:

[Dl         


        
相关标签:
1条回答
  • 2020-12-18 06:00

    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.

    0 讨论(0)
提交回复
热议问题