Win8 HTTP API 和 异步编程 API

Win8 HTTP API 和 异步编程 API


Metro里推荐使用的API

Metro 异步编程

  • 用于本地c++编程APIConcurrency::task

    // basic-task.cpp
    // compile with: /EHsc
    #include <ppltasks.h>
    #include <iostream>
    
    using namespace Concurrency;
    using namespace std;
    
    int wmain()
    {
    task<int> t([]() {
        return 42;
    });
    
    t.wait();
    wcout << t.get() << endl;
    }
    
    /* Output:
    42
    */
    
  • 用于WinRT c++编程APIWindows::Foundation::IAsyncXXX

    Windows::Foundation::IAsyncAction
    Represents an asynchronous action.
    Windows::Foundation::IAsyncActionWithProgress<TProgress>
    Represents an asynchronous action that reports progress.
    Windows::Foundation::IAsyncOperation<TResult>
    Represents an asynchronous operation that returns a result.
    Windows::Foundation::IAsyncOperationWithProgress<TResult, TProgress>
    Represents an asynchronous operation that returns a result and reports progress.
    

猜你喜欢

转载自hexlee.iteye.com/blog/1525841
今日推荐