Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28446 Discussions

Need help with "Month Calendar" control

Intel_C_Intel
Employee
509 Views
Can anyone help me in using the "Month Calendar" Activex control (a date selector interface) with CVF 6.6A? What I think I need is a good, step-by-step procedure for integrating this control. The general Activex instructions in Help are not very clear to me. "Month Calendar" is the control that is inserted into an application from MS Visual Studio by Tools, Customize, check Controls, then it is on the last row of selections.
0 Kudos
1 Reply
pcurtis
Beginner
509 Views

! this is a proc for a dialog which has date-time picker controls,
! one for the date and another for the time of day, respectively
! denoted by IDC_DATE and IDC_TIME; the dialog and its controls were
! created with the standard DevStudio "visual" dialog editor. The month-cal
! control is quite similar, except there are additional messages to set formats
! for the calendar, retrieve date ranges, etc.

INTEGER FUNCTION GetDateProc (hwnd, msg, wParam, lParam) RESULT (res)
!DEC$ IF DEFINED(_X86_)
!DEC$ ATTRIBUTES STDCALL, ALIAS : '_GetDateProc@16' :: GetDateProc
!DEC$ ELSE
!DEC$ ATTRIBUTES STDCALL, ALIAS : 'GetDateProc' :: GetDateProc
!DEC$ ENDIF
IMPLICIT NONE
INTEGER, INTENT(IN) :: hwnd
INTEGER, INTENT(IN) :: msg
INTEGER, INTENT(IN) :: wParam
INTEGER, INTENT(IN) :: lParam

INTEGER :: rval
INTEGER :: hwndControl, hw_time, hw_date
INTEGER :: controlId
INTEGER :: code
TYPE(T_SYSTEMTIME) :: st1, st2

! wrapper function for standard dialog functions
res = DefaultDialogProc (hwnd, msg, wParam, lParam)

SELECT CASE (msg)

! to start the dialog, initialize the members of a SYSTEMTIME structure,
! and send it to both of the DTP controls

CASE (WM_INITDIALOG)

st1 = ! initialize here with starting time and date members; note
! that ALL members must be initialized, even if they will not
! be referenced in the dialog (eg, seconds and milliseconds)
hw_time = GetDlgItem (hwnd, IDC_TIME)
rval = SendMessage (hw_time, DTM_SETSYSTEMTIME, &
GDT_VALID, LOC(st1))
hw_date = GetDlgItem (hwnd, IDC_DATE)
rval = SendMessage (hw_date, DTM_SETSYSTEMTIME, &
GDT_VALID, LOC(st1))
res = 1

CASE (WM_COMMAND)
code = HIWORD(wParam)
controlId = LOWORD(wParam)
hwndControl = lParam

SELECT CASE (controlId)

! dialog concludes: retrieve the two SYSTEMTIME structures,
! pack the ymd values into st1, which will then get returned
! to the calling locus (typically via module-local params which
! are passed back in the dialog's shell routine)
CASE (IDOK)
rval = SendMessage (hw_time, DTM_GETSYSTEMTIME, 0, LOC(st1))
rval = SendMessage (hw_date, DTM_GETSYSTEMTIME, 0, LOC(st2))
st1%wYear = st2%wYear
st1%wMonth = st2%wMonth
st1%wDay = st2%wDay
res = 1

END SELECT

CASE (WM_DESTROY)

END SELECT
END FUNCTION GetDateProc
0 Kudos
Reply