Share via


Comparing Win32 Code to OLE Code

The code for a simple Add function would look like this in the Win32 style of coding:

  int sum;
  sum = Add(10, 20);

In OLE style, the Add function would be written the following way:

HRESULT hr;
  int sum;
  hr = Add(10, 20, &sum);
  if (FAILED(hr)) {
    ...handle error..
  }