Attribute VB_Description = "Creates and uses a bitmap effiently and also provides access to some graphical api functions and procedures and some higher-level graphical sub-routines"
bytBlendOp As Byte 'currently the only blend op supported by windows 98+ is AC_SRC_OVER
bytBlendFlags As Byte 'must be left blank
bytSourceConstantAlpha As Byte 'the amount to blend by. Must be between 0 and 255
bytAlphaFormat As Byte 'don't set this. If you wish more infor, go to "http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/bitmaps_3b3m.asp"
End Type
'Bitmap structue for menu information
Private Type MENUITEMINFO
cbSize As Long
fMask As Long
fType As Long
fState As Long
wID As Long
hSubMenu As Long
hbmpChecked As Long
hbmpUnchecked As Long
dwItemData As Long
dwTypeData As String
cch As Long
End Type
'size structure
Private Type SizeType
cx As Long
cy As Long
End Type
'Text metrics
Private Type TEXTMETRIC
tmHeight As Long
tmAscent As Long
tmDescent As Long
tmInternalLeading As Long
tmExternalLeading As Long
tmAveCharWidth As Long
tmMaxCharWidth As Long
tmWeight As Long
tmOverhang As Long
tmDigitizedAspectX As Long
tmDigitizedAspectY As Long
tmFirstChar As Byte
tmLastChar As Byte
tmDefaultChar As Byte
tmBreakChar As Byte
tmItalic As Byte
tmUnderlined As Byte
tmStruckOut As Byte
tmPitchAndFamily As Byte
tmCharSet As Byte
End Type
Private Type COLORADJUSTMENT
caSize As Integer
caFlags As Integer
caIlluminantIndex As Integer
caRedGamma As Integer
caGreenGamma As Integer
caBlueGamma As Integer
caReferenceBlack As Integer
caReferenceWhite As Integer
caContrast As Integer
caBrightness As Integer
caColorfulness As Integer
caRedGreenTint As Integer
End Type
Private Type CIEXYZ
ciexyzX As Long
ciexyzY As Long
ciexyzZ As Long
End Type
Private Type CIEXYZTRIPLE
ciexyzRed As CIEXYZ
ciexyzGreen As CIEXYZ
ciexyBlue As CIEXYZ
End Type
Private Type LogColorSpace
lcsSignature As Long
lcsVersion As Long
lcsSize As Long
lcsCSType As Long
lcsIntent As Long
lcsEndPoints As CIEXYZTRIPLE
lcsGammaRed As Long
lcsGammaGreen As Long
lcsGammaBlue As Long
lcsFileName As String * 26 'MAX_PATH
End Type
'display settings (800x600 etc)
Private Type DEVMODE
dmDeviceName As String * 32
dmSpecVersion As Integer
dmDriverVersion As Integer
dmSize As Integer
dmDriverExtra As Integer
dmFields As Long
dmOrientation As Integer
dmPaperSize As Integer
dmPaperLength As Integer
dmPaperWidth As Integer
dmScale As Integer
dmCopies As Integer
dmDefaultSource As Integer
dmPrintQuality As Integer
dmColor As Integer
dmDuplex As Integer
dmYResolution As Integer
dmTTOption As Integer
dmCollate As Integer
dmFormName As String * 32
dmUnusedPadding As Integer
dmBitsPerPel As Long
dmPelsWidth As Long
dmPelsHeight As Long
dmDisplayFlags As Long
dmDisplayFrequency As Long
End Type
Private Type Rect
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Type BitmapStruc
lngDc As Long
lngBitmap As Long
lngPointer As Long
Area As Rect
End Type
Private Type PointAPI
X As Long
Y As Long
End Type
Private Type LogPen
lopnStyle As Long
lopnWidth As PointAPI
lopnColor As Long
End Type
Private Type LogBrush
lbStyle As Long
lbColor As Long
lbHatch As Long
End Type
Private Type FontStruc
Name As String
Alignment As AlignText
Bold As Boolean
Italic As Boolean
Underline As Boolean
StrikeThru As Boolean
PointSize As Byte
Colour As Long
End Type
Private Type LogFont
'for the DrawText api call
lfHeight As Long
lfWidth As Long
lfEscapement As Long
lfOrientation As Long
lfWeight As Long
lfItalic As Byte
lfUnderline As Byte
lfStrikeOut As Byte
lfCharSet As Byte
lfOutPrecision As Byte
lfClipPrecision As Byte
lfQuality As Byte
lfPitchAndFamily As Byte
lfFaceName(1 To 32) As Byte
End Type
Private Type Point
'you'll need this to reference a point on the
'screen'
X As Integer
Y As Integer
End Type
'To hold the RGB value
Private Type RGBVal
Red As Integer
Green As Integer
Blue As Integer
End Type
'bitmap structure for the GetObject api call
Private Type BITMAP '24 bytes
bmType As Long
bmWidth As Long
bmHeight As Long
bmWidthBytes As Long
bmPlanes As Integer
bmBitsPixel As Integer
bmBits As Long
End Type
'holds version information about the operating system
Private Type OSVERSIONINFO
dwOSVersionInfoSize As Long
dwMajorVersion As Long
dwMinorVersion As Long
dwBuildNumber As Long
dwPlatformId As Long
szCSDVersion As String * 128
End Type
'holds palette information
Private Type PALETTEENTRY
peRed As Byte
peGreen As Byte
peBlue As Byte
peFlags As Byte
End Type
'holds entented palette information
Private Type LOGPALETTE
palVersion As Integer
palNumEntries As Integer
palPalEntry(255) As PALETTEENTRY ' Enough for 256 colors
End Type
'holds descriptor information for a GUI
Private Type GUID
Data1 As Long
Data2 As Integer
Data3 As Integer
Data4(7) As Byte
End Type
'holds picture information - used for a Picture property
Private Const LR_CREATEDIBSECTION As Long = &H2000
Private Const LR_DEFAULTSIZE As Long = &H40
'PatBlt constants
Private Const PATCOPY As Long = &HF00021 ' (DWORD) dest = pattern
Private Const PATINVERT As Long = &H5A0049 ' (DWORD) dest = pattern XOR dest
Private Const PATPAINT As Long = &HFB0A09 ' (DWORD) dest = DPSnoo
Private Const DSTINVERT As Long = &H550009 ' (DWORD) dest = (NOT dest)
Private Const BLACKNESS As Long = &H42 ' (DWORD) dest = BLACK
Private Const WHITENESS As Long = &HFF0062 ' (DWORD) dest = WHITE
'Display constants
Private Const CDS_FULLSCREEN As Integer = 4
Private Const DM_BITSPERPEL As Long = &H40000
Private Const DM_PELSWIDTH As Long = &H80000
Private Const DM_PELSHEIGHT As Long = &H100000
Private Const DM_DISPLAYFLAGS As Long = &H200000
Private Const DM_DISPLAYFREQUENCY As Long = &H400000
'DrawText constants
Private Const DT_CENTER As Long = &H1
Private Const DT_BOTTOM As Long = &H8
Private Const DT_CALCRECT As Long = &H400
Private Const DT_EXPANDTABS As Long = &H40
Private Const DT_EXTERNALLEADING As Long = &H200
Private Const DT_LEFT As Long = &H0
Private Const DT_NOCLIP As Long = &H100
Private Const DT_NOPREFIX As Long = &H800
Private Const DT_RIGHT As Long = &H2
Private Const DT_SINGLELINE As Long = &H20
Private Const DT_TABSTOP As Long = &H80
Private Const DT_TOP As Long = &H0
Private Const DT_VCENTER As Long = &H4
Private Const DT_WORDBREAK As Long = &H10
Private Const TRANSPARENT As Integer = 1
Private Const OPAQUE As Integer = 2
'CreateBrushIndirect constants
Private Const BS_DIBPATTERN As Integer = 5
Private Const BS_DIBPATTERN8X8 As Integer = 8
Private Const BS_DIBPATTERNPT As Integer = 6
Private Const BS_HATCHED As Integer = 2
Private Const BS_HOLLOW As Integer = 1
Private Const BS_NULL As Integer = 1
Private Const BS_PATTERN As Integer = 3
Private Const BS_PATTERN8X8 As Integer = 7
Private Const BS_SOLID As Integer = 0
Private Const HS_BDIAGONAL As Integer = 3 ' /////
Private Const HS_CROSS As Integer = 4 ' +++++
Private Const HS_DIAGCROSS As Integer = 5 ' xxxxx
Private Const HS_FDIAGONAL As Integer = 2 ' \\\\\
Private Const HS_HORIZONTAL As Integer = 0 ' -----
Private Const HS_NOSHADE As Integer = 17
Private Const HS_SOLID As Integer = 8
Private Const HS_SOLIDBKCLR As Integer = 23
Private Const HS_SOLIDCLR As Integer = 19
Private Const HS_VERTICAL As Integer = 1 ' |||||
'LogFont constants
Private Const LF_FACESIZE As Integer = 32
Private Const FW_BOLD As Integer = 700
Private Const FW_DONTCARE As Integer = 0
Private Const FW_EXTRABOLD As Integer = 800
Private Const FW_EXTRALIGHT As Integer = 200
Private Const FW_HEAVY As Integer = 900
Private Const FW_LIGHT As Integer = 300
Private Const FW_MEDIUM As Integer = 500
Private Const FW_NORMAL As Integer = 400
Private Const FW_SEMIBOLD As Integer = 600
Private Const FW_THIN As Integer = 100
Private Const DEFAULT_CHARSET As Integer = 1
Private Const OUT_CHARACTER_PRECIS As Integer = 2
Private Const OUT_DEFAULT_PRECIS As Integer = 0
Private Const OUT_DEVICE_PRECIS As Integer = 5
Private Const OUT_OUTLINE_PRECIS As Integer = 8
Private Const OUT_RASTER_PRECIS As Integer = 6
Private Const OUT_STRING_PRECIS As Integer = 1
Private Const OUT_STROKE_PRECIS As Integer = 3
Private Const OUT_TT_ONLY_PRECIS As Integer = 7
Private Const OUT_TT_PRECIS As Integer = 4
Private Const CLIP_CHARACTER_PRECIS As Integer = 1
Private Const CLIP_DEFAULT_PRECIS As Integer = 0
Private Const CLIP_EMBEDDED As Integer = 128
Private Const CLIP_LH_ANGLES As Integer = 16
Private Const CLIP_MASK As Long = &HF
Private Const CLIP_STROKE_PRECIS As Integer = 2
Private Const CLIP_TT_ALWAYS As Integer = 32
Private Const WM_SETFONT As Long = &H30
Private Const LF_FULLFACESIZE As Integer = 64
Private Const DEFAULT_PITCH As Integer = 0
Private Const DEFAULT_QUALITY As Integer = 0
Private Const PROOF_QUALITY As Integer = 2
'GetDeviceCaps constants
Private Const LOGPIXELSY As Integer = 90 ' Logical pixels/inch in Y
Private Const LOGPIXELSX As Integer = 88 ' Logical pixels/inch in X
'colourspace constants
Private Const MAX_PATH As Integer = 260
'pen constants
Private Const PS_COSMETIC As Long = &H0
Private Const PS_DASH As Integer = 1 ' -------
Private Const PS_DASHDOT As Integer = 3 ' _._._._
Private Const PS_DASHDOTDOT As Integer = 4 ' _.._.._
Private Const PS_DOT As Integer = 2 ' .......
Private Const PS_ENDCAP_ROUND As Long = &H0
Private Const PS_ENDCAP_SQUARE As Long = &H100
Private Const PS_ENDCAP_FLAT As Long = &H200
Private Const PS_GEOMETRIC As Long = &H10000
Private Const PS_INSIDEFRAME As Long = 6
Private Const PS_JOIN_BEVEL As Long = &H1000
Private Const PS_JOIN_MITER As Long = &H2000
Private Const PS_JOIN_ROUND As Long = &H0
Private Const PS_SOLID As Long = 0
'mouse cursor constants
Private Const IDC_APPSTARTING As Long = 32650&
Private Const IDC_ARROW As Long = 32512&
Private Const IDC_CROSS As Long = 32515&
Private Const IDC_IBEAM As Long = 32513&
Private Const IDC_ICON As Long = 32641&
Private Const IDC_NO As Long = 32648&
Private Const IDC_SIZE As Long = 32640&
Private Const IDC_SIZEALL As Long = 32646&
Private Const IDC_SIZENESW As Long = 32643&
Private Const IDC_SIZENS As Long = 32645&
Private Const IDC_SIZENWSE As Long = 32642&
Private Const IDC_SIZEWE As Long = 32644&
Private Const IDC_UPARROW As Long = 32516&
Private Const IDC_WAIT As Long = 32514&
'menu constants
Private Const MFT_RADIOCHECK As Long = &H200&
Private Const MF_BITMAP As Long = &H4&
Private Const MIIM_TYPE As Long = &H10
Private Const MIIM_SUBMENU As Long = &H4
'some key values for GetASyncKeyState
Private Const KLeft As Integer = 37
Private Const KUp As Integer = 38
Private Const KRight As Integer = 39
Private Const KDown As Integer = 40
Private Const K_KEY_DOWN As Integer = -32767
Private Const K_PRESSED As Integer = -32768
'extra system colour constants to be extended from
'the vb collection SystemColorConstants (Win98+)
Private Const vbActiveTitleBar2 As Double = 2147483675#
Private Const vbInactiveTitleBar2 As Double = 2147483676#
'some mathimatical constants
Private Const PI As Single = 3.14159265358979
Private Const PIdiv180 As Single = 1.74532925199433E-02 'used to speed calculations when converting from/to degrees/radians for the functions Sin/Cos/Tan etc.
'some class constants
Private Const LDETRIC l STRE6r0
Private Const K_KEY_antWto degrees/radeTREU # As Long = 32used to speed cdR_KE ApHARS t/radeTREU # A3ed Xm
'The key valOEU # A A3elLOonst ILLUMINANT_C LDET0m
'The key valOEU Name nst ILLUMINANT_C LOP1994ivatg = 32640&
Private Const IDAs Long = &H2000
PrivatTtantsR640&
Private Cons3675#
Private D
Private Const K_KEY_antsR640&rom
'the vb colleivate e0&rom
'the vb colleivate
'sysvb colleivate
'sysvRrrXUA'themry0&H0 colleitvatey= 32648&
'sysvRrrXUA srlORY colleitvatey= 3264DP As Single = 3.1415926 nst ILLU:h in X= 3.1415926 pCE= &I6 As Longfrom/to de75#
Private D
PrivRY ls Single = 3.1415926 tWidtaU ls Sls SinTen converting from/e5926MSls SantWto aU ls Sls SinTen conerce ANriveTitleBar2 As e5926MSls SantWto aU As L( A3A Ass SileBar22RatieAs Integer = 3
'colDs L( A3A 'ND PatCB in X=y= 3264DP
ger = 0
Private Const HS_BDI_JOIN_MITER AsN( A3A e CopnOIN_3fT As Long da M'moa.inTen conerce ANririvatee3 oLitvatD
Private Const K_KEYatCB in er = 0don = 2 vathcOChst C atieAeDants
PrivnSN0
Privasyste vathcOC+r = 0dotCB Ce
'colDs L SLsplay a negative of the p ANriveTplay a neg PS_JOIN_ROUND (a negative of the pgA3ed Xm
'The key valOEU # A A3emN_RO2H = ive of the pgA3ed m
WnTen conerce0E n A A O3lOEU # A A3emN_RO2HarasyIAGONAL = &Te pgA3edntBlt _d4aMBOBOX IiIate Const IDC_SIZap neg Long = &H1000
Private Constb&
Private ConstSgative of the1000
Privat pgAHAYAme class constants0ong
ong da M'moa.iN00s Integer = 3
'colDs L( As LonrivatTtaE
'mouse cuN00y2147483676#
'
'The key valOEUg = &H200&_ nst -
ong da M'moa.iN00 As SinglectiGrWU_
YnTe00Ce
'colDs L SLsuT&'moa.T:h in X= 3.1415926 pCE0t
YnTe00CeiHlass constants
Private Const LDEL Integer = 4nTe00CeiB in X=T159D constants
Private 2bDPC'ld&Te N = 1
Private Con0r 'yht 1415926 a As Long vatTtn X= 3.14u a As Long_eU_
YKPIDAs Long =IOTtn X= 3.14u a W
'TheRrivnS i( X= 3.14u a teger = 2 'O0M ByVal fByPositioTtn Aseger = 2 6FUTe00te ConPrivnS i(Const SourByPositioT ng
ongPlas moa.sytantT
ongPlas moa USER DEFINED TYPES
'--- '3D highlight o p M2Sg =9formation
Priva4'--- '3D highlightCvathcOChst C P As highlight o LhlightCghtCvPk)t C P CT = colleeger = 4 ' +++++
Privact C _play picture _S ++++_ As Integer = 40G Asc thcOChst CFAAO Asp SCFAAOShAs Long5Private Const KRighP hd B ByVal nXOrg Asry a nee Const IDC_APPSTcgO A3ed Xm
'The jI/?fByVahP T
st IDC_APPStli 1P_ # A A3emN_RO2HarasyIAG'c A3ed Xm
'The jI/?fByVahP T
st IDC_APPStli 1P_ # A A3em jI AsN( A3A e CopnOIN_3fT As Long da M'moa.inTen conerce ANririvatee3 PDCROn cM AsSIONRefer A
'-------S
ls Sls SinTePROC PI te ConT ng
ongPlas moa.sytantT
By= 32648&
'sysvRrroconSEng
_
By As moa.sytantT3264mN_RO2N8 As Long = &H3
Private bmHeight CSo A
'------- = 2 'O0M 3sN( A3A e CopnOINFThe e3sN( A3A ere Sls SiEDong
st IDC_(R from/tI DFCS_MENUBULLET =TNlfl= 2 Aonst PIdiv18ght EFonst PIdiv18ght uI from/tI Aons p M2Sg =9formation
PsNl. da M'moa.inTen coMe Const PATPAINpSCFAAOShAs Long5PSfore CopnOIN_3fT -bNehdOP DFCng, _
uI from/tI15926 tWidtaU lspgA3edntBlt _from/tI15926 tWidtaU K_KEYS N_------ As Intef3sN VahP eE/tI15926 tmeOegreesBN_RiHSl- = IN OUT CSo nd Ty IN OUT As Integer = 38
PrivamN_RO2Haras NFTInteg As #-S
ls 'ceUign = 1
vbCN00 As Singlecti As #-S
ls 'ceUign = HPrivate Const FW_THIN DC_APPSTIA As st FW_THIN I4mN_RPrivate DecaIC_APPSTfl= 2INrsor _
Lib F6STIA As st FW_THIN dmCqUign = HPrivate Const FW_THIN As Integer
dmBits As cIHIN As NCuse #-S
ls 'ceUign vbCN00 As cIHINf)IEtS of the pgA3ed Xm
MW0
Pon
PsIEe'pyies/resiz As s0on
PsIEe'pyies/resiz As s0on
PsAs sivate DeceSTIA As st FW_THRROC PIdntBlt _d4aMBOBOX IiIate ConsMWC0 _dF_BITntBlt _d4aMBOBOXTga3MBOBOX Eeger = IN OUT nstSIDC_SBOB nstSIDC_SBOB nstSIDC_SBOB nstr = K ALWILLUMa3MBOBOX As cIHIN AsSWLt -
ong da M'moa.iN00ai 3sN( A3A e Coe
ongPlas moa.sytantPoa.igTW As cIHIN As NCueg da M _N Ashs # Ad Co M _N tegeB nstSIDC_SBOB nstr = K te C _N -------------- lRst -
ong da from/tI1592PrivaN -------------- O------ lRst iva--------- O----aN eReaN eRXT Long
fMask EO----aN eRea cd.sytantPoa.ig Long
fMask cd.syst iva---IN AW BF_BOTTnyst BOBst iva---IbA
Private Con2yst BOBAeT AW BF_BOTTnt As Integer
bmBits T Con2yst BOBLWILLC
Pr2Type
S
PsIEe'pyies/resiz BF_BOTTnt As IntegerLHN AW BF_cd.son