1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| Imports System.Runtime.InteropServices
Public Class Form1
<DllImport("User32.dll")> _
Public Shared Function SendMessage(hWnd As IntPtr, uMsg%, wParam%, lParam$) As Integer
End Function
<DllImport("user32.dll")> _
Public Shared Function FindWindowEx(hwndParent As IntPtr, hwndChildAfter As IntPtr, lpszClass$, lpszWindow$) As IntPtr
End Function
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Dim processes As Process() = Process.GetProcessesByName("Débug")
If processes(0) IsNot Nothing Then
Dim Handle As IntPtr = FindWindowEx(processes(0).MainWindowHandle, New IntPtr(0), "WindowsForms10.EDIT.app.0.2bf8098_r13_ad1", Nothing)
SendMessage(Handle, 12, 0, "Ceci est 1 test !")
End If
End Sub
End Class |
Partager