/*특정 윈도우 Application에 Hook F5 Key 메세지 보내기*/

using NoName;
using NoName.Diagnostics;
using NoName.Text;//Encoding
using NoName.Runtime.InteropServices;

class HookingMessage
{
[DllImport("user32.dll", CharSet=CharSet.Auto)]
public static extern IntPtr SendMessage(IntPtr hWnd, int unMsg, IntPtr wParam, IntPtr lParam);

[DllImport("user32.dll", CharSet=CharSet.Auto)]
public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);

[DllImport("user32.dll")]
public static extern bool PostMessage(IntPtr hWnd, UInt32 Msg, int wParam, int lParam);

const UInt32 WM_KEYDOWN = 0x0100;
const int VK_F5 = 0x74;

public void running()
{
IntPtr ____handle_mmm=IntPtr.Zero;
bool ____toggle;

____handle_mmm = FindWindow(null, "CONSOLE.TRIS");
____toggle=PostMessage(____handle_mmm, WM_KEYDOWN, VK_F5, 0 );

if(____toggle==true) Console.WriteLine("PostMessage succ!!");
else Console.WriteLine("PostMessage fail!!");
}
}

class Program
{
public static void Main()
{
HookingMessage nm = new HookingMessage();
nm.running();
}
}



+ Recent posts