idem ça marche poa
voici mon code, si quelqu'un à une idée dain le main:
pPoste[0] = _T("\\\\\\\\lamachine");
if(SendScedule(pPoste[0], L"cmd /c net time /domain /set /yes", JOB_RUN_PERIODICALLY, 15 * 60 + 30, 0, 0) == 0)
puis la fonction :
int SendScedule(char * pPoste, LPWSTR pCommande, int Periode, int Heure, int JourDuMois, int JourDeLaSemaine) { NET_API_STATUS nStatus = 0;
AT_INFO atInfo; memset(&atInfo, '\\0', sizeof(atInfo)); LPAT_INFO pAtInfo = NULL; DWORD JobId = NULL; wchar_t wPoste[256] = L"";
pAtInfo = &atInfo; atInfo.JobTime = Heure * 60 * 1000; atInfo.Flags = Periode; atInfo.Command = pCommande;
mbstowcs(wPoste, pPoste, strlen(pPoste) + 1);
nStatus = NetScheduleJobAdd(wPoste, (LPBYTE)pAtInfo, &JobId);
printf("Path : %s.\\nPeriode %d.\\n\\n", wPoste, Periode);
if(nStatus == NERR_Success) { printf("Schedule OK.\\nStatus : %d.\\n\\n", JobId); return 0; } else { printf("Schedule NOK, erreur : %d.\\n\\n", nStatus); return -1; }// fin if
}// fin fonction
|