home *** CD-ROM | disk | FTP | other *** search
/ Programming Tool Box / SIMS_2.iso / vb_code1 / iniacces / ini.h < prev    next >
Text File  |  1993-08-17  |  4KB  |  148 lines

  1. //---------------------------------------------------------------------------
  2. // ini.h
  3. //---------------------------------------------------------------------------
  4. // Written 8/93, Walter F. Dexter.
  5. // Based to a large extend on Microsoft's Generic Control sample.
  6. //---------------------------------------------------------------------------
  7.  
  8. //---------------------------------------------------------------------------
  9. // Resource Information
  10. //---------------------------------------------------------------------------
  11. // Toolbox bitmap resource IDs numbers.
  12. //---------------------------------------------------------------------------
  13. #define IDBMP_INI_UP    8000
  14. #define IDBMP_INI_DOWN  8001
  15. #define IDBMP_INI_MONO  8003
  16. #define IDBMP_INI_EGA   8006
  17.  
  18. //---------------------------------------------------------------------------
  19. // Change these for each new VBX file
  20. //---------------------------------------------------------------------------
  21. #define VBX_COMPANYNAME        "Walter F. Dexter\0"
  22. #define VBX_FILEDESCRIPTION       "Visual Basic INI File VBX\0"
  23. #define VBX_INTERNALNAME       "INI\0"
  24. #define VBX_LEGALCOPYRIGHT       "Copyright \251 Walter F. Dexter 1993\0"
  25. #define VBX_LEGALTRADEMARKS       "Microsoft\256 is a registered trademark of Microsoft Corporation. Visual Basic\231 is a trademark of Microsoft Corporation. Windows\231 is a trademark of Microsoft Corporation.\0"
  26. #define VBX_ORIGINALFILENAME       "INI.VBX\0"
  27. #define VBX_PRODUCTNAME        "Microsoft\256 Visual Basic\231 for Windows\231\0"
  28.  
  29.  
  30. //---------------------------------------------------------------------------
  31. // Update these fields for each build.
  32. //---------------------------------------------------------------------------
  33. #define VBX_VERSION            1,00,0,00
  34. #define VBX_VERSION_STR        "1.00.000\0"
  35.  
  36. #define OFFSETIN(struc, field)    ((USHORT)&( ((struc *)0)->field ))
  37.  
  38. typedef struct tagINI {
  39.        HSZ    hszText;
  40.        HSZ    hszFilename;
  41.        HSZ    hszSection;
  42.        HSZ    hszEntry;
  43.        HSZ    hszDefault;
  44.       ENUM  enAction;
  45. } INI, FAR *PINI;
  46.  
  47. LONG FAR PASCAL _export IniCtlProc(HCTL, HWND, USHORT, USHORT, LONG);
  48.  
  49. PROPINFO Property_Entry =
  50. {
  51.     "Entry",
  52.     DT_HSZ | PF_fGetData | PF_fSetData | PF_fSaveData,
  53.     OFFSETIN(INI, hszEntry),
  54.     0, 0, NULL, 0
  55. };
  56. PROPINFO Property_FileName =
  57. {
  58.     "FileName",
  59.     DT_HSZ | PF_fGetData | PF_fSetData | PF_fSaveData,
  60.     OFFSETIN(INI, hszFilename),
  61.     0, 0, NULL, 0
  62. };
  63.  
  64. PROPINFO Property_Section =
  65. {
  66.     "Section",
  67.     DT_HSZ | PF_fGetData | PF_fSetData | PF_fSaveData,
  68.     OFFSETIN(INI, hszSection),
  69.     0, 0, NULL, 0
  70. };
  71.  
  72. PROPINFO Property_Default =
  73. {
  74.     "Default",
  75.     DT_HSZ | PF_fGetData | PF_fSetData | PF_fSaveData,
  76.     OFFSETIN(INI, hszDefault),
  77.     0, 0, NULL, 0
  78. };
  79.  
  80. CHAR szActions[] =     "0 - No Action\0"
  81.                     "1 - Write\0"
  82.                     "2 - Read\0"
  83.                     "3 - Delete Entry\0"
  84.                     "4 - Delete Section\0";
  85.  
  86. #define ACTION_NONE 0
  87. #define ACTION_WRITE 1
  88. #define ACTION_READ 2
  89. #define ACTION_DEL_ENTRY 3
  90. #define ACTION_DEL_SECTION 4
  91.                     
  92. PROPINFO Property_Action =
  93. {
  94.     "Action",
  95.     DT_ENUM | PF_fGetData | PF_fSetMsg | PF_fNoShow,
  96.     OFFSETIN(INI, enAction),
  97.     0, 0, szActions, 4
  98. };
  99.  
  100. enum IniProperties    {
  101.                     IPROP_INI_CTLNAME,
  102.                     IPROP_INI_INDEX,
  103.                     IPROP_INI_LEFT,
  104.                     IPROP_INI_TOP,
  105.                     IPROP_INI_TEXT,
  106.                     IPROP_INI_ENTRY,
  107.                     IPROP_INI_FILENAME,
  108.                     IPROP_INI_SECTION,
  109.                     IPROP_INI_DEFAULT,
  110.                     IPROP_INI_ACTION
  111.                     };
  112.  
  113.  
  114. PPROPINFO Ini_Properties[] =
  115. {
  116.     PPROPINFO_STD_CTLNAME,
  117.     PPROPINFO_STD_INDEX,
  118.     PPROPINFO_STD_LEFTNORUN,
  119.     PPROPINFO_STD_TOPNORUN,
  120.     PPROPINFO_STD_TEXT,
  121.     &Property_Entry,
  122.     &Property_FileName,
  123.     &Property_Section,
  124.     &Property_Default,
  125.     &Property_Action,
  126.     NULL
  127. };
  128.  
  129. MODEL modelIni =
  130. {
  131.     VB_VERSION,                 // VB version being used
  132.     MODEL_fInvisAtRun,            // MODEL flags
  133.     (PCTLPROC)IniCtlProc,        // Control procedures
  134.     CS_VREDRAW | CS_HREDRAW,    // Class style
  135.     WS_CHILD | WS_BORDER,        // Default Windows style
  136.     sizeof(INI),                // Size of PIX structure
  137.     IDBMP_INI_UP,               // Palette bitmap ID
  138.     "IniFile",                    // Default control name
  139.     "IniFile",                    // Visual Basic class name
  140.     NULL,                        // Parent class name
  141.     Ini_Properties,                // Property information table
  142.     NULL,                        // Event information table
  143.     NULL,                        // Default Property- Property Box
  144.     NULL,                        // Default Event- Code Window
  145.     IPROP_INI_TEXT                // Default Property- Runtime
  146.     
  147. };
  148.