3
I’m having a hard time working with SendMessage()
, in some programs works from one method and with others from another...
To write on Notepad, I do the following:
[DllImport("user32.dll")]
public static extern IntPtr PostMessage(IntPtr Handle, uint Message, int lparam, int wParam);
[DllImport("user32.dll", EntryPoint = "FindWindowEx") ]
public static extern IntPtr FindWindowEx(IntPtr Handle, IntPtr Child, string lparam, string wParam);
static Process p = Process.GetProcessesByName("Notepad")[0];
public static void Message()
{
string msg = "Teste";
IntPtr child = DLLs.FindWindowEx(p.MainWindowHandle, new IntPtr(0), "Edit", null);
foreach(char c in msg){
DLLs.PostMessage(child, 0x102, Convert.ToChar(c), 0);
}
}
But if I need to send a message to a game, a spreadsheet in Word, Notepad++, Dreamweaver, etc, it doesn’t work...
How does it work in other cases? I read a little about Spy++, but it would be just like that?
Thanks, I’ll read it!
– user3062055