home *** CD-ROM | disk | FTP | other *** search
/ Chip Hitware 6 A / CHIP_HITWARE6_A.iso / tools / OSetup / SETUP.EXE / OSCUSTOM.CPP next >
C/C++ Source or Header  |  1996-02-27  |  1KB  |  53 lines

  1. // OSCustom.cpp  Copyright (c) 1996 Celtech Software
  2. //
  3. // Registered users may use this code to create custom DLLs that work with
  4. // O'Setup during the installation process.
  5. //
  6. // This example project was created using Visual C++ 4.00
  7.  
  8. #include <windows.h>
  9.  
  10. HWND hParentWindow;
  11.  
  12. int FAR PASCAL ExampleDLLFunc(HWND hParent, LPCSTR lpParam)
  13. {
  14.   //save the setup main window handle
  15.   hParentWindow = hParent;
  16.   
  17.   //build a string for message box
  18.   char* pMsg = new char[256];
  19.   strcpy(pMsg, "Parameter=");
  20.   strcat(pMsg, lpParam);
  21.  
  22.   //show string
  23.   MessageBox(hParentWindow, pMsg, "DLL Function", MB_OK);
  24.   
  25.   //create buffer for return values to O'Setup
  26.   //return values are accessed with the %R variable
  27.   HGLOBAL hClip = GlobalAlloc(GMEM_FIXED, 1024);
  28.   if(hClip)
  29.   {
  30.     //get pointer to buffer
  31.     char far* pClip = (char far*)GlobalLock(hClip);
  32.     if(pClip)
  33.     {
  34.       //build series of values in the format:
  35.       //    key=value
  36.       //    key=value
  37.       //    key=value
  38.       //key/value pairs are separated by return characters
  39.       strcpy(pClip, "Value1=This is value 1\rValue2=This is value 2");
  40.       GlobalUnlock(hClip);
  41.       
  42.       //set values to unique clipboard format
  43.       if(OpenClipboard(hParentWindow))
  44.       {
  45.         SetClipboardData(RegisterClipboardFormat("OSETUP_RETURN_VALUES"), hClip);
  46.         CloseClipboard();
  47.       }
  48.     }
  49.   }
  50.  
  51.   return 1;
  52. }
  53.