定时运行程序

    技术2022-05-11  11

    CeRunAppAtTime function is defined in the Notify.h header. Use GetModuleFileName function to get full path of the current application. You code can be like:

    TCHAR lpFileName[MAX_PATH+1];GetModuleFileName(NULL, lpFileName, MAX_PATH);

    SYSTEMTIME t;memset(&t, 0, sizeof(SYSTEMTIME));t.wMonth = 5;t.wDay = 5;t.wYear = 2002;t.wHour = 11;

    CeRunAppAtTime(lpFileName, &t);

    When it is necessary the system will start your application and will pass the APP_RUN_AT_TIME string as the command line. If your application is MFC based and one copy is already running then your running copy will be just brought to the foreground. But because the command line is not passed from the started copy to the running copy (MFC does not implement it) you will not be able to understand if the event happend.  


    最新回复(0)