J'avais fait ce prog il y un petit bout de temps, j'ai remis les commandes nécessaire au fonctionnement du programme. Il était dans une librairie.
Si vous avez des difficultés

, ou si j'ai oublié une commande
; Gillou
; Purebasic 3.94
; Ligne de commande : L'adresse du fichier
; Arguments : %FILE
; Nom : Resident Creator
; Vous puvez ajouter un raccourci si ça vous chante
ProcedureDLL.s GetPBPath() ; Retourne le dossier d'installation de PureBasic
path.s = "Applications\PureBasic.exe\shell\open\command"
If RegOpenKeyEx_ ( #HKEY_CLASSES_ROOT , path, 0, #KEY_ALL_ACCESS , @Key) = #ERROR_SUCCESS
indir.s = Space (500)
insize = 500
If RegQueryValueEx_ (Key, "" , 0, 0, @indir.s, @insize) = #ERROR_SUCCESS
RegCloseKey_ (Key)
indir = RemoveString (indir, "%1" , 1)
indir = RemoveString (indir, Chr (34), 1)
indir = RTrim (indir)
path = GetPathPart (indir)
Else
RegCloseKey_ (Key)
ProcedureReturn ""
EndIf
EndIf
If Path
ProcedureReturn Path
EndIf
EndProcedure
ProcedureDLL.s ProgramParameterA() ; Retourne tout le texte en paramètre
Repeat
m$ = ProgramParameter ()
If m$ And ma$ : ma$ = ma$ + " " + m$ : ElseIf m$ And ma$= "" : ma$ = m$ : EndIf
Until m$ = ""
ProcedureReturn ma$
EndProcedure
ProcedureDLL ListWind() ; Retourne le nombre de fenêtres actuellement active
Structure TH
txt.s
hwnd.s
EndStructure
Global listwins
If listwins=0 : NewList wind.th() : listwins=1 : Else : ClearList (wind()) : EndIf
hWnd.l = FindWindow_ ( 0, 0 )
While hWnd <> 0
If GetWindowLong_ (Hwnd, #GWL_STYLE ) & #WS_VISIBLE = #WS_VISIBLE ; pour lister que les fenêtres visibles
If GetWindowLong_ (Hwnd, #GWL_EXSTYLE ) & #WS_EX_TOOLWINDOW <> #WS_EX_TOOLWINDOW ; pour lister que les fenêtres qui ne sont pas des ToolWindow ou barre d'outils
txt.s = Space (256)
GetWindowText_ (hwnd, txt, 256)
If txt <> ""
AddElement (wind()) : wind()\txt=txt : wind()\hwnd= Str (hwnd)
EndIf
EndIf
EndIf
hWnd = GetWindow_ (hWnd, #GW_HWNDNEXT )
Wend
ProcedureReturn CountList (wind())
EndProcedure
ProcedureDLL.s SelectWind(Number, Option) ; Retourne le titre de la fenêtre sélectionnée (Number doit être compris entre 0 et ListWindows()-1)
If listwins=1
If CountList (wind())>0
If number=<CountList(wind())-1
SelectElement (wind(),number)
If option=1
ProcedureReturn wind()\txt
Else
ProcedureReturn wind()\hwnd
EndIf
EndIf
EndIf
EndIf
EndProcedure
ProcedureDLL.s GetFilePartWithoutExt(File.s) ; Retourne le nom du fichier sans l'extension
File.s = GetFilePart (File.s)
If Len ( GetExtensionPart (File.s)) <> 0
ProcedureReturn Left (File.s, Len (File.s) - Len ( GetExtensionPart (File.s)) - 1)
EndIf
ProcedureReturn File.s
EndProcedure
ProcedureDLL RestartCompiler2()
#PB_MSG_RESTART_COMPILER = 10174
n=ListWind()
For a=1 To n-1
WText$=SelectWind(a,1)
If Left (WText$, 12)= "PureBasic - "
If WText$<> "PureBasic - Visionneuse de fichiers" And WText$<> "PureBasic - File Viewer" And WText$<> "PureBasic - Dateibetrachter"
hPBIDE = Val (SelectWind(a,0))
EndIf
EndIf
Next
ProcedureReturn PostMessage_ (hPBIDE, RegisterWindowMessage_ ( "PB_MSG_ID" ), #PB_MSG_RESTART_COMPILER , 0)
EndProcedure
file$ = ProgramParameterA()
If GetExtensionPart ( UCase (file$)) = "PB"
Compiler$ = GetPBPath()+ "Compilers\PBCompiler.exe"
Resident$ = GetPBPath()+ "Residents\" +GetFilePartWithoutExtension(file$)+ ".res"
res$=ExecuteProgram(Compiler$, "/RESIDENT " + #Q +Resident$+ #Q + " " + #Q +file$+ #Q ,1)
n= CountString (res$, #CRLF$ )
Repeat
in=in+1
l$=MidField(res$,in, #CRLF$ )
If FindString ( UCase (l$), "ERROR" ,0)=1
Error$=l$
EndIf
If FindString ( UCase (l$), "CREATED" ,0)
Creer=1
EndIf
Until in=n+1
RestartCompiler()
LE = GetLastError()
If LE=109 : LE=0 : EndIf
If IsFileExist(Resident$) And Creer=1 And error$= "" And LE=0
MSGP( "ResCreator" , "Le resident '" +GetFilePartWithoutExt(file$)+ ".res" + "' a été créé." + #CRLF$ + #CRLF$ + "Dossier de destination : " + GetPathPart (resident$)+ #CRLF$ + #CRLF$ + "Taille : " + Str ( FileSize (Resident$))+ " Octets" , 0,4)
Else
res=MSGP( "ResCreator" , error$+ #CRLF$ + #CRLF$ + "Code : " + Str (LE)+ #CRLF$ + #CRLF$ +GetLastErrorAsText(LE)+ #CRLF$ + #CRLF$ + "Voulez-vous supprimer le résident créé et relancer le compilateur?" ,4,3)
If res=6
DeleteFile (Resident$)
RestartCompiler2()
EndIf
EndIf
EndIf