O'Reilly logo

Learning DCOM by Thuan L. Thai

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Nonblocking Calls

Asynchronous communication is supported in Windows 2000 by a feature that is called nonblocking calls, which allows a client to request a lengthy operation without being blocked. In other words, the client can proceed with further processing after requesting the operation. The server component will notify the client when the lengthy operation is completed. Windows 2000 supports asynchronous invocation via a new MIDL interface attribute called async_uuid. An example of an asynchronous interface is shown here:

[ object, uuid(D9F23D61-A647-11d1-ABCD-00207810D5FE),
  async_uuid(AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA) ]
interface IOcr : IUnknown {
    HRESULT OcrImage([in] long lImageSize,
                     [in, size_is(lImageSize)] byte * pbImage,
                     [out, string] wchar_t **pwszOcrText);
}

Because this MIDL snippet uses the async_uuid attribute, MIDL will generate two interface definitions for the IOcr interface: a normal (synchronous) version and an asynchronous version. You are familiar with the synchronous version:

interface IOcr : public IUnknown {
public:
   virtual HRESULT OcrImage(
      /* [in] */ long lImageSize,
      /* [size_is][in] */ byte *pbImage,
      /* [string][out] */ wchar_t **pwszOcrText) = 0;
};

But you’ve never seen the asynchronous version:

interface AsyncIOcr : public IUnknown {
public:
   virtual HRESULT begin_OcrImage(
      /* [in] */ long lImageSize,
      /* [size_is][in] */ byte *pbImage) = 0;
   virtual HRESULT finish_OcrImage(
      /* [string][out] */ wchar_t **pwszOcrText) = 0;
};

The asynchronous version ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required