Beside the solutions already posted here, the most handy way to deal with VARIANT structures in MFC is to use COleVariant.
Just:
Code:
COleDateTime mytime(1996, 1, 1, 0, 0, 0);
function(COleVariant(mytime));
// COleVariant has a constructor which takes const COleDateTime& and an operator LPVARIANT().
A little bit easier, isn't it?
Last edited by ovidiucucu; September 12th, 2010 at 07:19 AM.
The Cardinal Rules of Optimization:
1. Do not optimize
2. For experts only: do not optimize yet
Except it's otherwise specified, a clearer/shorter/lesser susceptible for bugs/easier to read and maintain code, has to be preffered to "more efficient" one.
Last edited by ovidiucucu; September 12th, 2010 at 08:01 AM.
Bookmarks