Share via

Self-closing MessageBox

Participant 51 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 development | Windows API - Win32

4 answers

Sort by: Most helpful
  1. RLWA32 52,366 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.

  2. Castorix31 91,866 Reputation points
    2024-09-09T13:27:50.5566667+00:00
    1 person found this answer helpful.

  3. RLWA32 52,366 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

  4. 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

Your answer

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