home *** CD-ROM | disk | FTP | other *** search
- //-------------------------------------------------------
- // MYCLOCK.H
- //-------------------------------------------------------
- // Contains code for Myclock VBX control.
- //
- // Use the following files as templates for building your
- // own VBX control:
- //
- // - MYCLOCK.C
- // - MYCLOCK.H (this file)
- // - MYCLOCK.DEF
- // - MYCLOCK.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 "Myclock Control\0"
- #define VBX_INTERNALNAME "MYCLOCK\0"
- #define VBX_LEGALCOPYRIGHT "Copyright Company Name\0"
- #define VBX_LEGALTRADEMARKS "Trademarks\0"
- #define VBX_ORIGINALFILENAME "MYCLOCK.VBX\0"
- #define VBX_PRODUCTNAME "Myclock 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 MyclockCtlProc(HCTL, HWND, USHORT,
- USHORT, LONG);
-
-
- //------------------------------------------------------
- // The structure of the control.
- //------------------------------------------------------
- typedef struct tagMYCLOCK
- {
- BOOL dummy;
-
- // TODO: Define variables that correspond to the
- // custom properties
- //
- // Example:
- // BOOL MyProperty;
- // LONG HerProperty;
-
- //////////////////////
- // MY CODE STARTS HERE
- //////////////////////
-
- // The UpdateInterval custom property.
- SHORT UpdateInterval;
-
- ////////////////////
- // MY CODE ENDS HERE
- ////////////////////
-
-
- } MYCLOCK;
-
-
- typedef MYCLOCK FAR * LPMYCLOCK;
-
- // A macro to get a pointer to the structure.
- #define pMYCLOCK(hctl) ((LPMYCLOCK)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
- //
- // Examples:
- //
- //PROPINFO Property_MyProperty =
- // {
- // "MyProperty",
- // DT_SHORT | PF_fGetData | PF_fSetMsg | PF_fSaveData,
- // OFFSETIN(MYCLOCK, MyProperty),
- // 0, 0, NULL, 0
- // };
-
-
- //////////////////////
- // MY CODE STARTS HERE
- //////////////////////
-
- PROPINFO Property_UpdateInterval =
- {
- "UpdateInterval",
- DT_SHORT | PF_fGetData | PF_fSetMsg | PF_fSaveData,
- OFFSETIN(MYCLOCK, UpdateInterval),
- 0, 0, NULL, 0
- };
-
- ////////////////////
- // MY CODE ENDS HERE
- ////////////////////
-
-
-
-
- //-------------------------------------------------------
- // Property Information Table
- //-------------------------------------------------------
- PPROPINFO Myclock_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
-
- //////////////////////
- // MY CODE STARTS HERE
- //////////////////////
-
- PPROPINFO_STD_FORECOLOR,
-
- &Property_UpdateInterval,
-
- ////////////////////
- // MY CODE ENDS HERE
- ////////////////////
-
-
- NULL
- };
-
-
- //-------------------------------------------------------
- // Property List Constants
- //-------------------------------------------------------
- #define IPROP_MYCLOCK_CTLNAME 0
- #define IPROP_MYCLOCK_INDEX 1
- #define IPROP_MYCLOCK_BACKCOLOR 2
- #define IPROP_MYCLOCK_LEFT 3
- #define IPROP_MYCLOCK_TOP 4
- #define IPROP_MYCLOCK_WIDTH 5
- #define IPROP_MYCLOCK_HEIGHT 6
- #define IPROP_MYCLOCK_VISIBLE 7
- #define IPROP_MYCLOCK_PARENT 8
- #define IPROP_MYCLOCK_DRAGMODE 9
- #define IPROP_MYCLOCK_DRAGICON 10
- #define IPROP_MYCLOCK_TAG 11
- #define IPROP_MYCLOCK_HWND 12
-
- // TODO: Define consecutive ID's of more properties
- //
- // Example:
- // #define IPROP_MYCLOCK_MYPROPERTY 13
- // #define IPROP_MYCLOCK_HERPROPERTY 14
- // #define IPROP_MYCLOCK_CAPTION 15
-
- //////////////////////
- // MY CODE STARTS HERE
- //////////////////////
-
- #define IPROP_MYCLOCK_FORECOLOR 13
-
- #define IPROP_MYCLOCK_UPDATEINTERVAL 14
-
- ////////////////////
- // MY CODE ENDS HERE
- ////////////////////
-
-
-
- //------------------------------------------------------
- // Event Information Structures
- //------------------------------------------------------
- //
- // TODO: Define EVENTINFO structure for each custom event
- //
- // Example:
- //
- // EVENTINFO Event_MyEvent =
- // {
- // "MyEvent",
- // 0,
- // 0,
- // NULL,
- // NULL
- // };
-
- //////////////////////
- // MY CODE STARTS HERE
- //////////////////////
-
- EVENTINFO Event_NewMinute =
- {
- "NewMinute",
- 0,
- 0,
- NULL,
- NULL
- };
-
- ////////////////////
- // MY CODE ENDS HERE
- ////////////////////
-
-
-
- //-------------------------------------------------------
- // Event Information Table
- //-------------------------------------------------------
- PEVENTINFO Myclock_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
-
- //////////////////////
- // MY CODE STARTS HERE
- //////////////////////
-
- PEVENTINFO_STD_DBLCLICK,
-
- &Event_NewMinute,
-
- ////////////////////
- // MY CODE ENDS HERE
- ////////////////////
-
- NULL
- };
-
-
-
- //-------------------------------------------------------
- // Event List Constants
- //-------------------------------------------------------
- #define IEVENT_MYCLOCK_CLICK 0
- #define IEVENT_MYCLOCK_DRAGDROP 1
- #define IEVENT_MYCLOCK_DRAGOVER 2
-
- // TODO: Define consecutive ID's of more events
- //
- // Example:
- // #define IEVENT_MYCLOCK_MYEVENT 3
- // #define IEVENT_MYCLOCK_HEREVENT 4
- // #define IEVENT_MYCLOCK_DBLCLICK 5
-
- //////////////////////
- // MY CODE STARTS HERE
- //////////////////////
-
- #define IEVENT_MYCLOCK_DBLCLICK 3
-
- #define IEVENT_MYCLOCK_NEWMINUTE 4
-
- ////////////////////
- // MY CODE ENDS HERE
- ////////////////////
-
-
-
- //------------------------------------------------------
- // Model struct
- //------------------------------------------------------
- // Define the control model (using the event and property
- // structures).
- //------------------------------------------------------
- MODEL modelMyclock =
- {
- VB_VERSION, // VB version being used
- 0, // MODEL flags
- (PCTLPROC)MyclockCtlProc, // Control procedure
- CS_VREDRAW | CS_HREDRAW, // Class style
- WS_BORDER, // Default Windows style
- sizeof(MYCLOCK), // Size of structure
- IDBMP_UP, // Palette bitmap ID
- "Myclock", // Default control name
- "MYCLOCK", // Visual Basic class name
- NULL, // Parent class name
- Myclock_Properties, // Property information table
- Myclock_Events, // Event information table
- IPROP_MYCLOCK_BACKCOLOR, // Default property
- IEVENT_MYCLOCK_CLICK, // Default event
- (BYTE)-1 // Value of control
- };
-
- #endif // RC_INVOKED
-
- //------------------------------------------------------
-