
function boolean InitCommonControlsEx(ref initcommoncontrols lpinitcommoncontrols) library "comctl32.dll"
//清除指定的窗口及它的所有子窗口
function boolean DestroyWindow(ulong hwnd) library "user32"
//判断一个窗口句柄是否有效
function boolean IsWindow(ulong hwnd) library "user32"
//发送指定的信息(这里指时间结构)到指定的窗口
function long SendMessageSystemTime(long hwnd,long uMsg,long wParam,ref systemTime lpst) library "user32" alias for "SendMessageA"
还需要定义两个结构和两个函数(一个设置日期,一个获取日期)
of_getdate()函数
//声明结构 对象
systemtime stc_systemtime
//声明日期类型 引用
date dat_calendar
if IsWindow(i_lng_handle) then //如果窗口句柄可用
//将用户选择的时间信息填充到时间结构中去,0表示成功,其它表示失败
if SendMessageSystemTime(i_lng_handle,4097,0,stc_systemtime)=0 then
//得到日期
dat_calendar=date(stc_systemtime.wyear,stc_systemtime.wmonth,stc_systemtime.wday)
else
setNull(dat_calendar)
end if
else
setNull(dat_calendar)
end if
return dat_calendar
//
of_setdate(long an_handle) 函数
//将可视日历控件的窗口句柄传递给不可视的用户对象,二者关联在一起,获得日期
if IsWindow(an_handle) then
if IsWindow(i_lng_handle) then DestroyWindow(i_lng_handle)//销毁以前的对象
//设置句柄
i_lng_handle=an_handle
end if
return
//得到日历的时间(按钮中代码)
date dat_calendar
string str_calendar
dat_calendar=uo_1.i_nvo_calendar.uf_getdate()
if isNull(dat_calendar) then
str_calendar='未得到正确的日期'
else
str_calendar=string(dat_calendar,'yyyy-mm-dd')
end if
messageBox('日历',str_calendar)
1.数据窗口可以定义date或者datetime的字段,然后把它设成你想要的格式,如'yyyy-mm-dd'2.回到window用dw_name.getitemstring(1,'字段名')得到数据
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)