home *** CD-ROM | disk | FTP | other *** search
- //-------------------------------------------------------
- // GENERIC.H
- //-------------------------------------------------------
- // Contains code for Generic VBX control.
- //
- // Use the following files as templates for building your
- // own VBX control:
- //
- // - GENERIC.C
- // - GENERIC.H (this file)
- // - GENERIC.DEF
- // - GENERIC.RC
- //-------------------------------------------------------
-
- //------------------------------------------------------
- // Resource Information
- //------------------------------------------------------
- // Toolbox bitmap resource IDs numbers.
- //------------------------------------------------------
- #define IDBMP_UP 8000
- #define IDBMP_DOWN 8001
- #define IDBMP_UPMONO 8003
- #define IDBMP_UPEGA 8006
-
- //------------------------------------------------------
- // Change these for each new VBX file
- //------------------------------------------------------
- #define VBX_COMPANYNAME "Company Name\0"
- #define VBX_FILEDESCRIPTION "Generic Control\0"
- #define VBX_INTERNALNAME "GENERIC\0"
- #define VBX_LEGALCOPYRIGHT "Copyright Company Name\0"
- #define VBX_LEGALTRADEMARKS "Trademarks\0"
- #define VBX_ORIGINALFILENAME "GENERIC.VBX\0"
- #define VBX_PRODUCTNAME "Generic VBX Control\0"
-
-
- //------------------------------------------------------
- // Update these fields for each build.
- //------------------------------------------------------
- #define VBX_VERSION 3,00,0,00
- #define VBX_VERSION_STR "3.00.000\0"
-
-
- #ifndef RC_INVOKED
- //------------------------------------------------------
- // Control Procedure
- //------------------------------------------------------
- LONG FAR PASCAL _export GenericCtlProc(HCTL, HWND, USHORT,
- USHORT, LONG);
-
-
- //------------------------------------------------------
- // The structure of the control.
- //------------------------------------------------------
- typedef struct tagGENERIC
- {
- BOOL dummy;
-
- // TODO: Define variables that correspond to the
- // custom properties
- //
- // Example:
- // BOOL MyProperty;
- // LONG HerProperty;
-
-
-
- } GENERIC;
-
-
-
- typedef GENERIC FAR * LPGENERIC;
-
- // A macro to get a pointer to the structure.
- #define pGENERIC(hctl) ((LPGENERIC)VBDerefControl(hctl))
-
- // Macro to get offset of a field within a structure.
- #define OFFSETIN(struc, field) ((USHORT)&(((struc *)0)->field))
-
-
- //------------------------------------------------------
- // Property Information Structures
- //------------------------------------------------------
- //
- // TODO: Define PROPINFO structure for each custom property
- //
- // Example:
- //
- //PROPINFO Property_MyProperty =
- // {
- // "MyProperty",
- // DT_SHORT | PF_fGetData | PF_fSetMsg | PF_fSaveData,
- // OFFSETIN(GENERIC, MyProperty),
- // 0, 0, NULL, 0
- // };
-
-
-
- //-------------------------------------------------------
- // Property Information Table
- //-------------------------------------------------------
- PPROPINFO Generic_Properties[] =
- {
- PPROPINFO_STD_CTLNAME,
- PPROPINFO_STD_INDEX,
- PPROPINFO_STD_BACKCOLOR,
- PPROPINFO_STD_LEFT,
- PPROPINFO_STD_TOP,
- PPROPINFO_STD_WIDTH,
- PPROPINFO_STD_HEIGHT,
- PPROPINFO_STD_VISIBLE,
- PPROPINFO_STD_PARENT,
- PPROPINFO_STD_DRAGMODE,
- PPROPINFO_STD_DRAGICON,
- PPROPINFO_STD_TAG,
- PPROPINFO_STD_HWND,
-
- // TODO: Specify addresses of properties structures
- //
- // Example:
- // &Property_MyProperty, // Custom
- // &Property_HerProperty, // Custom
- // PPROPINFO_STD_CAPTION, // Standard
-
-
- NULL
- };
-
-
- //-------------------------------------------------------
- // Property List Constants
- //-------------------------------------------------------
- #define IPROP_GENERIC_CTLNAME 0
- #define IPROP_GENERIC_INDEX 1
- #define IPROP_GENERIC_BACKCOLOR 2
- #define IPROP_GENERIC_LEFT 3
- #define IPROP_GENERIC_TOP 4
- #define IPROP_GENERIC_WIDTH 5
- #define IPROP_GENERIC_HEIGHT 6
- #define IPROP_GENERIC_VISIBLE 7
- #define IPROP_GENERIC_PARENT 8
- #define IPROP_GENERIC_DRAGMODE 9
- #define IPROP_GENERIC_DRAGICON 10
- #define IPROP_GENERIC_TAG 11
- #define IPROP_GENERIC_HWND 12
-
- // TODO: Define consecutive ID's of more properties
- //
- // Example:
- // #define IPROP_GENERIC_MYPROPERTY 13
- // #define IPROP_GENERIC_HERPROPERTY 14
- // #define IPROP_GENERIC_CAPTION 15
-
-
- //------------------------------------------------------
- // Event Information Structures
- //------------------------------------------------------
- //
- // TODO: Define EVENTINFO structure for each custom event
- //
- // Example:
- //
- // EVENTINFO Event_MyEvent =
- // {
- // "MyEvent",
- // 0,
- // 0,
- // NULL,
- // NULL
- // };
-
-
-
- //-------------------------------------------------------
- // Event Information Table
- //-------------------------------------------------------
- PEVENTINFO Generic_Events[] =
- {
- PEVENTINFO_STD_CLICK,
- PEVENTINFO_STD_DRAGDROP,
- PEVENTINFO_STD_DRAGOVER,
-
- // TODO: Specify addresses of events structures
- //
- // Example:
- // &Event_MyEvent, // Custom
- // &Event_HerEvent, // Custom
- // PEVENTINFO_STD_DBLCLICK, // Standard
-
-
-
- NULL
- };
-
-
-
- //-------------------------------------------------------
- // Event List Constants
- //-------------------------------------------------------
- #define IEVENT_GENERIC_CLICK 0
- #define IEVENT_GENERIC_DRAGDROP 1
- #define IEVENT_GENERIC_DRAGOVER 2
-
- // TODO: Define consecutive ID's of more events
- //
- // Example:
- // #define IEVENT_GENERIC_MYEVENT 3
- // #define IEVENT_GENERIC_HEREVENT 4
- // #define IEVENT_GENERIC_DBLCLICK 5
-
-
-
-
-
- //------------------------------------------------------
- // Model struct
- //------------------------------------------------------
- // Define the control model (using the event and property
- // structures).
- //------------------------------------------------------
- MODEL modelGeneric =
- {
- VB_VERSION, // VB version being used
- 0, // MODEL flags
- (PCTLPROC)GenericCtlProc, // Control procedure
- CS_VREDRAW | CS_HREDRAW, // Class style
- WS_BORDER, // Default Windows style
- sizeof(GENERIC), // Size of structure
- IDBMP_UP, // Palette bitmap ID
- "Generic", // Default control name
- "GENERIC", // Visual Basic class name
- NULL, // Parent class name
- Generic_Properties, // Property information table
- Generic_Events, // Event information table
- IPROP_GENERIC_BACKCOLOR, // Default property
- IEVENT_GENERIC_CLICK, // Default event
- (BYTE)-1 // Value of control
- };
-
- #endif // RC_INVOKED
-
- //------------------------------------------------------
-