-
getting the time
I don't understand why this won't work.
Code:
SYSTEMTIME stime;
GetLocalTime(stime);
--------------------Configuration: Dialog - Win32 Debug--------------------
Compiling...
Dialog.cpp
C:\C++\Dialog\Dialog.cpp(15) : error C2501: 'GetLocalTime' : missing storage-class or type specifiers
C:\C++\Dialog\Dialog.cpp(15) : error C2373: 'GetLocalTime' : redefinition; different type modifiers
c:\program files\microsoft visual studio\vc98\include\winbase.h(2844) : see declaration of 'GetLocalTime'
C:\C++\Dialog\Dialog.cpp(15) : error C2440: 'initializing' : cannot convert from 'struct _SYSTEMTIME' to 'int'
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
Error executing cl.exe.
Dialog.exe - 3 error(s), 0 warning(s)
-
I don't know the rest of your code but:
1. Include the windows.h file
2. GetLocalTime requires the address of the SYSTEMTIME structure
so use
Code:
SYSTEMTIME stime;
GetLocalTime(&stime);
-
OK, It's fixed.
How can I get stime.wHour & stime.wMinute & stime.wSecond
into a string to print to a text box or message box?
-
Use sprintf (actually snprintf is better if you have it).