Why can't I start Purebasic with RunProgram()?
Posted: Mon Sep 18, 2023 8:22 am
I used to be able to launch Purebasic by clicking on a button, but since version 6.03 this no longer works.
What should I do to get it working again?
What should I do to get it working again?
Code: Select all
;Mes Applis Btn RBUTTON
;{ Fichiers inclus
XIncludeFile "D:\Programmation\Prg Perso\B\Boutons\RButton\RButton.pb"
XIncludeFile #PB_Compiler_FilePath + "Donnees mes applis.pb"
;}
;{ Enumérations
Enumeration Fenetre
#Fenetre_principale
EndEnumeration
Enumeration Gadgets
#Btn_0
EndEnumeration
;}
;{ Structure
Structure Donnee
Titre.s
Adresse.s
Icone.s
EndStructure
;}
;{ Variables
Global.s Rep$ = GetPathPart(ProgramFilename()) : SetCurrentDirectory(Rep$)
Global.Donnee NewList Donnee()
Global.i X, Y, i, Quitter, Evenement, Couleur
Global.i LigBtns = 5, ColBtns = 24, HtBtn = 15*2, LgBtn = 150*2
Global.i Nb_par_Colonne = HtBtn * ColBtns, Lfen = LgBtn * LigBtns
Global NomPolice.s = "Calibri", TaillePolice = 10*1.4
;}
Procedure r(i, j)
ProcedureReturn Random(i, j)
EndProcedure
Procedure ps(f, p)
SetSoundFrequency(0, f)
SoundPan(0, p)
PlaySound(0)
EndProcedure
InitSound()
CatchSound(0, ?Son)
SoundVolume(0, 30)
Procedure Initialisation()
Protected.s Titre, Adresse, Icone
Restore Donnees
i = 0
While Titre <> "999" And Adresse <> "999"
Read.s Titre
Read.s Adresse
Read.s Icone
AddElement(Donnee())
Donnee()\Titre = Titre
Donnee()\Adresse = Adresse
i + 1
Wend
DeleteElement(Donnee())
SortStructuredList(Donnee(), #PB_Sort_Ascending, OffsetOf(Donnee\Titre),#PB_String)
i - 1
Debug i
Global.i NbBtn = ListSize(Donnee()) - 1
Global Dim Tableau.s(1, NbBtn)
i = 0
ForEach Donnee()
If Left(Donnee()\Titre, 1) = "0" Or Left(Donnee()\Titre, 1) = "1"
Donnee()\Titre = Right(Donnee()\Titre, Len(Donnee()\Titre) - 3)
EndIf
Tableau(0,i) = Donnee()\Titre
Tableau(1,i) = Donnee()\Adresse
i+1
Next
EndProcedure
Procedure Programme_principal()
If OpenWindow(#Fenetre_principale, 0, 0, Lfen + 20, Nb_par_Colonne + 20,
"Mes Applications © Micoute 15/08/2022",
#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_TitleBar)
SetWindowColor(#Fenetre_principale, $DECFF2)
SetWindowLong_(WindowID(#Fenetre_principale), #GWL_EXSTYLE, GetWindowLong_(WindowID(#Fenetre_principale), #GWL_EXSTYLE) | $00080000) ; #WS_EX_LAYERED = $00080000
SetLayeredWindowAttributes_(WindowID(#Fenetre_principale), 0, 250, 2)
Police = LoadFont(#PB_Any, NomPolice, TaillePolice, #PB_Font_Bold)
SetGadgetFont(#PB_Default, FontID(Police)) ;Affecter la Police à tous les gadgets
;Créons nos boutons
For i = 0 To NbBtn
Couleur = RGB(Random(255,127),Random(255,127),Random(255,127)) ;Création de la couleur du bouton i
Y = Mod(i * HtBtn, Nb_par_Colonne) ;Position de la ligne du bouton i
X = (i * HtBtn) / (Nb_par_Colonne) ;Position de la colonne du bouton i
RBUTTON(i, Tableau(0, i), 10+X*LgBtn, 10+Y, LgBtn, HtBtn, FontID(Police), 0, Couleur, HtBtn/2)
Next
EndIf
EndProcedure
Initialisation()
Programme_principal()
;{- Boucle d'évènements
Quitter.i = #False
Repeat
Evenement = WaitWindowEvent()
If Evenement = #PB_Event_Gadget
For i = 0 To ListSize(Donnee())
If EventType() = #PB_EventType_LeftClick
If EventGadget() = i
PlaySound(0)
RunProgram(Tableau(1, i))
EndIf
EndIf
Next
EndIf
Until Quitter = #True
End
;}
;{ Données
DataSection
son:
IncludeBinary "D:\Programmation\Prg Perso\S\Sons\Bruits\Clic.wav"
FinSon:
EndDataSection
;}