EDN Admin
Well-known member
Hi all
I used Spy++ to catch the handle as well as the className of the notepad, but it doesnt work……
<pre style="font-family:NSimSun; background:#9ecfcf; color:black; font-size:13px <span style="color:blue public <span style="color:blue partial <span style="color:blue class <span style="color:#2b91af Form1 : <span style="color:#2b91af Form
{
[<span style="color:#2b91af DllImport(<span style="color:#a31515 "user32.dll")]
<span style="color:blue private <span style="color:blue static <span style="color:blue extern <span style="color:#2b91af IntPtr FindWindow(<span style="color:blue string className,<span style="color:blue string windowName);
[<span style="color:#2b91af DllImport(<span style="color:#a31515 "user32.dll", EntryPoint = <span style="color:#a31515 "SendMessageA")]
<span style="color:blue private <span style="color:blue static <span style="color:blue extern <span style="color:blue int SendMessage(<span style="color:#2b91af IntPtr hwnd, <span style="color:blue int wMsg, <span style="color:#2b91af IntPtr wParam, <span style="color:blue string lParam);
<span style="color:blue public Form1()
{
InitializeComponent();
}
<span style="color:blue private <span style="color:blue void Form1_Load(<span style="color:blue object sender, <span style="color:#2b91af EventArgs e)
{
}
<span style="color:blue private <span style="color:blue void button1_Click(<span style="color:blue object sender, <span style="color:#2b91af EventArgs e)
{
<span style="color:#2b91af IntPtr pointer = FindWindow(<span style="color:#a31515 "Edit",<span style="color:blue null);
<span style="color:#2b91af IntPtr p2 = <span style="color:blue new <span style="color:#2b91af IntPtr(0x0043044C);
<span style="color:blue if (pointer != <span style="color:#2b91af IntPtr.Zero)
{
<span style="color:#2b91af MessageBox.Show(<span style="color:#a31515 "Found!");
<span style="color:green //Send<br/> SendMessage(pointer, 0x000C,p2 , <span style="color:#a31515 "XYZ");
}
}
}[/code]
View the full article
I used Spy++ to catch the handle as well as the className of the notepad, but it doesnt work……
<pre style="font-family:NSimSun; background:#9ecfcf; color:black; font-size:13px <span style="color:blue public <span style="color:blue partial <span style="color:blue class <span style="color:#2b91af Form1 : <span style="color:#2b91af Form
{
[<span style="color:#2b91af DllImport(<span style="color:#a31515 "user32.dll")]
<span style="color:blue private <span style="color:blue static <span style="color:blue extern <span style="color:#2b91af IntPtr FindWindow(<span style="color:blue string className,<span style="color:blue string windowName);
[<span style="color:#2b91af DllImport(<span style="color:#a31515 "user32.dll", EntryPoint = <span style="color:#a31515 "SendMessageA")]
<span style="color:blue private <span style="color:blue static <span style="color:blue extern <span style="color:blue int SendMessage(<span style="color:#2b91af IntPtr hwnd, <span style="color:blue int wMsg, <span style="color:#2b91af IntPtr wParam, <span style="color:blue string lParam);
<span style="color:blue public Form1()
{
InitializeComponent();
}
<span style="color:blue private <span style="color:blue void Form1_Load(<span style="color:blue object sender, <span style="color:#2b91af EventArgs e)
{
}
<span style="color:blue private <span style="color:blue void button1_Click(<span style="color:blue object sender, <span style="color:#2b91af EventArgs e)
{
<span style="color:#2b91af IntPtr pointer = FindWindow(<span style="color:#a31515 "Edit",<span style="color:blue null);
<span style="color:#2b91af IntPtr p2 = <span style="color:blue new <span style="color:#2b91af IntPtr(0x0043044C);
<span style="color:blue if (pointer != <span style="color:#2b91af IntPtr.Zero)
{
<span style="color:#2b91af MessageBox.Show(<span style="color:#a31515 "Found!");
<span style="color:green //Send<br/> SendMessage(pointer, 0x000C,p2 , <span style="color:#a31515 "XYZ");
}
}
}[/code]
View the full article