zoukankan      html  css  js  c++  java
  • 隐藏终端程序窗口

    #include <iostream>
    using namespace std;
    
    // I'm using Vista ATM (it's evil), but GCC comes assuming the worst.
    // If you haven't patched your compiler to agree with the actual version
    // of the Windows OS, then you will need to make sure you do it like this.
    //
    #if       _WIN32_WINNT < 0x0500
      #undef  _WIN32_WINNT
      #define _WIN32_WINNT   0x0500
    #endif
    #include <windows.h>
    
    // Here's some fun timer stuff for the user.
    // (Notice how he won't see it work when the
    //  console is hidden, but it will still work.)
    void timeout()
      {
      for (int cntr = 3; cntr > 0; cntr--)
        {
        cout << "
    " << cntr << flush;
        Sleep( 1000 );
        }
      cout << "
    " << flush;
      }
    
    // Demonstrate some fun stuff.
    // Notice how hiding the console window causes it to disappear from
    // the Windows task bar. If you only want to make it minimize, use
    // SW_MINIMIZE instead of SW_HIDE.
    //
    int main()
      {
      cout << "Preparing to hide the console window
    ";
      timeout();
      ShowWindow( GetConsoleWindow(), SW_HIDE );
    
      cout << "Preparing to show the console window
    ";
      timeout();
      ShowWindow( GetConsoleWindow(), SW_RESTORE );
    
      cout << "All done!
    ";
      return 0;
      }

    copy from: http://www.cplusplus.com/forum/beginner/12001/

  • 相关阅读:
    2.5.4 使用popupWindow
    2.5.3 使用alertDialog创建自定义对话框
    2.5.2 使用alertdialog 创建列表对话框
    2.5.1 使用alertDialog
    2.4.12 画廊视图
    2.4.11 网格视图和图像切换器
    2.4.10 可展开的列表组件
    2.4.9 列表视图
    2.4.8 滚动视图
    2.4.7 选项卡的功能和用法
  • 原文地址:https://www.cnblogs.com/albertofwb/p/6184541.html
Copyright © 2011-2022 走看看