I have been asked to provide some sample code for a calendar (date picker) control. I am posting it here because it may be of general interest. You can use three files.
The first called resource.rc contains....
#include <windows.h> #define IDD_DIALOG1 100 #define IDC_EDIT1 201 #define IDC_EDIT2 202 #define IDC_EDIT3 203 #define IDC_MONTHCALENDAR1 1000
#define MCS_DAYSTATE 0x0001 #define MCS_WEEKNUMBERS 0x0004 #define MCS_NOTODAYCIRCLE 0x0008 #define MCS_NOTODAY 0x0010
IDD_DIALOG1 DIALOGEX 0, 0, 115, 106 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION 'Calendar Control' FONT 8, 'MS Shell Dlg', 400, 0, 0x1 BEGIN CONTROL '',IDC_MONTHCALENDAR1,'SysMonthCal32',MCS_NOTODAY | WS_TABSTOP,0,0,115,89 EDITTEXT IDC_EDIT1,12,90,28,12,ES_CENTER EDITTEXT IDC_EDIT2,43,90,28,12,ES_CENTER EDITTEXT IDC_EDIT3,74,90,28,12,ES_CENTER END
The second, called calendar.f90 contains....
WINAPP PROGRAM main INTEGER,PARAMETERIDD_DIALOG1 = 100 INTEGER,PARAMETERIDC_EDIT1 = 201 INTEGER,PARAMETERIDC_EDIT2 = 202 INTEGER,PARAMETERIDC_EDIT3 = 203 INTEGER,PARAMETER::IDC_MONTHCALENDAR1 = 1000
INTEGER i,winio@,cb
EXTERNAL cb
COMMON idata(8)
i=winio@('%di&',IDD_DIALOG1)
i=winio@('%^mc&',IDC_MONTHCALENDAR1,idata,cb)
i=winio@('%rd&',IDC_EDIT3,idata(1)) i=winio@('%rd&',IDC_EDIT2,idata(2))
i=winio@('%`rd', IDC_EDIT1,idata(4))
END
INTEGER FUNCTION cb() COMMON idata(8) CALL window_update@(idata(1)) CALL window_update@(idata(2)) CALL window_update@(idata(4)) cb = 2 END
The last file is a batch file to do the compilation, linking and running (call it build.bat say)...
ftn95 calendar.f90 src resource.rc slink calendar.obj resource.obj calendar.exe
When you run the batch file from a command prompt, the result displays a calendar control with the edit boxes showing the date values generated in the integer array when a date is selected.