Im new at programming.
im going to make a program wich can send inputs/text to a game called minecraft - its a game made in Java.
im trying to use the SendMessage API but i dont know how to use it..
this is my code so far:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Diagnostics;
namespace MinecraftTest2_Sendinput
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
[DllImportAttribute("User32.dll")]
private static extern int FindWindow(String ClassName, String
WindowName);
[DllImportAttribute("User32.dll")]
private static extern int SetForegroundWindow(int hWnd);
[System.Runtime.InteropServices.PreserveSig]
[DllImport("User32.dll", CallingConvention = CallingConvention.Winapi, CharSet = CharSet.Ansi)]
public static extern int SendMessage(int hWnd, uint Msg, int wParam, long lParam);
private void button1_Click(object sender, EventArgs e)
{
int hWnd = FindWindow(null, "Minecraft");
if (hWnd > 0)
{
SetForegroundWindow(hWnd);
//I need to call the SendMessage here! but what should i type in the arguments?
}
}
}
}