mirror of
https://github.com/yaakov-h/Notepad.Extensions.Logging.git
synced 2024-11-22 03:04:48 +00:00
Move edit window lookup too
This commit is contained in:
parent
75db9915a5
commit
e512889b17
2 changed files with 8 additions and 2 deletions
|
@ -85,8 +85,7 @@ namespace Microsoft.Extensions.Logging
|
|||
static void WriteToNotepad(string message)
|
||||
{
|
||||
IntPtr hwnd = WindowFinder.FindNotepadWindow();
|
||||
IntPtr edit = NativeMethods.FindWindowEx(hwnd, IntPtr.Zero, "EDIT", null);
|
||||
NativeMethods.SendMessage(edit, NativeMethods.EM_REPLACESEL, (IntPtr)1, message);
|
||||
NativeMethods.SendMessage(hwnd, NativeMethods.EM_REPLACESEL, (IntPtr)1, message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,13 @@ namespace Microsoft.Extensions.Logging
|
|||
static class WindowFinder
|
||||
{
|
||||
public static IntPtr FindNotepadWindow()
|
||||
{
|
||||
var hwnd = FindMainWindow();
|
||||
IntPtr edit = NativeMethods.FindWindowEx(hwnd, IntPtr.Zero, "EDIT", null);
|
||||
return edit;
|
||||
}
|
||||
|
||||
static IntPtr FindMainWindow()
|
||||
{
|
||||
IntPtr hwnd;
|
||||
|
||||
|
|
Loading…
Reference in a new issue