cs_Exploreur
Messages postés4821Date d'inscriptionlundi 11 novembre 2002StatutMembreDernière intervention15 novembre 2016
-
28 déc. 2006 à 15:15
Sinsitrus
Messages postés849Date d'inscriptionsamedi 11 juin 2005StatutMembreDernière intervention21 août 2015
-
5 mars 2008 à 10:02
Bonjour à tous,
Ext-il possible tu tuer un processus lancer par Shell?
Exemple je lance la calculatrice de windows : shell(C:\windows\system32\Calc.exe"), et je voudrais comprendre quand je quitte mon prog que la calculatrice se ferme en même temps!!!lol.
Moi je ne sais pas.
Merci à tous de votre aide.
BON REVEILLON
A+
Exploreur
cs_Exploreur
Messages postés4821Date d'inscriptionlundi 11 novembre 2002StatutMembreDernière intervention15 novembre 201615 30 déc. 2006 à 00:29
Re-bonsoir Violent_ken,
Bon, j'ai bien suivi tes instructions et explications et je voudrais te demander "encore" une explication sans abuser de ton temps et de ta patience(mes paroles que je te dit ne sont pas des paroles pour faire beau, mais plutôt des paroles de reconnaissance, je dit cela car comme il y pleins de personnes qui lisent les message, je n'ai pas envie qu'ils pensent : "regardez moi ce....", bref.
La calculatrice windows se trouve(logiquement) :
C:\Windows\Sytem32\calc.exe (je n'apprend rien à personnes!!lol)
La messagerie windows se trouve(logiquement!):
C:\Program Files\Outlook Express\msimn.exe (idem, je n'apprend rien à personnes)
Donc le GetPathFromPid, si j'ai bien compris c'est lui qui donne le Path. J'ai regarder dans le code que tu donnes pour le module, et il y un truc que je pit pas :
GetPathFromPid = ([System Process]) << euh..c'est quoi?Cela veux dire (C:\Windows\Sytem32\), car apparement c'est lui qui donne le chemin d'accés à la calculette windows. Si je laisse cela, en suivant tes explications pour msimn.exe, il me dit : Fichier introuvable(gestion erreur)!!"Comment" dire à ta fonction de chercher le fichier dans C:\Program Files\Outlook Express ?!!! Bon là il fautr que j'arrête car j'ai les yeux qui piquent !!!!
Merci de ta compréhension.
A+
Exploreur
violent_ken
Messages postés1812Date d'inscriptionmardi 31 mai 2005StatutMembreDernière intervention26 octobre 20102 30 déc. 2006 à 00:39
Violent Ken
Salut, [System Process] veut dire....bah [System Process] ;)
C'est le "Processus inactif du système" que tu peux voir quand tu appuies sur ctrl+alt+suppr. Son PID est 0.
Autrement dit, tu as passé à la fonction GetPathFromPID la valeur 0.
Comme tu as passé la variable PID dans cette fonction, c'est que la variable PID vaut 0. Comme je pense tu as affecté le résultat de la fonction "Shell" à la variable PID, deux cas sont possibles pour justifier l'erreur :
1) (le moins probable) : le fichier désigné par Shell n'existe pas et donc Shell renvoie 0 (ce qui m'étonne car normalement çà génère une erreur)
2) tu n'a pas déclaré la variable PID ou il fallait (ou alors pas déclaré du tout) et par conséquent elle pert sa valeur au cours du programme : cette variable est à déclarer en privé à une form (Private PID as Long tout au début du code) et non pas en privé à une procédure. Vérifie bien la déclaration de PID, je pense que çà vient de là.
violent_ken
Messages postés1812Date d'inscriptionmardi 31 mai 2005StatutMembreDernière intervention26 octobre 20102 30 déc. 2006 à 00:57
Violent Ken
Tiens au fait, voici comment récupérer un répertoire spécial (genre Program Files, Mes Documents...etc) de n'importe quel PC :
Dans un module :
Option Explicit
'-------------------------------------------------------
'ENUM & TYPES
'-------------------------------------------------------
Public Enum SPECIAL_FOLDER_TYPE
CSIDL_DESKTOP = &H0 '{desktop}
CSIDL_INTERNET = &H1 'Internet Explorer (icon on desktop)
CSIDL_PROGRAMS = &H2 'Start Menu\Programs
CSIDL_CONTROLS = &H3 'My Computer\Control Panel
CSIDL_PRINTERS = &H4 'My Computer\Printers
CSIDL_PERSONAL = &H5 'My Documents
CSIDL_FAVORITES = &H6 '{user}\Favourites
CSIDL_STARTUP = &H7 'Start Menu\Programs\Startup
CSIDL_RECENT = &H8 '{user}\Recent
CSIDL_SENDTO = &H9 '{user}\SendTo
CSIDL_BITBUCKET = &HA '{desktop}\Recycle Bin
CSIDL_STARTMENU = &HB '{user}\Start Menu
CSIDL_DESKTOPDIRECTORY = &H10 '{user}\Desktop
CSIDL_DRIVES = &H11 'My Computer
CSIDL_NETWORK = &H12 'Network Neighbourhood
CSIDL_NETHOOD = &H13 '{user}\nethood
CSIDL_FONTS = &H14 'windows\fonts
CSIDL_TEMPLATES = &H15
CSIDL_COMMON_STARTMENU = &H16 'All Users\Start Menu
CSIDL_COMMON_PROGRAMS = &H17 'All Users\Programs
CSIDL_COMMON_STARTUP = &H18 'All Users\Startup
CSIDL_COMMON_DESKTOPDIRECTORY = &H19 'All Users\Desktop
CSIDL_APPDATA = &H1A '{user}\Application Data
CSIDL_PRINTHOOD = &H1B '{user}\PrintHood
CSIDL_LOCAL_APPDATA = &H1C '{user}\Local Settings\Application Data (non roaming)
CSIDL_ALTSTARTUP = &H1D 'non localized startup
CSIDL_COMMON_ALTSTARTUP = &H1E 'non localized common startup
CSIDL_COMMON_FAVORITES = &H1F
CSIDL_INTERNET_CACHE = &H20
CSIDL_COOKIES = &H21
CSIDL_HISTORY = &H22
CSIDL_COMMON_APPDATA = &H23 'All Users\Application Data
CSIDL_WINDOWS = &H24 'GetWindowsDirectory()
CSIDL_SYSTEM = &H25 'GetSystemDirectory()
CSIDL_PROGRAM_FILES = &H26 'C:\Program Files
CSIDL_MYPICTURES = &H27 'C:\Program Files\My Pictures
CSIDL_PROFILE = &H28 'USERPROFILE
CSIDL_SYSTEMX86 = &H29 'x86 system directory on RISC
CSIDL_PROGRAM_FILESX86 = &H2A 'x86 C:\Program Files on RISC
CSIDL_PROGRAM_FILES_COMMON = &H2B 'C:\Program Files\Common
CSIDL_PROGRAM_FILES_COMMONX86 = &H2C 'x86 Program Files\Common on RISC
CSIDL_COMMON_TEMPLATES = &H2D 'All Users\Templates
CSIDL_COMMON_DOCUMENTS = &H2E 'All Users\Documents
CSIDL_COMMON_ADMINTOOLS = &H2F 'All Users\Start Menu\Programs\Administrative Tools
CSIDL_ADMINTOOLS = &H30 '{user}\Start Menu\Programs\Administrative Tools
End Enum
Private Type SHITEMID
cb As Long
abID As Byte
End Type
Private Type ITEMIDLIST
mkid As SHITEMID
End Type
'-------------------------------------------------------
'APIS
'-------------------------------------------------------
Private Declare Function SHGetSpecialFolderLocation Lib "shell32.dll" (ByVal hwndOwner As Long, ByVal nFolder As Long, pidl As ITEMIDLIST) As Long
Private Declare Function SHGetPathFromIDList Lib "shell32.dll" Alias "SHGetPathFromIDListA" (ByVal pidl As Long, ByVal pszPath As String) As Long
'-------------------------------------------------------
'obtient un path spécial
'-------------------------------------------------------
Public Function GetSpecialFolder(Folder As SPECIAL_FOLDER_TYPE, Optional ByVal hwnd As Long) As String
Dim R As Long
Dim sPath As String
Dim IDL As ITEMIDLIST
If IsMissing(hwnd) Then hwnd = 100
'obtient le path
R = SHGetSpecialFolderLocation(hwnd, Folder, IDL)
If R = 0 Then
'création d'un buffer
sPath = Space$(512)
'obtient le path depuis l'itemidlist
R = SHGetPathFromIDList(ByVal IDL.mkid.cb, ByVal sPath)
'formate le texte
GetSpecialFolder = Left$(sPath, InStr(sPath, vbNullChar) - 1)
Exit Function
End If
GetSpecialFolder = vbNullString
End Function
Exemple d'utilisation :
Private Sub Command1_Click()
MsgBox GetSpecialFolder(CSIDL_WINDOWS) 'répertoire de Windows
MsgBox GetSpecialFolder(CSIDL_PROGRAM_FILES) 'Program Files
End Sub
cs_Exploreur
Messages postés4821Date d'inscriptionlundi 11 novembre 2002StatutMembreDernière intervention15 novembre 201615 30 déc. 2006 à 01:10
Re,
Ben, merci encore une fois de ton aide, et promis je t'embête plus!!!
Merci encore.
Maintenant je vais me mettre des gouttes dans les yeux!!!lol
A+
Exploreur
Vous n’avez pas trouvé la réponse que vous recherchez ?
Sinsitrus
Messages postés849Date d'inscriptionsamedi 11 juin 2005StatutMembreDernière intervention21 août 2015 5 mars 2008 à 10:02
Salut, après avoir mis le code pour la calculatrice et le module de [auteur/VIOLENTKEN/523601.aspx violent_ken]
Je voudrais que ma calculette soit en VbModal sur ma form... pouvez vous maider svp ?