multitache

multitache - Programmation

Marsh Posté le 29-08-2001 à 16:45:41    

voilà j'ai ecrit un programme qui lance des applications et qui eteint le pc une fois celle-ci terminée .. le truc fonctionne bien par contre j'ai l'impression que ca fonctionne pas avec toutes les applications.
 
je l'utilise essentiellement avec rippack. d'ou l'utilité d'eteindre le pc une fois terminé.
 
mais quand j'utilise mon programme avec le fichier .bat qui rippack crée, mon ordinateur reboot tout seul au bout d'une heure ou deux .. ou le processus s'arrete tout seul :-(
 
kk'un a-t-il deja rencontré ce type de probleme qq part?
est ce que j'utilise les bonnes commandes ?

Reply

Marsh Posté le 29-08-2001 à 16:45:41   

Reply

Marsh Posté le 29-08-2001 à 16:47:21    

mon code :
 
voici mon code :  
void CShutDownDlg::OnOpen()  
{
 // TODO: Add your control notification handler code here
 CFileDialog *pFile;
 pFile = new CFileDialog(TRUE, "mdb", NULL, NULL, "Programmes|*.exe|Tous les fichiers|*.*||" );
 pFile->DoModal();
 m_Path = pFile->GetPathName();
 UpdateData(FALSE);
}
 
void CShutDownDlg::OnChangePath()  
{
 // TODO: If this is a RICHEDIT control, the control will not
 // send this notification unless you override the CDialog::OnInitDialog()
 // function and call CRichEditCtrl().SetEventMask()
 // with the ENM_CHANGE flag ORed into the mask.
 
 // TODO: Add your control notification handler code here

Reply

Marsh Posté le 29-08-2001 à 16:48:47    

void CShutDownDlg::Launch()
{
 int iValue = AfxMessageBox("Attention !\n l'ordinateur s'eteindra à la fin de l'application\n\n Voulez-vous continuer ?", MB_YESNO, 0 );
 
 if (iValue == IDYES )
 {
  STARTUPINFO sui ;
  PROCESS_INFORMATION pi ;
  sui.cb = sizeof (STARTUPINFO);
  GetStartupInfo (&sui);
  sui.dwFlags = STARTF_USESHOWWINDOW ;
  sui.wShowWindow = SW_MINIMIZE ;
   
  // Creation du process
  CreateProcess (m_Path,
   NULL,
   NULL,
   NULL,
   FALSE,
   CREATE_DEFAULT_ERROR_MODE|HIGH_PRIORITY_CLASS,
   NULL,
   NULL,&sui,&pi);
   
  m_PID = pi.dwProcessId;
 
  UpdateData(FALSE);
 
  ShowWindow(SW_HIDE);
 
  // Attente de la fin du process fils
  WaitForSingleObject(pi.hProcess, INFINITE);
   
  Exit();
 }
}

Reply

Sujets relatifs:

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed