How do I make it so when a Countdown Timer hits 0, it closes the main window and posts a messagebox notifying the user that the time is up.
I've tried this
.if TimerVal==0
Invoke KillTimer,hWin,TimerID
Invoke MessageBox,NULL,Addr Toolong,Addr AppName,MB_OK
Invoke ExitProcess,NULL
and it runs the Window in the background and allows the user to still run the program by moving the messagebox. I've also tried
.if TimerVal==0
Invoke KillTimer,hWin,TimerID
Invoke DestroyWindow,hWnd
Invoke MessageBox,NULL,Addr Toolong,Addr AppName,MB_OK
Invoke ExitProcess,NULL
but this causes the MessageBox not to appear.

How would I make it so the Message box comes up after the window closes?
Posted on 2003-07-02 12:22:53 by EEDOK
invoke MessageBox,NULL,addr AppName,addr AppName,MB_OK

make message during WM_DESTROY
Posted on 2003-07-02 12:32:16 by AceEmbler
Thank you very much

One more question, I got this function
mov eax, Val#
sub HP#,eax
a whole bunch of times can I make it into a proc so I could invoke it like this without getting whacked out values? Plus making them all use the same sub function is something I'd also like.

invoke DecHP, addr HP#, addr Val#
Posted on 2003-07-02 12:39:44 by EEDOK
That would be no smaller. Push #+ Push #+ Call is 15 bytes, while mov eax, + sub ,eax is 11 bytes.
Posted on 2003-07-03 13:39:22 by Sephiroth3
I'm not quite sure of what you want to do... I think you have a bunch of variables, all one next to the other, and a second similar group of variables, and you want to substract the first bunch from the second, is that it?
If that's so, you can do it in a loop, you can think of it as an array...

push ebx
push esi
mov esi,offset HP
mov ebx,offset Val
sub [ebx],eax
add ebx,4
.until ebx >= offset wherever_HP_vars_end
pop ebx
pop esi

But it would only be useful if you really have a HUGE amout of variables...
Posted on 2003-07-03 13:48:48 by QvasiModo
well it's more to protect my program from ppl that are cheating, cause I know if the comp and you, have the same functions to decrease health I'll have made it so they can't cheat :P
Posted on 2003-07-03 22:35:23 by EEDOK
I'm sorry, I still can't follow you...
Posted on 2003-07-04 19:18:10 by QvasiModo
umm I seen it used in games before, but they used a diff function, fsub I do believe, how is that used?
Posted on 2003-07-04 22:45:06 by EEDOK
You mean you want some sort of checksum, so if a cheater changes the values but not the diff, you will kno what's going on? If that's so, you should use a better algo than simply substracting, or cheaters will find out how your scheme works and defeat it easily...
Posted on 2003-07-07 09:50:45 by QvasiModo
nah that's too easy to bypass, cause they just nop the checksum(that's what I got right now), but I know they were unable to hack Grand Theft Auto 3 cause it used something like fsub and fsptr to make everyones health value use the same sub fuction. I just want to know how to do it.
Posted on 2003-07-07 13:18:17 by EEDOK
I don't know much about cracking, but I think a program that's impossible to crack is a theorical impossibility... probably GTA3 is very hard to crack, but not impossible. Anyway, I think it does not matter much what instructions you use in your algo (fsub and the others are floating point instruction, by the way, there's a help file included un MASM32 that shows how to use those, FPHELP.HLP). GTA3 protection scheme could be based in the fact that since it's such a big game, you can basically hide dozens of checksums everywhere, making it very hard to crack...
Posted on 2003-07-08 08:50:50 by QvasiModo