WCE_FCTN and WinCE 5

Hi,

I need to used in my code the function : WCE_FCTN but i've the following error during compilation for WinCe 5 device:

Erreur 1 error C3861: 'WCE_FCTN': identifier not found c:\Documents and Settings\tlamy.PICKUP\Mes documents\EVC4\Reveil_WinCE5.0\Reveil\Reveil.cpp 179

When i compiled this code for WInCe 4.1 i've no error.

Does this function exists under WinCe 5.0 and if it not exist how could i replace it to get system time in Seconds

Thanks.




Answer this question

WCE_FCTN and WinCE 5

  • bohiti

    You are losing precision here

    ft1 += 60*60*24*1*iNanoToSeconds; //add a day

    Try changing it to

    ft1 += 60*60*24*1* (__int64)iNanoToSeconds; //add a day



  • slugonamission

    Not any FILETIME* pointer can be cast to __int64* but the reverse is always possible. I have answered your question. If you want to deal with FILETIME, it is simply a combination of two DWORDs that represent a long integer. Integer arithmetics is widely described

  • razerredblue

    thanks for your answers,

    I'm using the

    CeRunAppAtTime function to wake up an application any 24 hours, when the apps is launch i need to get the system time and add 1 days to it. to do that i use the following code :

    int iNanoToSeconds = 10000000;

    SYSTEMTIME stfin;

    SYSTEMTIME st;

    __int64 ft1;

    GetSystemTime(&st);

    SystemTimeToFileTime(&st, (FILETIME*)&ft1);

    ft1 += 60*60*24*1*iNanoToSeconds; //add a day

    FileTimeToSystemTime((FILETIME*)&ft1, &stfin);

    unsigned short heure= 22;

    unsigned short minute= 15;

    stfin.wHour=heure;

    stfin.wMinute=minute;

    stfin.wSecond=0;

    stfin.wMilliseconds=0;

    return CeRunAppAtTime(L"\\Program Files\\Pickup Services\\GIPDV\\reveil.exe",&stfin);

    But my apps is waking up only 2 minutes after.... i've done a calcul error but i don't find where, could you help me

    Thanks.


  • Ahsan Ali

    WCE_FCTN is defined as follows:
    #define WCE_FCTN(func) wce_##func

    The idea is that it replaces a call like this:
    WCE_FCTN(calloc)
    with
    wce_calloc

    In older SDKs where MFC was a part of the SDK, they used function wrappers for many of the OS APIs (most are defined in wcealt.h). This is gone now. In fact I don't think you are supposed to use WCE_FCTN directly - it was an internal macro.

    The good news is that in most cases you can drop it entirely. E.g. instead of
    WCE_FCTN(calloc)
    use
    calloc

    To answer your original question (system time in seconds):

    Since the absolute time value in seconds does not make any sense, I assume you want to measure time interval. You can do it like this:

    SYSTEMTIME st;

    __int64 ft1;
    GetSystemTime(&st);
    SystemTimeToFileTime(&st, (FILETIME*)&ft1);

    Sleep(1100);

    __int64 ft2;
    GetSystemTime(&st);
    SystemTimeToFileTime(&st, (FILETIME*)&ft2);

    int timeDelta = (ft2 - ft1) / 10000000;



  • mracuraintegra

    Nobody has some answer to my question

    What is WCE_FCTN

  • TechedRonan

    After some test and searh, I'm finding that we could not convert a FileTime directly to a __int64, because that cause some misalignement. It's the origin of my error. The msdn said taht we could not works directly with FILETIME. And my question are how add some times to a FILETIME

  • WCE_FCTN and WinCE 5