Guidance
指路人
g.yi.org
Guidance Forums / Rapid-Q Basic / Using Common Controls Ex in RapidQ

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. Using Common Controls Ex in RapidQ
#3816
Posted by: 2004-04-13 09:11:20
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

' ------------------------------------------
' Using CommonControlsEx component in RapidQ
' By: Don67    E-mail: Don67geo(at)Yahoo.com
' ------------------------------------------
' FileName: CalendarEx.bas
' ------------------------------------------
 $APPTYPE GUI                  ' GUI application mode
 $DEFINE WS_VISIBLE 268435456  ' equal &H10000000
 $DEFINE WS_CHILD  1073741824  ' equal &H40000000
 $DEFINE VK_ESCAPE         27  ' keyboard ESC key value
 $DEFINE ICC_DATE_CLASSES 256  ' Date Class in ComCtl32.DLL

' udt used to initiate common control
 TYPE QINITCOMMONCONTROLSEX
  dwSize AS LONG
  dwICC  AS LONG
 END TYPE

' imports comctl32 and user32 DLL
 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 subs we need to use
 DECLARE SUB KeyHandle (key AS BYTE)
 DECLARE SUB CreateObj (sender AS QFORM)

' dimensioning user variables
 DIM iccx AS QINITCOMMONCONTROLSEX
 DEFSTR ClassCal = "SysMonthCal32"

' initiate commoncontrolsEx before any GUI
 iccx.dwSize = SIZEOF(iccx)
 iccx.dwICC  = ICC_DATE_CLASSES
 InitCommonControlsEx(iccx)

 CREATE form AS QFORM       ' create our main window
  borderstyle = 3        ' dialog style window
  CAPTION = "Today"      ' window title
  width   = 210          ' width in pixel
  height  = 190          ' height in pixel
  center                 ' place window at center
  onkeydown = KeyHandle  ' handle Esc key
  onshow    = CreateObj  ' draw calenderEx
  SHOWMODAL              ' display window
 END CREATE

 SUB CreateObj (Sender AS QFORM)
    ' if no value returned, show error message.
  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)
    ' when user press ESC key, exit program
  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.
Forum List • Thread List • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
¥287.00 ·
 
 
¥2,600.00 ·
 
 
¥289.00 ·
 
 
¥1,370.00 ·
 
 
¥289.00 ·
 
 
¥1,480.00 ·
© Sun 2024-11-24  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0