I've not seen any example in RapidQ that take advantages of Common Controls Ex library (comctl32.dll) so far. I've made this example previously in KoolB, HotBasic and now for RapidQ.
similar screenshot: http://techimage.net/images/calendarEx.jpg
$APPTYPE GUI
$DEFINE WS_VISIBLE 268435456
$DEFINE WS_CHILD 1073741824
$DEFINE VK_ESCAPE 27
$DEFINE ICC_DATE_CLASSES 256
TYPE QINITCOMMONCONTROLSEX
dwSize AS LONG
dwICC AS LONG
END TYPE
DECLARE SUB InitCommonControlsEx _
LIB "comctl32" _
ALIAS "InitCommonControlsEx" _
(iccx AS QINITCOMMONCONTROLSEX)
DECLARE FUNCTION CreateWinObjEx _
LIB "USER32" _
ALIAS "CreateWindowExA" _
(ExStyle AS LONG, _
BYVAL Class AS STRING, _
CAPTION AS LONG, _
left AS LONG, _
top AS LONG, _
width AS LONG, _
height AS LONG, _
style AS LONG, _
PARENT AS LONG, _
menu AS LONG, _
handle AS LONG, _
lparam AS LONG) AS LONG
DECLARE SUB KeyHandle (key AS BYTE)
DECLARE SUB CreateObj (sender AS QFORM)
DIM iccx AS QINITCOMMONCONTROLSEX
DEFSTR ClassCal = "SysMonthCal32"
iccx.dwSize = SIZEOF(iccx)
iccx.dwICC = ICC_DATE_CLASSES
InitCommonControlsEx(iccx)
CREATE form AS QFORM
borderstyle = 3
CAPTION = "Today"
width = 210
height = 190
center
onkeydown = KeyHandle
onshow = CreateObj
SHOWMODAL
END CREATE
SUB CreateObj (Sender AS QFORM)
IF NOT (CreateWinObjEx(0, ClassCal, 0, _
WS_CHILD + WS_VISIBLE, _
2, 2, 200, 160, _
sender.handle, 0, 0, 0)>0) THEN _
SHOWMESSAGE "Error: CalendarEx failed"
END SUB
SUB KeyHandle (key AS BYTE)
IF key = VK_ESCAPE THEN form.CLOSE
END SUB
Hopefully others can learn from my example how it can be done in RapidQ (which is sometimes could cause program crash if not coded properly when using comctl32.dll library in RQ).
cheers,
Don67. |