Executing an External DLL Function

When you choose the Picture command on the Viewer menu (IDM_MVBMP message), MENUDEMO actually calls a function in a DLL external to Viewer. This function, HDisplayBmp, displays bitmaps (up to 256 colors) in an extended window. (It is registered in the project file so that authors can use it as a standard Viewer command in the authoring environment.)

The mechanism of using MVAPI to execute Viewer commands can also be used to execute external DLL functions like HDisplayBmp. In MENUDEMO, the following code performs this call:

case IDM_MVBMP:
    CheckLoadUsa(hwnd) ;
    MVAPI(hwnd, BookPath, cmdMacro,
          (DWORD)(LPSTR)"HDisplayBmp(hwndContext, qchPath,
                         \"!az_nick.dib\",\"GrandCanyon\")");
   return 0 ;

As in the History example, the DLL call is a hard-coded parameter in the MVAPI call.