home *** CD-ROM | disk | FTP | other *** search
/ Windows 95 Secrets (4th Edition) / Windows95Secrets4thEdition.iso / tools / installr / freeman / dllldr.h_ / dllldr
Encoding:
Text File  |  1995-06-14  |  470 b   |  40 lines

  1. #define __DLLLDR_H
  2.  
  3. class dllldr
  4. {
  5.    public:
  6.  
  7.    HINSTANCE h;
  8.  
  9.    dllldr()
  10.    {
  11.       h = 0;
  12.    }
  13.   ~dllldr()
  14.    {
  15.       free();
  16.    }
  17.    int init(char file[])
  18.    {
  19.       if ((h = LoadLibrary(file)) < HINSTANCE_ERROR)
  20.       {
  21.          h = 0;
  22.       }
  23.       return h != 0;
  24.    }
  25.    void free()
  26.    {
  27.       if (h != 0)
  28.       {
  29.          FreeLibrary(h);
  30.  
  31.          h = 0;
  32.       }
  33.    }
  34.    operator HINSTANCE()
  35.    {
  36.       return h;
  37.    }
  38. };
  39.  
  40.