Salut,
Une piste.
Tu peux examiner le registre (cherche base de registre dans le forum) et regarder dans cette clé :
Code : Tout sélectionner
HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice
La tu regardes la chaine :
ProgId et tu vois le nom du navigateur.
Voilà un exemple, (code bdr extrait de la droopy libs je pense).
Je ne cherche que le mot firefox car c'est mon navigateur par defaut, mais je suppose que tu trouveras aussi chrome, IE... J'ai pas plus cherché que ça
Code : Tout sélectionner
#LIBRARY_VERSION="5.42.002"
#KEY_WOW64_64KEY=$100
#KEY_WOW64_32KEY=$200
Declare IsWow64Process()
Declare Wow64DisableWow64FsRedirection()
Declare Wow64RevertWow64FsRedirection()
Declare RegMode(Ex,Wow64)
Declare.s RegGetValue(Key.s, ValueName.s, ComputerName.s)
;&&&1 IsWow64Process
Procedure IsWow64Process() ;+++
;/// Determines whether the specified process is running under WOW64.
;/// Return TRUE if the process is running under WOW64.
;/// Return FALSE if the process is running under 32-bit Windows or if the process is a 64-bit application running under 64-bit Windows
Lid = OpenLibrary(#PB_Any, "kernel32")
If Lid
CallFunction(Lid,"IsWow64Process",GetCurrentProcess_(),@ret)
CloseLibrary(Lid)
ProcedureReturn ret
EndIf
EndProcedure
;&&&1 Wow64DisableWow64FsRedirection
Procedure Wow64DisableWow64FsRedirection() ;+++
;/// Disables file system redirection for the calling thread. File system redirection is enabled by default
;/// If the function succeeds, the return value is a nonzero value.
;/// If the function fails, the Return value is zero.
;/// Use RegMode() for accessing 64-bit key
Shared Wow64OldValue
If IsWow64Process()
Lid=OpenLibrary(#PB_Any, "kernel32.dll")
If Lid
GetFunction(Lid,"Wow64DisableWow64FsRedirection")
ret=CallFunction(Lid,"Wow64DisableWow64FsRedirection",@Wow64OldValue)
CloseLibrary(Lid)
ProcedureReturn ret
Else
Debug "Unable to Open kernel32.dll"
ProcedureReturn #False
EndIf
EndIf
EndProcedure
;&&&1 Wow64RevertWow64FsRedirection
Procedure Wow64RevertWow64FsRedirection() ;+++
;/// Restores file system redirection for the calling thread
;/// If the function succeeds, the return value is a nonzero value.
;/// If the function fails, the Return value is zero.
Shared Wow64OldValue
If IsWow64Process()
Lid=OpenLibrary(#PB_Any,"kernel32.dll")
If Lid
ret=CallFunction(Lid,"Wow64RevertWow64FsRedirection",@Wow64OldValue)
CloseLibrary(Lid)
ProcedureReturn ret
EndIf
EndIf
EndProcedure
Enumeration
#KEY_WOW64_64KEY=$100 ;//Resident
#KEY_WOW64_32KEY=$200 ;//Resident
EndEnumeration
Procedure RegMode(Ex,Wow64) ;+++
;/// Set Registry access mode<br>
;/// <b>Ex</b> Use Extended Registry Functions
;/// #False (Default) use old Registry functions
;/// #True : Use 'New' Registry Functions (Some key cannot be viewed as simple user)<br>
;/// <b>Wow64</b> Access an Alternate Registry View
;/// By default, a 32-bit application running on WOW64 accesses the 32-bit registry view and a 64-bit application accesses the 64-bit registry view.
;/// The following flags enable 32-bit applications to access redirected keys in the 64-bit registry view and 64-bit applications to access redirected keys in the 32-bit registry view.
;/// These flags have no effect on shared registry keys.
;/// <b>#KEY_WOW64_64KEY</b> Access a 64-bit key from either a 32-bit or 64-bit application. (RegEx(#True) required)
;/// <b>#KEY_WOW64_32KEY</b> Access a 32-bit key from either a 32-bit or 64-bit application.
;/// <br><A href="http://msdn.microsoft.com/en-us/library/aa384253(v=VS.85).aspx">Registry Keys Affected by WOW64</A>
Shared RegWow64.l,RegEx.l
RegEx=Ex
RegWow64=Wow64
EndProcedure
Procedure RegConvertRegKeyToTopKeyAndKeyName(Key.s) ; internl function
Shared topKey,KeyName.s
temp.s=StringField(Key,1,"\")
temp=UCase(temp)
Select temp
Case "HKEY_CLASSES_ROOT"
topKey=#HKEY_CLASSES_ROOT
Case "HKEY_CURRENT_USER"
topKey=#HKEY_CURRENT_USER
Case "HKEY_LOCAL_MACHINE"
topKey=#HKEY_LOCAL_MACHINE
Case "HKEY_USERS"
topKey=#HKEY_USERS
Case "HKEY_CURRENT_CONFIG"
topKey=#HKEY_CURRENT_CONFIG
EndSelect
PositionSlash=FindString(Key,"\",1)
KeyName.s=Right(Key,(Len(Key)-PositionSlash))
EndProcedure
;&&&1 RegGetValue
Procedure.s RegGetValue(Key.s, ValueName.s, ComputerName.s) ;+++
;/// Gets a Value
;/// This function can only read #REG_SZ #REG_DWORD #REG_BINARY #REG_EXPAND_SZ types
;/// The #REG_BINARY type returns the value as a hex number
;/// Returns the value of the Key / Empty String if Value Name doesn't exist
Shared RegWow64.l,RegEx,topKey,KeyName.s
RegConvertRegKeyToTopKeyAndKeyName(Key)
If ComputerName = "."
If RegEx
GetHandle = RegOpenKeyEx_(topKey,KeyName,0,#KEY_ALL_ACCESS|RegWow64,@hKey)
Else
GetHandle = RegOpenKey_(topKey,KeyName,@hKey)
EndIf
Else
lReturnCode = RegConnectRegistry_(ComputerName, topKey, @lhRemoteRegistry)
If RegEx
GetHandle = RegOpenKeyEx_(lhRemoteRegistry,KeyName,0,#KEY_ALL_ACCESS|RegWow64,@hKey)
Else
GetHandle = RegOpenKey_(lhRemoteRegistry,KeyName,@hKey)
EndIf
EndIf
If GetHandle = #ERROR_SUCCESS
lpcbData = 1024
lpData.s = Space(lpcbData)
GetHandle = RegQueryValueEx_(hKey, ValueName, 0, @Type, @lpData, @lpcbData)
If GetHandle = #ERROR_SUCCESS
Select Type
Case #REG_SZ
GetHandle = RegQueryValueEx_(hKey, ValueName, 0, @Type, @lpData, @lpcbData)
If GetHandle = 0
GetValue.s = Left(lpData, lpcbData - 1)
Else
GetValue = ""
EndIf
Case #REG_EXPAND_SZ
GetHandle = RegQueryValueEx_(hKey, ValueName, 0, @Type, @lpData, @lpcbData)
If GetHandle = 0
GetValue = Left(lpData, lpcbData - 1)
Else
GetValue = ""
EndIf
Case #REG_DWORD
GetHandle = RegQueryValueEx_(hKey, ValueName, 0, @lpType, @lpDataDWORD, @lpcbData)
If GetHandle = 0
GetValue = Str(lpDataDWORD)
Else
GetValue = "0"
EndIf
Case #REG_BINARY
BinaryBytes=1024
*RegBinary=AllocateMemory(BinaryBytes)
GetHandle = RegQueryValueEx_(hKey, ValueName, 0, @lType, *RegBinary, @BinaryBytes)
If GetHandle = 0 ; SUCCESs
GetValue=""
For i = 0 To (BinaryBytes-1 )
Temp3=PeekB(*RegBinary+i)&$000000FF
If Temp3<16 : GetValue+"0" : EndIf
GetValue+ Hex(Temp3)
Next
FreeMemory(*RegBinary)
EndIf
EndSelect
EndIf
EndIf
RegCloseKey_(hKey)
ProcedureReturn GetValue
EndProcedure
Global key$ = "HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice\"
Catch.s = RegGetValue(Key$, "ProgId", ".")
If FindString(catch,"Firefox")
Debug "Le navigateur par defaut est Firefox"
;ElseIf ....
EndIf