Hi, I'm using Microsoft Visual C++ 2005 express edition, and I am currently writing a program to write to the memory in a game. I got what I needed to get working, but when I can't seem to simplify down the code, without getting errors.
Basically I have 6 Combo Box's, and each combo box has about 10 different selections (all the same).
This code works:
Here is what I'm trying to simplify it down to, but running into errors.Code:byte data[4]; byte data2[4]; selectedIndex[0] = comboBox1->SelectedIndex; selectedIndex[1] = comboBox2->SelectedIndex; //selectedIndex 2 3 4 5.. if(selectedIndex[0] == 0){ byte data[4] = {0x6c, 0x18, 0xf2, 0x4b}; byte data2[4] = {0x9d, 0x05, 0x11, 0xe7}; WriteProcessMemory(phandle, (LPVOID)0x4BF4A700, (LPVOID) &data, 4, 0); WriteProcessMemory(phandle, (LPVOID)0x4BF4A708, (LPVOID) &data2, 4, 0); WriteProcessMemory(phandle, (LPVOID)0x4BF4A7CC, (LPVOID) &data, 4, 0); WriteProcessMemory(phandle, (LPVOID)0x4BF4A7D4, (LPVOID) &data2, 4, 0); } else if(selectedIndex[0] == 1){ byte data[4] = {0x7f, 0xd8, 0xf2, 0x4b}; byte data2[4] = {0x14, 0x04, 0x88, 0xe5}; WriteProcessMemory(phandle, (LPVOID)0x4BF4A700, (LPVOID) &data, 4, 0); WriteProcessMemory(phandle, (LPVOID)0x4BF4A708, (LPVOID) &data2, 4, 0); WriteProcessMemory(phandle, (LPVOID)0x4BF4A7CC, (LPVOID) &data, 4, 0); WriteProcessMemory(phandle, (LPVOID)0x4BF4A7D4, (LPVOID) &data2, 4, 0); //else if(selectedIndex .. 4 more continue this way.
Anyway that can simplify this code is greatly appreciated. Thanks.Code:byte data[4]; byte data2[4]; selectedIndex[0] = comboBox1->SelectedIndex; selectedIndex[1] = comboBox2->SelectedIndex; //selectedIndex 2 3 4 5.. for(int i = 0; i < 5; i++){ if(selectedIndex[i] == 0){ byte data[4] = {0x6c, 0x18, 0xf2, 0x4b}; byte data2[4] = {0x9d, 0x05, 0x11, 0xe7}; } else if(selectedIndex[i] == 1){ byte data[4] = {0x7f, 0xd8, 0xf2, 0x4b}; byte data2[4] = {0x14, 0x04, 0x88, 0xe5}; } //else if(selectedIndex .. 4 more continue this way. WriteProcessMemory(phandle, (LPVOID)0x4BF4A700, (LPVOID) &data, 4, 0); WriteProcessMemory(phandle, (LPVOID)0x4BF4A708, (LPVOID) &data2, 4, 0); WriteProcessMemory(phandle, (LPVOID)0x4BF4A7CC, (LPVOID) &data, 4, 0); WriteProcessMemory(phandle, (LPVOID)0x4BF4A7D4, (LPVOID) &data2, 4, 0);
- Crypt Easy -



LinkBack URL
About LinkBacks



