This example will set the field of view in degrees to 100, in C code.
Code:
#include <windows.h>
int main(int argc, char* argv[])
{
HWND hwnd = FindWindow(0, TEXT("Modern Warfare 2"));
float fov = 100.0;
DWORD dwPId;
GetWindowThreadProcessId(hWnd, &dwPId);
HANDLE hProc = OpenProcess(PROCESS_VM_WRITE | PROCESS_VM_OPERATION, FALSE, dwPId);
WriteProcessMemory(hProc, (LPVOID)0x063FB5C0, &fov, sizeof(fov), NULL);
WriteProcessMemory(hProc, (LPVOID)0x063FB5D0, &fov, sizeof(fov), NULL);
return 0;
}
Explanation:
Creates a handle that looks for the Modern Warfare 2 window. Then it writes to 2 memory addresses with the value of the desired field of view, being 100 degrees. It's very very simple, you should add your own checks to make sure it writes the memory properly, as this makes no checks for say, window being present, if injection was successful, being able to open process etc. Also, add user input. You can find my more advanced version in this section.