How to make messagebox with automatic timer?
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8

Thread: How to make messagebox with automatic timer?

Hybrid View

  1. #1
    Join Date
    Jul 2009
    Posts
    16

    Angry How to make messagebox with automatic timer?

    Hi:

    So I am programming in win32. I want to make a message box that would destroy itself after a certain amount of time, even if the user does not click on it. How would I do that?

    When I searched on the web regarding this question, the only thing I was able to find was to create a new form. But when I tried doing that by going to the Solution Explorer, and clicking "add->Windows Form", it gave me some kind of errors: "Object doesn't support this property or method".

    How else could I mimic a messagebox, so it will be just like a messagebox except it will have some kind of automatic timer in it?

    PS: I don't want a dialog box because it is modal.

    Any help will be appreciated. Thanks.

    -Sheri

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    11,292

    Re: How to make messagebox with automatic timer?

    It's unclear what language you are programming. You state that you are programming in Win32, but then you say that you are attempting to create a new form (form implies .net).

    Btw, a dialog box doesn't have to be modal - it can be modeless.

    In general, to solve your problem, you create a dialog and in it's initialization (depending on the language used), you fire off a timer. When the timer triggers, you close the dialog (or destroy it if it's modeless).

  3. #3
    Join Date
    Jul 2009
    Posts
    16

    Re: How to make messagebox with automatic timer?

    Thank you.

    I made a modeless dialog box, and this works. But I'm still wondering, there's no way to just create a messagebox that will destroy itself after certain amount of time? I'm not doing .net, so I guess a new form is not possible.

    -Sheri

  4. #4
    Arjay's Avatar
    Arjay is offline Moderator / MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    11,292

    Re: How to make messagebox with automatic timer?

    Quote Originally Posted by shericn View Post
    Thank you.

    I made a modeless dialog box, and this works. But I'm still wondering, there's no way to just create a messagebox that will destroy itself after certain amount of time? I'm not doing .net, so I guess a new form is not possible.

    -Sheri
    Of course it's possible to write a self closing dialog.

    However, we can't help you if you don't answer the questions we've asked.

    What language are you programming in?
    What development environment are you using?

  5. #5
    Join Date
    Jul 2009
    Posts
    16

    Re: How to make messagebox with automatic timer?

    I'm programming in C/C++, using Windows Mobile development environment.

    Thanks for helping.

    -Sheri

  6. #6
    Join Date
    Mar 2009
    Location
    Riga, Latvia
    Posts
    128

    Re: How to make messagebox with automatic timer?

    Hello!

    I was thinking about you problem for some time. I'll speak in terms of WinAPI but you could find smth like this in Windows Mobile (possibly).

    Create a MessageBox() with "strange" title, say "Title ~~~my msg box to be found~~~"
    Start a tread just before you create a MessageBox(), wait a bit in a tread, then FindWindow().

    Play with it in a tread. Close the box in a tread or modify it's content (but it doesn't seem to be portable).

    Pay attention on situations when user closed your MessageBox.

    I never tried this, but it seems to be logical. If it helped make me a note.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center