Page 1 sur 1

Dossier d'installation de purebasic

Publié : jeu. 29/janv./2004 10:18
par Le Soldat Inconnu
Un petit code de Fred

Code : Tout sélectionner

Procedure.s GetPB_DirectoryInstallation()
  
  Buffer$ = Space(10000) : BufferSize = Len(Buffer$) - 1
  
  ; Windows NT/XP
  If GetVersion_() & $ff0000
     If RegOpenKeyEx_(#HKEY_CLASSES_ROOT, "Applications\PureBasic.exe\shell\open\command", 0, #KEY_ALL_ACCESS, @Key) = #ERROR_SUCCESS
        If RegQueryValueEx_(Key, "", 0, @Type, @Buffer$, @BufferSize) = #ERROR_SUCCESS
           OutputDirectory$ = GetPathPart(Mid(Buffer$, 2, Len(Buffer$) - 7))
        EndIf
     EndIf
  Else ; The same for Win9x
     If RegOpenKeyEx_(#HKEY_LOCAL_MACHINE, "Software\Classes\PureBasic.exe\shell\open\command", 0, #KEY_ALL_ACCESS, @Key) = #ERROR_SUCCESS
        If RegQueryValueEx_(Key, "", 0, @Type, @Buffer$, @BufferSize) = #ERROR_SUCCESS
           OutputDirectory$ = GetPathPart(Mid(Buffer$, 2, Len(Buffer$) - 7))
        EndIf
     EndIf
  EndIf
  
  ProcedureReturn OutputDirectory$
EndProcedure


Debug GetPB_DirectoryInstallation()