Click here to Skip to main content
15,896,430 members
Home / Discussions / COM
   

COM

 
Questionhow can i generate .olb Pin
AHMAD COM3-Nov-03 19:31
AHMAD COM3-Nov-03 19:31 
QuestionHow do i convert from DATE to DBTIMESTAMP Pin
User 2155973-Nov-03 3:09
User 2155973-Nov-03 3:09 
AnswerRe: How do i convert from DATE to DBTIMESTAMP Pin
Steve S3-Nov-03 22:40
Steve S3-Nov-03 22:40 
GeneralUsing IME Pin
Bishop_Oleg3-Nov-03 3:01
Bishop_Oleg3-Nov-03 3:01 
QuestionHow do i convert BSTR to DATE Pin
User 2155972-Nov-03 18:19
User 2155972-Nov-03 18:19 
AnswerRe: How do i convert BSTR to DATE Pin
Lim Bio Liong3-Nov-03 1:31
Lim Bio Liong3-Nov-03 1:31 
GeneralRe: How do i convert BSTR to DATE Pin
User 2155973-Nov-03 2:57
User 2155973-Nov-03 2:57 
GeneralRe: How do i convert BSTR to DATE Pin
Lim Bio Liong3-Nov-03 14:54
Lim Bio Liong3-Nov-03 14:54 
Hello sohailkadiwala,

I think the function to use is VarDateFromStr() (#include <oleauto.h>). This function is for general OLE Automation support and its use is not confined to MFC apps alone.

I've written a simple ATL object with a method BstrToDate() :

STDMETHODIMP CDateTimeConversion::BstrToDate(BSTR date_string, DATE *date_value_receiver)
{
// TODO: Add your implementation code here
_bstr_t _bs_t_date_string(date_string, true);

return VarDateFromStr
(
(OLECHAR *)_bs_t_date_string,
(LCID)LOCALE_SYSTEM_DEFAULT,
(unsigned long)(VAR_DATEVALUEONLY),
(DATE *)date_value_receiver
);
}

I've also written a sample client app as follows :

void main()
{
::CoInitialize(NULL);

if (true)
{
IDateTimeConversionPtr spIDateTimeConversion;
BSTR bstr_date_string = _bstr_t(TEXT("04/11/2003")).copy();
DATE date;

spIDateTimeConversion.CreateInstance(__uuidof(DateTimeConversion));

spIDateTimeConversion -> BstrToDate ((BSTR)bstr_date_string, (DATE*)&date);

if (bstr_date_string)
{
::SysFreeString(bstr_date_string);
bstr_date_string = NULL;
}
}

::CoUninitialize();
}

If you need, I can email to you the full source codes to my ATL object and my sample client. Let me know your email address.

Best Regards,
Bio.

GeneralRe: How do i convert BSTR to DATE Pin
User 2155974-Nov-03 3:05
User 2155974-Nov-03 3:05 
AnswerRe: How do i convert BSTR to DATE Pin
lxwde9-Nov-03 14:39
lxwde9-Nov-03 14:39 
AnswerRe: How do i convert BSTR to DATE Pin
Abhishek Srivastava10-Nov-03 0:23
Abhishek Srivastava10-Nov-03 0:23 
GeneralAutomation Outlook Pin
paul111-Nov-03 20:34
paul111-Nov-03 20:34 
GeneralRe: Automation Outlook Pin
paul113-Nov-03 4:25
paul113-Nov-03 4:25 
Generalcom+ and dlls Pin
RedSunBeer1-Nov-03 1:14
RedSunBeer1-Nov-03 1:14 
Generalconvert CTime data (C++) to Date data (VB) Pin
rajdawg31-Oct-03 15:40
rajdawg31-Oct-03 15:40 
GeneralC#: COM Interop - Objects become invalid after a while??!! Pin
Corinna John31-Oct-03 2:20
Corinna John31-Oct-03 2:20 
GeneralRe: C#: COM Interop - Objects become invalid after a while??!! Pin
Heath Stewart31-Oct-03 4:59
protectorHeath Stewart31-Oct-03 4:59 
GeneralDHTM binary behavior Pin
jackalwisdom30-Oct-03 21:48
jackalwisdom30-Oct-03 21:48 
GeneralRe: DHTM binary behavior Pin
Heath Stewart31-Oct-03 4:50
protectorHeath Stewart31-Oct-03 4:50 
GeneralRe: DHTM binary behavior Pin
jackalwisdom31-Oct-03 16:31
jackalwisdom31-Oct-03 16:31 
GeneralLocal Machine Software Firewall (Windows) Pin
entr0py_29-Oct-03 12:30
entr0py_29-Oct-03 12:30 
GeneralRe: Local Machine Software Firewall (Windows) Pin
Niels Penneman12-Jan-04 10:30
Niels Penneman12-Jan-04 10:30 
GeneralIStorage, IStream and folder copying to Clipboard Pin
Nathan_RR28-Oct-03 1:33
Nathan_RR28-Oct-03 1:33 
GeneralHTMLDocumentEvents2 Pin
JDasari27-Oct-03 12:25
JDasari27-Oct-03 12:25 
GeneralRe: HTMLDocumentEvents2 Pin
Heath Stewart28-Oct-03 16:53
protectorHeath Stewart28-Oct-03 16:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.