HRESULT ExampleAsyncFunction(WS_ASYNC_CONTEXT* asyncContext);
void ExampleAsyncFunction()
{
// Set up the WS_ASYNC_CONTEXT structure.
MyState* myState = ...; \\ Declare a pointer to user-defined data.
WS_ASYNC_CONTEXT asyncContext;
asyncContext.callback = MyCallback; \\ Set the callback.
asyncContext.callbackState = myState; \\ Set the pointer to the user-defined data.
// Start the asynchronous operation
HRESULT hr = SomeFunction(&asyncContext);
if (hr == WS_S_ASYNC)
{
// The operation is completing asynchronously. The callback is called
// when the operation is complete.
}
else
{
// The operation completed synchronously. The callback is not called.
}
}
void CALLBACK MyCallback(HRESULT hr, WS_CALLBACK_MODEL callbackModel, void* callbackState)
{
MyState* myState = (MyState*)callbackState;
// The operation completed asynchronously.
}
As a developer, you are generally part of the data integration scenarios during and after a finance and operations apps implementation. This module explores web application programming interfaces (APIs) that are available for finance and operations apps and will help you understand the key differences between synchronous and asynchronous integrations for the application.