General information
Category:
Windows API functions
Please save the following code as C file, it works.
Use with VFP
declare integer ConvertTime IN timeconv.dll String @Buffer
Buffer = space(64)
? ConvertTime(@Buffer)
? Buffer
#define STRICT
#include
#include
BOOL WINAPI DllMain(HANDLE hInst, ULONG ulReason, LPVOID pReserved)
{
switch (ulReason) {
case DLL_PROCESS_ATTACH:
break;
case DLL_PROCESS_DETACH:
break;
default:
break;
}
return (TRUE);
}
int WINAPI ConvertTime(LPSTR pBuffer)
{
int iResult = -1;
struct tm *newtime;
time_t aclock;
aclock = time(NULL); // 8067157205 is invalid, localtime() returns NULL pointer
if (pBuffer && (newtime = localtime(&aclock))) {
lstrcpy(pBuffer, asctime(newtime));
iResult = lstrlen(pBuffer);
}
return (iResult);
}
Winfried
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only