Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (degenerate_762), 1,098 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Print Thread
Rate Thread
using the Windows API #428087
08/17/13 18:08
08/17/13 18:08
Joined: Apr 2013
Posts: 57
3
3DCat Offline OP
Junior Member
3DCat  Offline OP
Junior Member
3

Joined: Apr 2013
Posts: 57
Hi,
since I'm a noob at programming, i got stuck trying to write a script that shall eventually convert CSV pricedata to BAR Files.
I got stuck right at the beginning where i want to convert normal Timestamps/Date to OLE format. I try to use the WindowsAPI
Quote:

#include <default.c>
#include <stdio.h>
#include <windows.h>

typedef struct _SYSTEMTIME {
WORD wYear;
WORD wMonth;
WORD wDayOfWeek;
WORD wDay;
WORD wHour;
WORD wMinute;
WORD wSecond;
WORD wMilliseconds;
} SYSTEMTIME;


void main()
{
int WINAPI SystemTimeToVariantTime(SYSTEMTIME* lpSystemTime, double* pvtime);
int WINAPI VariantTimeToSystemTime(double* pvtime, SYSTEMTIME* lpSystemTime);

SYSTEMTIME st,lt,xt;
double vtime;

GetSystemTime(&st);
GetLocalTime(&lt);

printf("The system time is: %02d:%02d",st.wHour, st.wMinute);
printf("\n");
printf("The local time is: %02d:%02d", lt.wHour, lt.wMinute);
printf("\n");

SystemTimeToVariantTime(&st,&vtime);

printf("VariantTime is: %02f",vtime);
printf("\n");

VariantTimeToSystemTime(&vtime,&xt);

printf("Reconverted Time is: %02d:%02d",xt.wHour,xt.wMinute);
printf("\n");
}


I can't seem to get the SystemTimeToVariantTime right. It produces an error all the time.
Any hints would be nice. I suspected the Struct to be wrong, or some pointer wrongly initialized, but I'm new to programming, especially windowsAPI creeps me out:)

Re: using the Windows API [Re: 3DCat] #428089
08/17/13 18:30
08/17/13 18:30
Joined: Apr 2008
Posts: 585
Austria
Petra Offline
Support
Petra  Offline
Support

Joined: Apr 2008
Posts: 585
Austria
The VariantTimeToSystemTime does not alter the variant time and gets a double, not a double pointer. Also I think you must declare API functions globally, not inside the main function.

Re: using the Windows API [Re: Petra] #428112
08/18/13 07:52
08/18/13 07:52
Joined: Apr 2013
Posts: 57
3
3DCat Offline OP
Junior Member
3DCat  Offline OP
Junior Member
3

Joined: Apr 2013
Posts: 57
You're a genius! It works!
cool
Thanks


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1