Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Undocumented API: MessageBoxTimeout

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Ksbunker
Advanced Cheater
Reputation: 0

Joined: 18 Oct 2006
Posts: 88

PostPosted: Sat Jun 30, 2007 8:44 pm    Post subject: Undocumented API: MessageBoxTimeout Reply with quote

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
View user's profile Send private message
appalsap
Moderator
Reputation: 0

Joined: 27 Apr 2006
Posts: 6753
Location: Pakistan

PostPosted: Sat Jun 30, 2007 9:00 pm    Post subject: Reply with quote

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
View user's profile Send private message
Ksbunker
Advanced Cheater
Reputation: 0

Joined: 18 Oct 2006
Posts: 88

PostPosted: Sat Jun 30, 2007 9:14 pm    Post subject: Reply with quote

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
View user's profile Send private message
appalsap
Moderator
Reputation: 0

Joined: 27 Apr 2006
Posts: 6753
Location: Pakistan

PostPosted: Sat Jun 30, 2007 9:50 pm    Post subject: Reply with quote

I know that, I say this about undocumented functions in general.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites