Hey guys, sorry to bother you again.
The problem is I need to get the module size of the game, and I do it successfully by this code here:
Code:
MODULEINFO modinfo;
GetModuleInformation(GetCurrentProcess(), GetModuleHandle("AVA.exe"), &modinfo, sizeof(MODULEINFO));
return (unsigned long)modinfo.SizeOfImage
(I'm doing it through a DLL as you can see)
The problem is at the start of the game it shows uncorrect value like 0 or some lower number.
I tried to do it like this:
Code:
MODULEINFO modinfo;
do
{
ModuleSize = (unsigned long)modinfo.SizeOfImage;
Sleep(2000);
GetModuleInformation(GetCurrentProcess(), GetModuleHandle(filename), &modinfo, sizeof(MODULEINFO));
} while (ModuleSize != (unsigned long)modinfo.SizeOfImage);
But it doesn't always do the job.
So I come to the conclusion that I need to check if the game is fully loaded, and to do that I decided to do this at first:
Code:
while (FindWindow(NULL, "Alliance of Valiant Arms") == NULL) Sleep(2000);
Well it doesn't work.
Can you help me?
Thanks in advance to all the helpers.
Ho and forgot to say that of course I can put the Sleep function in the code but the loading time varies between computer, and it doesn't seem elegant to me.