 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
Ksbunker Advanced Cheater
Reputation: 0
Joined: 18 Oct 2006 Posts: 88
|
Posted: Sat Jun 30, 2007 8:44 pm Post subject: Undocumented API: MessageBoxTimeout |
|
|
I was looking through user32.dll and managed to come across some API not officially supported by MSDN (reasons unknown). Its interesting to note that the MessageBox() function uses MessageBoxTimeout and passes FFFFFFFFh as the timeout value (long time, approx ~49 days).
The last paramater is the timeout value and it determines how long the messagebox will be displayed untill it closes itself.
I've developed a simple wrapper function for MessageBoxTimeout().
It's in ASM, but can be ported without hassle to any language.
| Code: | MsgBoxTimeout PROC hWnd:HWND, lpText:DWORD, lpCaption:DWORD, MSG_ID:DWORD, elapse:DWORD
.data
szUser32 db "user32.dll", 0
szMessageBoxTimeoutA db "MessageBoxTimeoutA", 0
.code
Invoke LoadLibrary, ADDR szUser32
Invoke GetProcAddress, eax, ADDR szMessageBoxTimeoutA
push elapse
push 0
push MSG_ID
push lpCaption
push lpText
push _hWnd
CALL EAX
ret
MsgBoxTimeout ENDP |
Usage;
| Code: | | INVOKE MsgBoxTimeout, hWnd, SADD("Text"), SADD("Caption"), MB_OK, 10000 |
10000 = 10 seconds
|
|
| Back to top |
|
 |
appalsap Moderator
Reputation: 0
Joined: 27 Apr 2006 Posts: 6753 Location: Pakistan
|
Posted: Sat Jun 30, 2007 9:00 pm Post subject: |
|
|
If they don't document it, it means they don't want to support it. This means using it is extremely stupid; updates can and will break your code. As an side note, WINE doesn't support MessageBoxTimeout yet so your app is already broken there.
This is old and well known anyway...
|
|
| Back to top |
|
 |
Ksbunker Advanced Cheater
Reputation: 0
Joined: 18 Oct 2006 Posts: 88
|
Posted: Sat Jun 30, 2007 9:14 pm Post subject: |
|
|
| I can give no reassurance that microsoft will not remove the function. However as mentioned, the fact that the all important MessageBox() function calls it, is in my eyes, evidence enough to suggest that in the near future, the liklihood of it being removed is minimal.
|
|
| Back to top |
|
 |
appalsap Moderator
Reputation: 0
Joined: 27 Apr 2006 Posts: 6753 Location: Pakistan
|
Posted: Sat Jun 30, 2007 9:50 pm Post subject: |
|
|
| I know that, I say this about undocumented functions in general.
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|