Menu

command like Sleep ?

Sevko
2009-02-10
2012-09-26
  • Sevko

    Sevko - 2009-02-10

    Is there a command for console projects that it stops for a certain ammount of time like Sleep for win apps, and i don't mean stop like system("PAUSE"), but i mean pause it for a certain amount of tiem then continue. Thank you for your answer

     
    • Sevko

      Sevko - 2009-02-15

      thx cpns

       
    • Wayne Keen

      Wayne Keen - 2009-02-10
       
    • cpns

      cpns - 2009-02-10

      > like Sleep for win apps

      Not 'like' Sleep(), but Sleep() itself. What makes you thiong you cannot call Win32 API calls from console apps? Those that make sense (i.e. largely not associated with Windows event messaging), can be called freely.

      As easy as this:

      include <windows.h>

      include <tchar.h>

      int main()
      {
      MessageBox( 0, _T("Hey! I'm a console app."), _T("Console App"), MB_ICONEXCLAMATION|MB_OK ) ;

      Sleep( 2000 ) ;
      
      MessageBox( 0, _T(&quot;...and two seconds later...&quot;), _T(&quot;After Sleep()&quot;), MB_ICONSTOP|MB_OK ) ;
      
      return 0 ;
      

      }

      Clifford

       
      • cpns

        cpns - 2009-02-11

        > thiong

        think

        I wish this forum had an edit facility!

         

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.