Self-closing MessageBox

Participant 41 Reputation points
2024-09-09T13:05:47.51+00:00

What would the code look like that displays a message that will close in 5 seconds?

I'm interested in Win32 functions, not the capabilities of programming languages ​​(C#, C++, etc.).

Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,609 questions
{count} votes

4 answers

Sort by: Most helpful
  1. Castorix31 85,116 Reputation points
    2024-09-09T13:27:50.5566667+00:00
    1 person found this answer helpful.

  2. RLWA32 45,476 Reputation points
    2024-09-09T13:34:03.1+00:00

    There is a Windows API function that will create a self-closing message box based on a timer - WTSSendMessageA function. Refer to the function's Timeout argument. You can obtain the session id of your own session by calling the ProcessIdToSessionId function.

    1 person found this answer helpful.

  3. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.

    1 deleted comment

    Comments have been turned off. Learn more

  4. RLWA32 45,476 Reputation points
    2024-09-12T15:19:34.23+00:00

    If you are willing to write some code a timed message box can also be implemented using the TaskDialogIndirect function to take advantage of its built-in timer and callback feature.

    
    TDF_CALLBACK_TIMER
    
    	Indicates that the task dialog's callback is to be called approximately every 200 milliseconds. 
    
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.