hi ya so my script wont work after i add in another part i know its a simple fix but its too hard for me where it says "case WM_CREATE - break;" thats the thing thats causing it to fail i want it to close cheat engine when it opens and the name is correct because i tried it for another process name and it worked in console application
i tried it for another process name and it worked in console application
FindWindow Documentation wrote:
For a description of a potential problem that can arise, see the Remarks for GetWindowText.
GetWindowText Documentation wrote:
If the window does not have a caption, the return value is a null string.
You are better off using "CreateToolhelp32Snapshot()", "Process32First()" and "Process32Next()" to find process based on the name of the executable, then pull the 'th32ProcessID' from the 'PROCESSENTRY32' struct that the later two populate. Not that you couldn't fix this issue or find some other metric to base your search off, but in my experience "FindWindow()" has always been a bit clunky.
EDIT: Oh! I almost forgot. A cheat engine will, by necessity, have loaded hooks into the target application that probably get cleaned up when it exits. But the function "TerminateProcess()" just drops the target process on the floor and doesn't allow destructors to run so those hooks will probably be left in the target process. If this is what you want then great, otherwise consider using "ExitProcess()": https://msdn.microsoft.com/en-us/library/windows/desktop/ms682658(v=vs.85).aspx