Need help with placing text in other program

Dec 6 2007 9:02 PM
I have read the other post about this topic but I don't fully understand it.  I tried to make my own and I get "No overload for method 'SendMessage' takes '4' arguments" error.  I have 1 button on my program and I want it to put some text into note pad.  I am just trying this cause I'm making a program that holds my cd-keys for my games and other programs and places them in the boxes when I'm installing the game.  What am I doing wrong?


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace WindowsApplication4
{
    public partial class Form1 : Form
    {
       [DllImport("User32.dll")]
       public static extern Int32 SendMessage(String um,String textToSend);

        private void button1_Click(object sender, EventArgs e)
        {
        string z = "TEXT";
        const int WM_SETTEXT = 0x0C;
        SendMessage(Handle, WM_SETTEXT, 4, z);
        }
        }

    }

I tried to read some stuff about the arugment erros but I coulden't find anything that would help.

Answers (7)