Dear Readers,
I am trying to access POOM from .net and am very close. My only problem I have is setting sending a date field back to an unmanaged function in a dll. Here is what I did but unfortunaltey it gives me back an System.NotSupportedException error.
The get property works fine and I am able to read date fields from the unmanaged function.
Any ideas would be appreciated:
public DateTime Start
{
get
{
DateTime myDate = new System.DateTime(1899, 12, 30, 0, 0 ,0);
double zStart = 0;
PocketOutlook.CheckHRESULT(do_get_Start(this.RawItemPtr, ref zStart));
myDate = myDate.AddDays(zStart);
return myDate;
}
set
{
double myReturnVal = 0;
DateTime myDate = new System.DateTime(1899, 12, 30, 0, 0 ,0);
System.TimeSpan myTimeSpan;
myTimeSpan = value.Subtract(myDate);
myReturnVal = myTimeSpan.TotalDays;
PocketOutlook.CheckHRESULT(do_put_Start(this.RawItemPtr, myReturnVal));
}
}
[DllImport("PocketOutlook.dll", EntryPoint="IAppointment_get_Start")]
private static extern int do_get_Start (IntPtr self, ref double pStart);
[DllImport("PocketOutlook.dll", EntryPoint="IAppointment_put_Start")]
private static extern int do_put_Start (IntPtr self, double pStart);
The unmanaged dll code looks like this :
HRESULT
IAppointment_get_Start(IAppointment* thisPtr,
DATE* pst)
{
return thisPtr->get_Start(pst);
}
HRESULT
IAppointment_put_Start(IAppointment* thisPtr,
DATE st)
{
return thisPtr->put_Start(st);
}
Please, if anyone has an idea share it with me. I am so close.
Thanks,
Mozzak
I am trying to access POOM from .net and am very close. My only problem I have is setting sending a date field back to an unmanaged function in a dll. Here is what I did but unfortunaltey it gives me back an System.NotSupportedException error.
The get property works fine and I am able to read date fields from the unmanaged function.
Any ideas would be appreciated:
public DateTime Start
{
get
{
DateTime myDate = new System.DateTime(1899, 12, 30, 0, 0 ,0);
double zStart = 0;
PocketOutlook.CheckHRESULT(do_get_Start(this.RawItemPtr, ref zStart));
myDate = myDate.AddDays(zStart);
return myDate;
}
set
{
double myReturnVal = 0;
DateTime myDate = new System.DateTime(1899, 12, 30, 0, 0 ,0);
System.TimeSpan myTimeSpan;
myTimeSpan = value.Subtract(myDate);
myReturnVal = myTimeSpan.TotalDays;
PocketOutlook.CheckHRESULT(do_put_Start(this.RawItemPtr, myReturnVal));
}
}
[DllImport("PocketOutlook.dll", EntryPoint="IAppointment_get_Start")]
private static extern int do_get_Start (IntPtr self, ref double pStart);
[DllImport("PocketOutlook.dll", EntryPoint="IAppointment_put_Start")]
private static extern int do_put_Start (IntPtr self, double pStart);
The unmanaged dll code looks like this :
HRESULT
IAppointment_get_Start(IAppointment* thisPtr,
DATE* pst)
{
return thisPtr->get_Start(pst);
}
HRESULT
IAppointment_put_Start(IAppointment* thisPtr,
DATE st)
{
return thisPtr->put_Start(st);
}
Please, if anyone has an idea share it with me. I am so close.
Thanks,
Mozzak