Faire attendre le programme

Vous débutez et vous avez besoin d'aide ? N'hésitez pas à poser vos questions
wolfjeremy
Messages : 1202
Inscription : sam. 31/déc./2005 23:52

Faire attendre le programme

Message par wolfjeremy »

Salut, je voulais savoir comment je peut faire pour que mon programme une fois executer ne se ferme pas tout de suite ? je voudrai faire pour qu'il attendre que l'utilisateur appuie sur "Esc" pour se fermer.

Merci d'avance pour votre réponse.

P.S.: le code si sa peu aider :


;-Global Variables and Constants
Global BubbleTipStyle.l:BubbleTipStyle=0
#PB_Image_BorderRaised =$1

;-Window Constants
Global Window_Form1


;-Gadget Constants
Enumeration 1
   ;Window_Form1
  Global Gadget_Form1_inter1
  Global Gadget_Form1_utilisateur
  Global Gadget_Form1_pass
  Global Gadget_Form1_info_mem
  Global Gadget_Form1_b_connex


EndEnumeration
#GadgetIndex = #PB_Compiler_EnumerationValue


;-Image Constants
Enumeration 1
  Global Image_Form1_inter1
  Global Image_Form1_b_connex


EndEnumeration
#ImageIndex = #PB_Compiler_EnumerationValue


;-Load Images
Image_Form1_inter1= CatchImage ( #PB_Any ,?_OPT_Form1_inter1)
Image_Form1_b_connex= CatchImage ( #PB_Any ,?_OPT_Form1_b_connex)


DataSection
  _OPT_Form1_inter1:IncludeBinary "Images\connexion.png"
  _OPT_Form1_b_connex:IncludeBinary "Images\b_connex.png"
EndDataSection








;--------------------
;-Language Data

#Build_Language =4

Procedure Build_Language(languagefile.s)
   Dim language.s( #Build_Language )
  flag.l=0
   If languagefile<> "" And FileSize (languagefile)>0
     If ReadFile (0,languagefile)
       For tmp=1 To #Build_Language
        language(tmp)= ReadString ()
        language(tmp)= ReplaceString (language(tmp), "|" , Chr (9))
       Next
      flag=1
       CloseFile (0)
     EndIf
   EndIf
   If flag=0
     Restore LanguageData
     For tmp=1 To #Build_Language
       Read language(tmp)
      language(tmp)= ReplaceString (language(tmp), "|" , Chr (9))
     Next
   EndIf
EndProcedure

Build_Language( "" )

DataSection
  LanguageData:
   Data.s "Work Form1"
   Data.s "Nom d'utilisateur"
   Data.s "password"
   Data.s ""
EndDataSection
Gillou
Messages : 373
Inscription : sam. 28/août/2004 17:35
Localisation : Bretagne, 22
Contact :

Message par Gillou »

Le code ci-dessus est complet?
comtois
Messages : 5186
Inscription : mer. 21/janv./2004 17:48
Contact :

Message par comtois »

je ne connais pas purevision , c'est lui qui génère ce genre de code ?

Code : Tout sélectionner

Enumeration   1
   ;Window_Form1
  Global Gadget_Form1_inter1
  Global Gadget_Form1_utilisateur
  Global Gadget_Form1_pass
  Global Gadget_Form1_info_mem
  Global Gadget_Form1_b_connex
EndEnumeration


ça me parait curieux

Enumeration c'est pour des constantes
une constante s'écrit en ajoutant un #
et c'est inutile d'ajouter global pour une constante :

Code : Tout sélectionner

Enumeration   1
   ;Window_Form1
  #Gadget_Form1_inter1
  #Gadget_Form1_utilisateur
  #Gadget_Form1_pass
  #Gadget_Form1_info_mem
  #Gadget_Form1_b_connex
EndEnumeration 
Et comme dit Gillou , tu n'as rien oublié ? il faut une boucle

Code : Tout sélectionner

Repeat
until xxx
ou

Code : Tout sélectionner

While xxx
Wend 
tu devrais tester les exemples de la doc

Code : Tout sélectionner

;
; ------------------------------------------------------------
;
;   PureBasic - Window example file
;
;    (c) 2001 - Fantaisie Software
;
; ------------------------------------------------------------
;

;
; Open a window, and do some stuff with it...
;

If OpenWindow(0, 100, 200, 195, 260, #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget, "PureBasic Window")

  MessageRequester("Information", "Click to move the Window", 0)
  MoveWindow(200,200)   ; Move the window to the coordinate 200,200
  
  MessageRequester("Information", "Click to resize the Window", 0)
  ResizeWindow(320,200) ; Resize the window to 320,200
  
  ;
  ; This is the 'event loop'. All the user actions are processed here.
  ; It's very easy to understand: when an action occurs, the EventID
  ; isn't 0 and we just have to see what have happened...
  ;

  Repeat
    EventID = WaitWindowEvent()

    If EventID = #PB_Event_CloseWindow  ; If the user has pressed on the close button
      Quit = 1
    EndIf

  Until Quit = 1
  
EndIf

End   ; All the opened windows are closed automatically by PureBasic
http://purebasic.developpez.com/
Je ne réponds à aucune question technique en PV, utilisez le forum, il est fait pour ça, et la réponse peut profiter à tous.
wolfjeremy
Messages : 1202
Inscription : sam. 31/déc./2005 23:52

Message par wolfjeremy »

Heu non en faite mon code est en deux fichier donc j'ai pas tout mis j'ai pas penser... c'est purevision qui ma fait le code...

Enfin bon je voulais juste savoir se qu'il faut mettre dans le code pour pas que le programme s'arrete tout seul lol

Nan on faite la je crois que je brule les etapes un petit peu :? vai bien aller voir les tuto que j'ai trouver un peu partout et mis mettre tout doucement...
Répondre