Accueil > > > 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
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
Commentaires et avis
|
Derniers Blogs
[FRAMEWORK 4] LES TASKS ET LE THREAD UI[FRAMEWORK 4] LES TASKS ET LE THREAD UI par fathi
Je viens de passer quelques temps au TechDay's et j'ai pu voir pas mal de session intéressante. Par contre une chose m'a un peu étonné lors de certaines de ces sessions qui abordaient les améliorations du framework .NET (donc le 4.5) : en gros, bea...
Cliquez pour lire la suite de l'article par fathi WORKFLOW FOUNDATION 3 A UN PIED DANS LA TOMBEWORKFLOW FOUNDATION 3 A UN PIED DANS LA TOMBE par JeremyJeanson
Depuis déjà un an, je conseille vivement les utilisateurs de Workflow Foundation 3 à migrer vers la version 4. L'information qui va suivre ne devrait donc pas trop prendre au dépourvu les personnes qui m'ont suivi. Je profite de ce poste, pour faire le re...
Cliquez pour lire la suite de l'article par JeremyJeanson TECHDAYS PARIS 2012 : NOUVELLES TENDANCES DU POSTE DE TRAVAIL - BRING YOUR OWN PCTECHDAYS PARIS 2012 : NOUVELLES TENDANCES DU POSTE DE TRAVAIL - BRING YOUR OWN PC par ROMELARD Fabrice
Speakers: Thierry Rapatout, Antoine Petit et Xavier Trebbia Cette session entre dans le cadre des RDV Décideurs des TechDays 2012, elle est liée à la consumérisation de l'IT et la mise en place du "DeskTop as a Service" dans de plus en ...
Cliquez pour lire la suite de l'article par ROMELARD Fabrice TECHDAYS PARIS 2012 : SYSTEM CENTER SERVICE MANAGER 2012 VUE D'ENSEMBLETECHDAYS PARIS 2012 : SYSTEM CENTER SERVICE MANAGER 2012 VUE D'ENSEMBLE par ROMELARD Fabrice
Speakers: Julien Marechal, Gautier Confiant, Sébastien MEYER La session débute par le positionnement de la solution System Center par rapport aux concepts d'organisation ITIL. Le portail du catalogue de se...
Cliquez pour lire la suite de l'article par ROMELARD Fabrice TECHDAYS PARIS 2012 : PLEINIèRE SECOND JOURTECHDAYS PARIS 2012 : PLEINIèRE SECOND JOUR par ROMELARD Fabrice
Après une première journée dédiée aux développeurs, cette seconde journée est dédiée au monde des entreprises et de ses applications. Ainsi, cette pleinière est dédiée à faire un 360 de l'évolution des applications Business aux demandes ac...
Cliquez pour lire la suite de l'article par ROMELARD Fabrice
Forum
VB6 + GRAPHVIZVB6 + GRAPHVIZ par nouirayosra
Cliquez pour lire la suite par nouirayosra
Logiciels
Academy System (17.2.1.0)ACADEMY SYSTEM (17.2.1.0)Logiciel de gestion des établissements.
- élèves/étudiants (inscription, dossier, absence...)
-... Cliquez pour télécharger Academy System Easy-Planning (1.0.0.1)EASY-PLANNING (1.0.0.1)Basé sur les mêmes principes que MyPlanning, Easy-Planning permet de créer des plannings sous la ... Cliquez pour télécharger Easy-Planning COLLECTOR PLUS (3.00B)COLLECTOR PLUS (3.00B)COLLECTOR PLUS version 3.00B est un logiciel utilisant une base de données alimentée par :
- L... Cliquez pour télécharger COLLECTOR PLUS PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO (V7.4)PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO (V7.4)PONAMEDIA TV DEVIENS HELLLOOO FLASH
LA TV SUR VOTRE ORDINATEUR.
Toute une plateforme Multi... Cliquez pour télécharger PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO LettresFaciles 2011 (8.0.0.1)LETTRESFACILES 2011 (8.0.0.1)LettresFaciles est un logiciel facilitant la création et la rédaction de lettres types.
Son inte... Cliquez pour télécharger LettresFaciles 2011
|