05-10-2006, 07:00 PM
Function DEX_Main (this version loads icons)
;Sample dialog with toolbar, tree view, list view and status bar controls, with images.
;Run this function.
;For images, here is used de_ctrl.bmp, the same that is used by the Dialog Editor.
;Change de_ctrl.bmp (below) to the name of your bitmap file. The file must contain
;;any number of 16x16 images arranged horizontally. Use magenta color (0xff00ff)
;;for transparent areas.
;Tested with QM 2.1.5, 6, 7, 8.
#if (QMVER<0x02010700)
#compile "DEX_CC_API"
#endif
type DEX_DATA il1 il2 il3 ;;you can add more members to store various data
DEX_DATA d ;;to access this variable from dialog procedure, use DEX_DATA& d; &d=+DT_GetParam(hDlg)
;add bitmap containing all icons
;d.il1=ImageList_LoadImage(0 _s.expandpath("$qm$\de_ctrl.bmp") 16 0 0xFF00FF IMAGE_BITMAP LR_LOADFROMFILE)
;or load multiple files (slower)
d.il1=ImageList_Create(16 16 WINAPI.ILC_MASK|WINAPI.ILC_COLOR32 0 15)
rep(15) ImageList_ReplaceIcon(d.il1 -1 GetIcon("mouse.ico"))
d.il2=d.il1; d.il3=d.il1 ;;in real world, you can use ImageList_LoadImage/ImageList_Destroy to use different bitmaps for each control
if(!ShowDialog("DEX_Dialog" &DEX_Dialog 0 0 0 0 0 &d)) ret
ImageList_Destroy(d.il1);; ImageList_Destroy(d.il2); ImageList_Destroy(d.il3)
