CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2003
    Posts
    18

    Close Application During Certain Time

    Can anyone give me a portion of code relating to this situation:

    I want my Application To open for 1000 miliseconds ...and then it close automitically after 1000 milis...sort of a splash window for ur infor

    For my current understanding WaitForSingleObject has been used together with GetExitCodeProcess....


    Can someone give me a portion of code pls...starting from obtaining a handle for my application to closing my app after 1000 milis .Thx

  2. #2
    Join Date
    Feb 2002
    Posts
    5,757
    One solution is a timer.

    Kuphryn

  3. #3
    Join Date
    Jul 2003
    Location
    Korea
    Posts
    60
    SendMessage WM_CLOSE whenever you want to close your application.
    Quang

  4. #4
    Join Date
    May 2000
    Location
    KY, USA
    Posts
    18,652
    Well...I am not sure whether I understood completely...but if you want to shor your application only for one second...add the following to your dialog...
    Code:
    BOOL CMyDlg::OnInitDialog()
    {
      ...
    
      if(!SetTimer(100, 1000, 0))
        EndDialog(IDCANCEL);
    
      return TRUE;
    }
    
    void CMyDlg::OnTimer(UINT nIDEvent)
    {
      if(nIDEvent == 100)
      {
        // Kill timer
        KillTimer(100);
    
        EndDialog(IDOK);
    
        return;
      }
    
      CDialog::OnTimer(nIDEvent);
    }

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured