Re: SYSTEMTIME and Conversion



This is my first attempt at C++ and it's been a good 10 years since I last
coded in C so forgive me for being dense!

I remember getting very confused by pointers and pointers to pointers and
addresses even then so I need a little clarification!

SYSTEMTIME p_stTime;
TCHAR *tcDatHelp = (TCHAR*)LocalAlloc(LPTR, 40);
CString csDateformat = _T("dd'.'MM'.'yyyy");
GetSystemTime(&p_stTime);
GetDateFormat(NULL, NULL, p_stTime, (LPCTSTR) csDateformat, tcDatHelp,40);

I've added the necessary header includes and swapped around the odd * and &
but it's throwing up 'error C2664: 'GetDateFormatW' : cannot convert
parameter 3 from 'struct _SYSTEMTIME' to 'const struct _SYSTEMTIME *'

Not sure what the problem is!

Also, it's the Hour and Minute (HH:mm) I'm trying to get a hold of. I have
looked at the GetTimeFormat function but I'm now totally confused!

Many thanks for your patience!

Si
"Kerstin Pirrung" wrote:
>
> Haven't all of us already had this problem?
> I'm doing
>
> GetDateFormat(NULL, NULL, p_stTime, (LPCTSTR) csDateformat, tcDatHelp,40);
>
> with
>
> SYSTEMTIME * p_stTime;
> TCHAR * tcDatHelp = (TCHAR*)LocalAlloc(LPTR, 40);
> CString csDateformat = _T("dd'.'MM'.'yyyy");
>
> Kerstin
>
.



Relevant Pages

  • Re: How to name variables in a program?
    ... > this convention works with prefixes to indicate variable type. ... That is a primary example why Hungarian Notation wrong. ... pointers, ... So the L in LPCTSTR lives a lie. ...
    (comp.programming)
  • Re: How to name variables in a program?
    ... >> Ever since I picked up the book Windows programming book by Petzold, ... > libraries that use the unpronouncable name LPCTSTR, ... > various 48-bit segmented pointers, ... of the less ambiguous DWORD. ...
    (comp.programming)
  • Re: Returning a CHAR[] from a function
    ... C2110: '+': cannot add two pointers ... Ajay Kalra wrote: ... LPCTSTR CAutoRunDlg::GetProgramPath ... However I now have a problem adding a CString containing the file path ...
    (microsoft.public.vc.mfc)