begin process at 2012 02 09 02:57:54
  Trouver un code source :
 
dans
 
Accueil > 

Code

 > 

Base de registre

 > CHERCHEZ LE CHEMIN D'UN APPLI DANS LA BASE DE REGISTRE

CHERCHEZ LE CHEMIN D'UN APPLI DANS LA BASE DE REGISTRE


 Information sur la source

Note :
2,75 / 10 - par 4 personnes
2,75 / 10

  • 1

  • 2

  • 3

  • 4

  • 5

  • 6

  • 7

  • 8

  • 9

  • 10
Catégorie :Base de registre Niveau :Initié Date de création :24/06/2003 Date de mise à jour :24/06/2003 12:02:09 Vu :3 976

Auteur : emap

Ecrire un message privé
Site perso
Commentaire sur cette source (7)
Ajouter un commentaire et/ou une note

 Description

Bon, c'est pas de moi (pour ceux qui veulent à toux pris des codes propriétaires c'est pas la peine d'aller plus loin...:) ) mais vraiment ca me change la vie. Alors tiendez :)

|emap|

Source

  • 'Exemple pour acrobat reader...
  • Private Declare Function RegOpenKeyEx Lib "advapi32" Alias "RegOpenKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal dwReserved As Long, ByVal samDesired As Long, phkResult As Long) As Long
  • Private Declare Function RegQueryValueEx Lib "advapi32" Alias "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName$, ByVal lpdwReserved As Long, lpdwType As Long, lpData As Any, lpcbData As Long) As Long
  • Private Declare Function RegCloseKey Lib "advapi32" (ByVal hKey As Long) As Long
  • Const HKEY_LOCAL_MACHINE As Long = &H80000002
  • '
  • '
  • 'From FAQ the Acrobat Reader can be found at"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AppPaths\AcroRd32.exe"
  • '
  • '
  • Function RegGetString$(hInKey As Long, ByVal subkey$, ByVal valname$)
  • Dim RetVal$, hSubKey As Long, dwType As Long, SZ As Long
  • Dim R As Long
  • RetVal$ = ""
  • Const KEY_ALL_ACCESS As Long = &H3F
  • Const ERROR_SUCCESS As Long = 0
  • Const REG_SZ As Long = 1
  • R = RegOpenKeyEx(hInKey, subkey$, 0, KEY_ALL_ACCESS, hSubKey)
  • If R <> ERROR_SUCCESS Then GoTo Quit_Now
  • SZ = 256: v$ = String$(SZ, 0)
  • R = RegQueryValueEx(hSubKey, valname$, 0, dwType, ByVal v$, SZ)
  • If R = ERROR_SUCCESS And dwType = REG_SZ Then
  • SZ = SZ - 1
  • RetVal$ = Left$(v$, SZ)
  • Else
  • RetVal$ = "--Not String--"
  • End If
  • If hInKey = 0 Then R = RegCloseKey(hSubKey)
  • Quit_Now:
  • RegGetString$ = RetVal$
  • End Function
  • Function CheminAcrobat() As String
  • Dim ViewerStr As String
  • ViewerStr = RegGetString$(HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows\CurrentVersion\AppPaths\Acrobat.exe", "Path")
  • If ViewerStr <> "" Then
  • ViewerStr = ViewerStr + "\Acrobat.exe"
  • Debug.Print "Using Acrobat"
  • Else
  • ' Acrobat is not installed
  • ViewerStr = RegGetString$(HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\AcroRd32.exe", "Path")
  • ViewerStr = ViewerStr + "\AcroRd32.exe"
  • Debug.Print "Using Reader"
  • End If
  • CheminAcrobat = ViewerStr
  • End Function
  • Private Sub Command1_Click()
  • msgbox CheminAcrobat
  • End Sub
'Exemple pour acrobat reader...

Private Declare Function RegOpenKeyEx Lib "advapi32" Alias "RegOpenKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal dwReserved As Long, ByVal samDesired As Long, phkResult As Long) As Long
Private Declare Function RegQueryValueEx Lib "advapi32" Alias "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName$, ByVal lpdwReserved As Long, lpdwType As Long, lpData As Any, lpcbData As Long) As Long
Private Declare Function RegCloseKey Lib "advapi32" (ByVal hKey As Long) As Long
Const HKEY_LOCAL_MACHINE As Long = &H80000002
'
'
'From FAQ the Acrobat Reader can be found at"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AppPaths\AcroRd32.exe"
'
'
Function RegGetString$(hInKey As Long, ByVal subkey$, ByVal valname$)
Dim RetVal$, hSubKey As Long, dwType As Long, SZ As Long
Dim R As Long
RetVal$ = ""
Const KEY_ALL_ACCESS As Long = &H3F
Const ERROR_SUCCESS As Long = 0
Const REG_SZ As Long = 1
R = RegOpenKeyEx(hInKey, subkey$, 0, KEY_ALL_ACCESS, hSubKey)
If R <> ERROR_SUCCESS Then GoTo Quit_Now
SZ = 256: v$ = String$(SZ, 0)

R = RegQueryValueEx(hSubKey, valname$, 0, dwType, ByVal v$, SZ)
If R = ERROR_SUCCESS And dwType = REG_SZ Then
SZ = SZ - 1
RetVal$ = Left$(v$, SZ)
Else
RetVal$ = "--Not String--"
End If
If hInKey = 0 Then R = RegCloseKey(hSubKey)
Quit_Now:
RegGetString$ = RetVal$
End Function

Function CheminAcrobat() As String
Dim ViewerStr As String
ViewerStr = RegGetString$(HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows\CurrentVersion\AppPaths\Acrobat.exe", "Path")
If ViewerStr <> "" Then
ViewerStr = ViewerStr + "\Acrobat.exe"
Debug.Print "Using Acrobat"
Else
' Acrobat is not installed
ViewerStr = RegGetString$(HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\AcroRd32.exe", "Path")
ViewerStr = ViewerStr + "\AcroRd32.exe"
Debug.Print "Using Reader"
End If
CheminAcrobat = ViewerStr
End Function

Private Sub Command1_Click()
msgbox  CheminAcrobat
End Sub



 Sources de la même categorie

Source avec Zip Source avec une capture Source .NET (Dotnet) SHELLVIEW EN VB.NET par Le Pivert
Source avec Zip Source avec une capture Source .NET (Dotnet) AJOUTER OU SUPPRIMER MENU CONTEXTUEL D'APPLICATION PAR CLIC ... par Le Pivert
Source avec Zip Source avec une capture Source .NET (Dotnet) MODIFIER IMAGE COULEUR EN NOIR ET BLANC PAR CLIC DROIT par Le Pivert
Source avec Zip Source avec une capture Source .NET (Dotnet) RENOMMER TOUS LES FICHIERS D'UN DOSSIER PAR CLIC DROIT par Le Pivert
Source avec Zip Source avec une capture Source .NET (Dotnet) REDIMENSIONNER ET IMPRIMER FORMAT PHOTO (10X15) par Le Pivert

Commentaires et avis

Commentaire de laestrella le 24/06/2003 14:47:08

c'est bien joli tout ça mais dans un zip cela serait encore mieux!!!
C'est le plus à apporter.

Commentaire de emap le 24/06/2003 16:29:25

ben copier-coller c'est pas mal non ?

Commentaire de laestrella le 24/06/2003 18:02:32

oui mais pour archiver c'est plus rapide quand on prend plein de codes sources en même temps. Sinon oui le copier coller marche bien.

Commentaire de emap le 24/06/2003 18:04:46

oki je note pour plus tard :)

Commentaire de laestrella le 24/06/2003 18:07:51

Merci de ta coopération

Commentaire de emap le 25/06/2003 08:14:27

de nada :)

Commentaire de kao98 le 14/03/2006 10:28:05

Note importante : ce code ne fonctionne qu'avec les utilisateurs ayant les droits d'admin sur les postes NT.

 Ajouter un commentaire




Nos sponsors


Sondage...

Comparez les prix

CalendriCode

Février 2012
LMMJVSD
  12345
6789101112
13141516171819
20212223242526
272829    

Consulter la suite du CalendriCode

 
Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils.
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés

Google Coop CodeS-SourceS Google Coop CodeS-SourceS
Temps d'éxécution de la page : 1,295 sec (3)

Nous contacter | Annoncer sur CodeS-SourceS | Mentions légales