User's Guide

Preparing a resource DLL for Windows

Windows icon
This section applies only to VisualAge for Windows.

To prepare icons for use with VisualAge for Windows, do the following:

  1. Create a C source file as follows:
    /* empty.c */
    #include <windows.h>
    static char appName [] = "userpal";
    int FAR PASCAL LibMain (HANDLE hInstance,
                            WORD wDataSeg,
                            WORD wHeapSize,
                            LPSTR lpszCmdLine)
         {
         if (wHeapSize > 0)
              UnlockData (0) ;
         return 1 ;
         }
    
  2. Compile the empty source file to create an object file. If you are using the Microsoft C compiler, the following command will work:
    cl -c -AMw -Gsw -Ow -W2 -Zp empty.c
    
  3. Create a module definition file for the linker. The following example is named userpal.def:
    LIBRARY        userpal
    DESCRIPTION    'Icons for user-extended palette'
    EXETYPE        WINDOWS
    CODE           PRELOAD MOVEABLE DISCARDABLE
    DATA           PRELOAD MOVEABLE SINGLE
    
  4. Link the object file, using your module definition file, to create an empty DLL. Here is a command that links the files above, to create userpal.dll:
    link empty libentry,userpal.dll/align:16,NUL,/nod \
         mdllcew libw, userpal
    
  5. Create a resource script file. This file identifies the icons to be included in the DLL, and assigns an identifier to each icon. Here are the contents of an example resource file, named userpal.rc. Notice that the identifier and resource type are reversed from the OS/2 version of your resource script file.
    100 ICON athltcat.ico
    101 ICON runner.ico
    102 ICON world.ico
    
  6. Compile your resource script file and merge the compiled resources into your DLL with the following command:
    RC userpal.rc userpal.dll
    

Your icons are now ready for use with VisualAge.

The procedure for building a resource DLL using bitmaps is the same, except that you use lines in the .rc file that look like this:

801 BITMAP runner.bmp

You can include icons and bitmaps in the same DLL.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]