09-07-2018 12:53 AM - edited 09-07-2018 01:10 AM
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?
09-17-2018 05:49 AM
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?