nanou1605
Messages postés36Date d'inscriptionmercredi 10 mars 2004StatutMembreDernière intervention15 décembre 2006
-
14 juin 2006 à 11:20
cs_koko1
Messages postés3Date d'inscriptiondimanche 6 avril 2008StatutMembreDernière intervention26 juin 2008
-
26 juin 2008 à 00:18
Bonjour,
j'aimerais pouvoir lancer une application (.exe) en modifiant sa priorité.
J'ai trouvé la source de Nix 'http://www.vbfrance.com/code.aspx?id=20' mais cela ne me convient pas car elle modifie la priorité de l'application courante.
Moi, j'aimerai lancer une application (par ex: notepad.exe) en modifiant sa priorité.
En réalité, j'ai un programme qui bouffe toute mes ressources et j'aimerais la mettre en priorité basse.
Mon idée serait de faire un programme VB qui lance l'applic puis qui modifie sa priorité. (ou encore, si c'est possible, préciser la priorité basse lors du lancement de l'applic. une fonction comme "Lanceapllic(monappli,priorite)")
nanou1605
Messages postés36Date d'inscriptionmercredi 10 mars 2004StatutMembreDernière intervention15 décembre 2006 14 juin 2006 à 13:31
Bonjour,
Merci pour ton aide,
voila ce que j'ai aujourd'hui (merci à Johanne pour sa source):
'**********************************************
'* Programmeur:Johanne Dorion
'* Nick:ShanaBurns
'* Date:17-avril-2002
'*----------------------------------------------------------
'* Module permettant d'executer un fichier exe
'* et d'attendre la fin de son execution avant de
'* continuer.
'*----------------------------------------------------------
'* Dépendance:Aucune
'**********************************************
Option Explicit
Public Const INFINITE = &HFFFF ' Infinite timeout
Public Type SECURITY_ATTRIBUTES
nLength As Long
lpSecurityDescriptor As Long
bInheritHandle As Long
End Type
Public Enum enSW
SW_HIDE = 0
SW_NORMAL = 1
SW_MAXIMIZE = 3
SW_MINIMIZE = 6
End Enum
Public Type STARTUPINFO
cb As Long
lpReserved As String
lpDesktop As String
lpTitle As String
dwX As Long
dwY As Long
dwXSize As Long
dwYSize As Long
dwXCountChars As Long
dwYCountChars As Long
dwFillAttribute As Long
dwFlags As Long
wShowWindow As Integer
cbReserved2 As Integer
lpReserved2 As Long
hStdInput As Long
hStdOutput As Long
hStdError As Long
End Type
Public Type PROCESS_INFORMATION
hProcess As Long
hThread As Long
dwProcessId As Long
dwThreadId As Long
End Type
Public Declare Function CreateProcess Lib "kernel32" Alias "CreateProcessA" (ByVal lpApplicationName As String, ByVal lpCommandLine As String, lpProcessAttributes As SECURITY_ATTRIBUTES, lpThreadAttributes As SECURITY_ATTRIBUTES, ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, lpEnvironment As Any, ByVal lpCurrentDriectory As String, lpStartupInfo As STARTUPINFO, lpProcessInformation As PROCESS_INFORMATION) As Long
Public Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long
Public Sub ExecutFile(sFile As String, sParam As String, sDir As String, priority As Long, ByVal StartSize As enSW, bWait As Boolean)
Dim s As STARTUPINFO
Dim p As PROCESS_INFORMATION
Dim secur As SECURITY_ATTRIBUTES
Dim ret
s.cb = Len(s)
s.dwFlags = STARTF_USESHOWWINDOW
s.wShowWindow = StartSize
Dans le gestionnaire des tâches, je retrouve calc.exe avec la priorite définie (OK super) mais la calculatrice ne s'affiche pas ???
J'oublie certainement quelques chose mais quoi?
De plus lorsque j'essaie avec notepad, il n'apparait pas dans le gestionnaire des tâches:
nanou1605
Messages postés36Date d'inscriptionmercredi 10 mars 2004StatutMembreDernière intervention15 décembre 2006 15 juin 2006 à 09:24
Bonjour,
mon programme marche très bien avec un EXE windows mais me voila face à un nouveau problème...
Lorsque j'essaye de lancer une applic DOS, voici le message d'erreur :
"C:\Programme\PROG.EXE
%SystemRoot%\system32\config.nt. Le fichier système ne convient pas à l'exécution des applications MS-DOS ou Microsoft Windows. Choisissez 'Fermer' pour mettre fin à l'application.
|Fermer| |Ignorer|