If you can send me the Visual Studio project in a ZIP or RAR, I'll fix it for you.
In the class that you showed us, does WriteInteger, ReadInteger, ProcessHandle and WriteBytes all live in the same class? If it is in a different class or file, you'll need to reference that class/file. It's always a good idea to separate your "working code" from your user interface code. The GUI runs on one thread and if your "working code" happens to run on the same thread, the GUI will become unresponsive and the user will think it's crashed. You can remedy this using a BackgroundWorker, Threading, etc. The way that I use the functions in another class is by instantiating it in my GUI code such as:
Code:
using System.Threading.Tasks;
using System.Windows.Forms;
namespace YourNamespace
{
public partial class UserInterface : Form1
{
// Instantiates the HackFunctions class where all your functions live. Now you can use it in your code.
HackFunctions hacks = new HackFunctions();
public UserInterface()
{
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
// If the selected process is correct and the checkbox is checked, continue.
if (hacks.Process_Handle("iw5mp") && checkBox1.Checked == true)
hacks.WriteInteger(OFFS_FB, 4);
else
WriteInteger(OFFS_FB, 9);
}
}
}
}
Tips: Back when I started programming I learned from the same mistake you're making. Always document your code. One time, I got up and went to get some lunch and came back and had NO idea what I wrote. This is an example of something I wrote recently, I comment on everything.
Code:
// This method performs the actual installation of the mods to the target directory. It is essentially just copying the mods the user selects to the target directory.
private static void CopyAllDirectories(DirectoryInfo source, DirectoryInfo target)
{
// Checks if directory exists.
Directory.CreateDirectory(target.FullName);
// Copy each file into the new directory.
foreach (FileInfo file in source.GetFiles())
{
file.CopyTo(Path.Combine(target.FullName, file.Name), true);
Console.WriteLine(@"Copying {0}\{1}", target.FullName, file.Name); // For debugging purposes.
}
// Copy each subdirectory using recursion.
foreach (DirectoryInfo diSourceSubDir in source.GetDirectories())
{
DirectoryInfo nextTargetSubDir =
target.CreateSubdirectory(diSourceSubDir.Name);
CopyAllDirectories(diSourceSubDir, nextTargetSubDir);
}
}