LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How to set current date in ActiveX DTPicker control?

I am using DTPicker for selecting date. I want the control to display current date in the DTPicker control on panel load. Currently it is populating the date in short format (dd/mm/yyyy) whats set during UIR designing. Can some one help me to set this through code?

0 Kudos
Message 1 of 2
(2,323 Views)

This is the code snippet;

GetCurrentDateTime (&currDateTime);
curr_dat =  (DATE)currDateTime;
vdate = CA_VariantDate(curr_dat);
CA_VariantConvertToType (&vdate, CAVT_DOUBLE, &temp_date);
MSComCtl2_IDTPickerSetFormat(activeX_handle,NULL,MSComCtl2Const_dtpShortDate);
res = MSComCtl2_IDTPickerSetValue (activeX_handle, NULL, vdate);

 

This is sets res value to 0x80020009 which is "Unknown Error". In GUI the date is set to default value with out any message pop up. I am able to edit the date from ActiveX control and manipulate the date, but failing to set the date through code. Where am I going wrong?

0 Kudos
Message 2 of 2
(2,275 Views)