Petit problème avec une dll

Sujets variés concernant le développement en PureBasic
Avatar de l’utilisateur
Chris
Messages : 3731
Inscription : sam. 24/janv./2004 14:54
Contact :

Petit problème avec une dll

Message par Chris »

J'ai un petit bug avec une dll que j'ai faite pour un autre programme.

Cette dll est faite pour récupérer la date et l'heure systeme et locale au format texte.
L'affichage est mis à jour grace à un timer.

Le problème, c'est qu'au bout d'un moment, on dirait que la dll se bloque, et l'affichage ne change plus.

Je vous passe les deux codes. Celui de la Dll, et celui du timer de test.

Il n'y a rien à changer dans le code du timer, puisque le problème se produit aussi dans l'application qui utilise la dll.
Si on change la durée du timer par exemple 100 ms au lieu de 10 ms, on attend simplement plus longtemps avant qu'elle ne se bloque, ce qui me fait penser que la dll se bloque au bout d'un certain nombre d'appels. Je vais chercher de ce côté là.

Et merci, également, de ne pas me proposer de librairie utilisateur, ça ne m'intéresse pas

Si quelqu'un peut me filer un coup de main, il est le bienvenu.

Créez la dll dans un dossier, enregistrez le code du timer dans le même dossier, lancez le et attendez quelques secondes. L'affichage des valeurs se bloque.

Code de la Dll : A compiler sous le nom "Date_System.dll"

Code : Tout sélectionner

ProcedureDLL.s GetLocal_Time()
  If GetLocalTime_(@Tml.SYSTEMTIME)
    ProcedureReturn RSet(Str(Tml\wHour),2,"0")+" : "+RSet(Str(Tml\wMinute),2,"0")+" : "+RSet(Str(Tml\wSecond),2,"0")
  Else
    ProcedureReturn #Null$
  EndIf
EndProcedure

ProcedureDLL.s GetSystem_Time()
  If GetSystemTime_(@Tml.SYSTEMTIME)
    ProcedureReturn RSet(Str(Tml\wHour),2,"0")+" : "+RSet(Str(Tml\wMinute),2,"0")+" : "+RSet(Str(Tml\wSecond),2,"0")
  Else
    ProcedureReturn #Null$
  EndIf
EndProcedure

ProcedureDLL.s GetDate_Short_N()
  If GetSystemTime_(@Tml.SYSTEMTIME)
    ProcedureReturn RSet(Str(Tml\wDay),2,"0")+" / "+RSet(Str(Tml\wMonth),2,"0")+" / "+RSet(Str(Tml\wYear),4,"0")
  Else
    ProcedureReturn #Null$
  EndIf
EndProcedure

ProcedureDLL.s GetDate_Short_A()
  If GetSystemTime_(@Tml.SYSTEMTIME)
    Restore Mois
    For i = 1 To Tml\wMonth
      Read Mois$
    Next
    ProcedureReturn RSet(Str(Tml\wDay),2,"0")+" "+Mois$+" "+RSet(Str(Tml\wYear),4,"0")
  Else
    ProcedureReturn #Null$
  EndIf
EndProcedure

ProcedureDLL.s GetDate_Long_A()
  If GetSystemTime_(@Tml.SYSTEMTIME)
    Restore Mois
    For i = 1 To Tml\wMonth
      Read Mois$
    Next
    
    Restore Jour
    For i = 0 To Tml\wDayOfWeek
      Read Jour$
    Next
    
    ProcedureReturn Jour$ + " "+RSet(Str(Tml\wDay),2,"0")+" "+Mois$+" "+RSet(Str(Tml\wYear),4,"0")
  Else
    ProcedureReturn #Null$
  EndIf
EndProcedure

ProcedureDLL.s GetDate_Long_N()
  If GetSystemTime_(@Tml.SYSTEMTIME)
    Restore Mois
    For i = 1 To Tml\wMonth
      Read Mois$
    Next
    
    Restore Jour
    For i = 0 To Tml\wDayOfWeek
      Read Jour$
    Next
    
    ProcedureReturn Jour$ + " "+RSet(Str(Tml\wDay),2,"0")+" / "+RSet(Str(Tml\wMonth),2,"0")+" / "+RSet(Str(Tml\wYear),4,"0")
  Else
    ProcedureReturn #Null$
  EndIf
EndProcedure

ProcedureDLL.s GetDay_Name()
  If GetSystemTime_(@Tml.SYSTEMTIME)
    Restore Jour
    For i = 0 To Tml\wDayOfWeek
      Read Jour$
    Next
    
    ProcedureReturn Jour$
  Else
    ProcedureReturn #Null$
  EndIf
EndProcedure

ProcedureDLL.s GetMonth_Name()
  If GetSystemTime_(@Tml.SYSTEMTIME)
    Restore Mois
    For i = 1 To Tml\wMonth
      Read Mois$
    Next
    
    ProcedureReturn Mois$
  Else
    ProcedureReturn #Null$
  EndIf
EndProcedure

ProcedureDLL.s ConvertMonth_Name(M)
  If M >=1 And M <=12
    Restore Mois
    For i = 1 To M
      Read Mois$
    Next
    
    ProcedureReturn Mois$
  Else
    ProcedureReturn #Null$
  EndIf
EndProcedure

DataSection
Mois:
Data.s "Janvier","Fevrier","Mars","Avril","Mai","Juin","Juillet","Août","Septembre","Octobre","Novembre","Décembre"

Jour:
Data.s "Dimanche","Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi"
EndDataSection
Code du timer de test

Code : Tout sélectionner

; PureBasic Visual Designer v3.92 build 1460


;- Window Constants
;
Enumeration
  #Win_0
EndEnumeration

;- Gadget Constants
;
Enumeration
  #String_0
  #String_1
  #String_2
  #String_3
  #String_4
  #String_5
  #String_6
  #String_7
  #String_8
EndEnumeration

Procedure Open_Win()
  If OpenWindow(#Win_0, 396, 128, 210, 285,  #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_TitleBar , "Test")
    If CreateGadgetList(WindowID())
      StringGadget(#String_1, 10, 40, 190, 25, "")
      StringGadget(#String_0, 10, 10, 190, 25, "")
      StringGadget(#String_2, 10, 70, 190, 25, "")
      StringGadget(#String_3, 10, 100, 190, 25, "")
      StringGadget(#String_4, 10, 130, 190, 25, "")
      StringGadget(#String_5, 10, 160, 190, 25, "")
      StringGadget(#String_6, 10, 190, 190, 25, "")
      StringGadget(#String_7, 10, 220, 190, 25, "")
      StringGadget(#String_8, 10, 250, 190, 25, "")
    EndIf
  EndIf
EndProcedure

Procedure TimerProc(hwnd.l, uMsg.l, idEvent.l, dwTime.l)
  Select uMsg
    Case #WM_TIMER
      Select idEvent
        Case 1
          SetGadgetText(#String_0, PeekS(CallFunction(0,"GetLocal_Time")))
          SetGadgetText(#String_1, PeekS(CallFunction(0,"GetSystem_Time")))
          SetGadgetText(#String_2, PeekS(CallFunction(0,"GetDate_Short_N")))
          SetGadgetText(#String_3, PeekS(CallFunction(0,"GetDate_Short_A")))
          SetGadgetText(#String_4, PeekS(CallFunction(0,"GetDate_Long_N")))
          SetGadgetText(#String_5, PeekS(CallFunction(0,"GetDate_Long_A")))
          SetGadgetText(#String_6, PeekS(CallFunction(0,"GetDay_Name")))
          SetGadgetText(#String_7, PeekS(CallFunction(0,"GetMonth_Name")))
          SetGadgetText(#String_8, PeekS(CallFunction(0,"ConvertMonth_Name",6)))
      EndSelect
  EndSelect
EndProcedure

Open_Win()
If OpenLibrary(0, "Date_System.dll") = 0
  End
EndIf


SetTimer_(WindowID(#Win_0), 1, 10, @TimerProc())
Repeat
Until WindowEvent() = #PB_EventCloseWindow
End
Gillou
Messages : 373
Inscription : sam. 28/août/2004 17:35
Localisation : Bretagne, 22
Contact :

Re: Petit problème avec une dll

Message par Gillou »

C'est franchement bizarre, j'ai essayé dans tous les sens en tapant directement dans kernel32 ? ça bloque à la 558 requètes

Quand on met le code dll directement dans le code test, ça marche nickel???

A voir si il n'y a pas un problème avec les fonctions de temps?
Ou une erreur lors de la création de la dll?
Nouveau bug de Purebasic? (pas possible parlons pas de malheur)


ProcedureDLL.s GetLocal_Time()
Global v,x
v+1
If GetLocalTime_ (@Tml.SYSTEMTIME)
ProcedureReturn RSet ( Str (Tml\wHour),2, "0" )+ " : " + RSet ( Str (Tml\wMinute),2, "0" )+ " : " + RSet ( Str (Tml\wSecond),2, "0" )+ " : " + Str (v)
Else
ProcedureReturn #NULL$
EndIf
EndProcedure

ProcedureDLL.s GetSystem_Time()
x+1
If GetSystemTime_ (@Tml.SYSTEMTIME)
ProcedureReturn RSet ( Str (Tml\wHour),2, "0" )+ " : " + RSet ( Str (Tml\wMinute),2, "0" )+ " : " + RSet ( Str (Tml\wSecond),2, "0" )+ " : " + Str (x)
Else
ProcedureReturn #NULL$
EndIf
EndProcedure

ProcedureDLL.s GetDate_Short_N()
If GetSystemTime_ (@Tml.SYSTEMTIME)
ProcedureReturn RSet ( Str (Tml\wDay),2, "0" )+ " / " + RSet ( Str (Tml\wMonth),2, "0" )+ " / " + RSet ( Str (Tml\wYear),4, "0" )
Else
ProcedureReturn #NULL$
EndIf
EndProcedure

ProcedureDLL.s GetDate_Short_A()
If GetSystemTime_ (@Tml.SYSTEMTIME)
Restore Mois
For i = 1 To Tml\wMonth
Read Mois$
Next
ProcedureReturn RSet ( Str (Tml\wDay),2, "0" )+ " " +Mois$+ " " + RSet ( Str (Tml\wYear),4, "0" )
Else
ProcedureReturn #NULL$
EndIf
EndProcedure

ProcedureDLL.s GetDate_Long_A()
If GetSystemTime_ (@Tml.SYSTEMTIME)
Restore Mois
For i = 1 To Tml\wMonth
Read Mois$
Next

Restore Jour
For i = 0 To Tml\wDayOfWeek
Read Jour$
Next

ProcedureReturn Jour$ + " " + RSet ( Str (Tml\wDay),2, "0" )+ " " +Mois$+ " " + RSet ( Str (Tml\wYear),4, "0" )
Else
ProcedureReturn #NULL$
EndIf
EndProcedure

ProcedureDLL.s GetDate_Long_N()
If GetSystemTime_ (@Tml.SYSTEMTIME)
Restore Mois
For i = 1 To Tml\wMonth
Read Mois$
Next

Restore Jour
For i = 0 To Tml\wDayOfWeek
Read Jour$
Next

ProcedureReturn Jour$ + " " + RSet ( Str (Tml\wDay),2, "0" )+ " / " + RSet ( Str (Tml\wMonth),2, "0" )+ " / " + RSet ( Str (Tml\wYear),4, "0" )
Else
ProcedureReturn #NULL$
EndIf
EndProcedure

ProcedureDLL.s GetDay_Name()
If GetSystemTime_ (@Tml.SYSTEMTIME)
Restore Jour
For i = 0 To Tml\wDayOfWeek
Read Jour$
Next

ProcedureReturn Jour$
Else
ProcedureReturn #NULL$
EndIf
EndProcedure

ProcedureDLL.s GetMonth_Name()
If GetSystemTime_ (@Tml.SYSTEMTIME)
Restore Mois
For i = 1 To Tml\wMonth
Read Mois$
Next

ProcedureReturn Mois$
Else
ProcedureReturn #NULL$
EndIf
EndProcedure

ProcedureDLL.s ConvertMonth_Name(M)
If M >=1 And M <=12
Restore Mois
For i = 1 To M
Read Mois$
Next

ProcedureReturn Mois$
Else
ProcedureReturn #NULL$
EndIf
EndProcedure

DataSection
Mois:
Data.s "Janvier" , "Fevrier" , "Mars" , "Avril" , "Mai" , "Juin" , "Juillet" , "Août" , "Septembre" , "Octobre" , "Novembre" , "Décembre"

Jour:
Data.s "Dimanche" , "Lundi" , "Mardi" , "Mercredi" , "Jeudi" , "Vendredi" , "Samedi"
EndDataSection



; PureBasic Visual Designer v3.92 build 1460


;- Window Constants
;
Enumeration
#Win_0
EndEnumeration

;- Gadget Constants
;
Enumeration
#String_0
#String_1
#String_2
#String_3
#String_4
#String_5
#String_6
#String_7
#String_8
EndEnumeration

Procedure Open_Win()
If OpenWindow ( #Win_0 , 396, 128, 210, 285, #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_TitleBar , "Test" )
If CreateGadgetList ( WindowID ())
StringGadget ( #String_1 , 10, 40, 190, 25, "" )
StringGadget ( #String_0 , 10, 10, 190, 25, "" )
StringGadget ( #String_2 , 10, 70, 190, 25, "" )
StringGadget ( #String_3 , 10, 100, 190, 25, "" )
StringGadget ( #String_4 , 10, 130, 190, 25, "" )
StringGadget ( #String_5 , 10, 160, 190, 25, "" )
StringGadget ( #String_6 , 10, 190, 190, 25, "" )
StringGadget ( #String_7 , 10, 220, 190, 25, "" )
StringGadget ( #String_8 , 10, 250, 190, 25, "" )
EndIf
EndIf
EndProcedure

Procedure TimerProc(hwnd.l, uMsg.l, idEvent.l, dwTime.l)
Select uMsg
Case #WM_TIMER
Select idEvent
Case 1
SetGadgetText ( #String_0 , GetLocal_Time()) ; PeekS(CallFunction(0,"GetLocal_Time")))
SetGadgetText ( #String_1 , GetSystem_Time()) ; PeekS(CallFunction(0,"GetSystem_Time")))
SetGadgetText ( #String_2 , GetDate_Short_N()) ; PeekS(CallFunction(0,"GetDate_Short_N")))
SetGadgetText ( #String_3 , GetDate_Short_A()) ; PeekS(CallFunction(0,"GetDate_Short_A")))
SetGadgetText ( #String_4 , GetDate_Long_N()) ; PeekS(CallFunction(0,"GetDate_Long_N")))
SetGadgetText ( #String_5 , GetDate_Long_A()) ; PeekS(CallFunction(0,"GetDate_Long_A")))
SetGadgetText ( #String_6 , GetDay_Name()) ; PeekS(CallFunction(0,"GetDay_Name")))
SetGadgetText ( #String_7 , GetMonth_Name()) ; PeekS(CallFunction(0,"GetMonth_Name")))
SetGadgetText ( #String_8 , ConvertMonth_Name(6)) ; PeekS(CallFunction(0,"ConvertMonth_Name",6)))
EndSelect
EndSelect
EndProcedure

Open_Win()
; If OpenLibrary(0, "Date_System.dll") = 0
; End
; EndIf


SetTimer_ ( WindowID ( #Win_0 ), 1, 10, @TimerProc())
Repeat
Until WaitWindowEvent () = #PB_EventCloseWindow
End
Avatar de l’utilisateur
Chris
Messages : 3731
Inscription : sam. 24/janv./2004 14:54
Contact :

Message par Chris »

Oui, le test direct dans le code de la dll fonctionne sans problème. C'est ça qui m'étonne le plus.

J'ai aussi trouvé à peu près le même nombre de requêtes avant le plantage.

Faudrait que Fred passe par là et fasse un test. Parce que je suis bien emmerdé, moi, avec cette histoire :(
Gillou
Messages : 373
Inscription : sam. 28/août/2004 17:35
Localisation : Bretagne, 22
Contact :

Message par Gillou »

Tu peux vraiment pas intégrer le code dans ton exe avec un includefile ou tu te crées ta propre lib?
nico
Messages : 3702
Inscription : ven. 13/févr./2004 0:57

Message par nico »

Vu le temps processeur que ça prend, c'est peut être pas plus mal que ça s'arrête non! :lol:

Il me semblait acquis le fait que pour renvoyer une variable chaine depuis une dll, il fallait que cette variable soit globale, et dans ce cas précis je n'ai plus le bug!
Gillou
Messages : 373
Inscription : sam. 28/août/2004 17:35
Localisation : Bretagne, 22
Contact :

Message par Gillou »

Exact, j'avais oublié


Global time$

ProcedureDLL GetLocal_Time()
   If GetLocalTime_ (@Tml.SYSTEMTIME)
    time$ = RSet ( Str (Tml\wHour),2, "0" )+ " : " + RSet ( Str (Tml\wMinute),2, "0" )+ " : " + RSet ( Str (Tml\wSecond),2, "0" )+ " : "
     ProcedureReturn @time$
   EndIf
EndProcedure
Heis Spiter
Messages : 1092
Inscription : mer. 28/janv./2004 16:22
Localisation : 76
Contact :

Message par Heis Spiter »

Il n'est pas plus simple de faire ProcedureDll.s ?
Heis Spiter, webmaster du site http://www.heisspiter.net
Développeur principal et administrateur du projet Bird Chat
Parti courir au bonheur du dév. public et GPL :D
Avatar de l’utilisateur
Chris
Messages : 3731
Inscription : sam. 24/janv./2004 14:54
Contact :

Message par Chris »

@Nico
Mettre les variables retournées par les procédures en global, j'ai déjà essayé, ça ne change rien.
Et en temps processeur, ça ne prend rien du tout chez moi

@Heis
Toutes mes procédures ont le .s.
Gillou
Messages : 373
Inscription : sam. 28/août/2004 17:35
Localisation : Bretagne, 22
Contact :

Message par Gillou »

Regarde au dessus c'est ce que chris avait écrit au départ (j'espère que ce problème sera corrigée dans la v4 (+1 correction :lol: ) ;) )
Avatar de l’utilisateur
Chris
Messages : 3731
Inscription : sam. 24/janv./2004 14:54
Contact :

Message par Chris »

@nico

Avec le code que j'ai donné au départ, c'est vrai que ça bouffait du CPU. C'est la boucle des évènements qui n'était pas correcte. Je l'ai changée dans mon code après avoir posté. (J'y pensais plus :oops:)

En tout cas, c'est pas la Dll qui bouffait le CPU, puisqu'avec la boucle modifiée, je tourne entre 2 et 4%

Code : Tout sélectionner

Repeat
  Select WaitWindowEvent()
    Case #PB_EventCloseWindow : quit = 1
  EndSelect
Until quit = 1
End
hichem
Messages : 38
Inscription : dim. 04/sept./2005 16:25
Localisation : Algerie
Contact :

Message par hichem »

je ne sais pas si ca a de l'importance.
mais l'arrêt survient toujours dans un interval de temps précis à savoir
90 ms
j'ai mis 90 dans le timer et apparement ca foctionne impec.
mmmmmmmmmmm.
hichem
Messages : 38
Inscription : dim. 04/sept./2005 16:25
Localisation : Algerie
Contact :

Message par hichem »

merde ca c'est arretée désolé
mmmmmmmmmmm.
Gillou
Messages : 373
Inscription : sam. 28/août/2004 17:35
Localisation : Bretagne, 22
Contact :

Message par Gillou »

Chris, essaie ça, chez moi ça marche :D

la dll


Global time$, v

ProcedureDLL GetLocal_Time()
v+1
   If GetLocalTime_ (@Tml.SYSTEMTIME)
    time$ = RSet ( Str (Tml\wHour),2, "0" )+ " : " + RSet ( Str (Tml\wMinute),2, "0" )+ " : " + RSet ( Str (Tml\wSecond),2, "0" )+ " : " + Str (v)
     ProcedureReturn @time$
   EndIf
EndProcedure

ProcedureDLL GetSystem_Time()
   If GetSystemTime_ (@Tml.SYSTEMTIME)
    time$ = RSet ( Str (Tml\wHour),2, "0" )+ " : " + RSet ( Str (Tml\wMinute),2, "0" )+ " : " + RSet ( Str (Tml\wSecond),2, "0" )
     ProcedureReturn @Time$
   EndIf
EndProcedure

ProcedureDLL GetDate_Short_N()
   If GetSystemTime_ (@Tml.SYSTEMTIME)
    time$ = RSet ( Str (Tml\wDay),2, "0" )+ " / " + RSet ( Str (Tml\wMonth),2, "0" )+ " / " + RSet ( Str (Tml\wYear),4, "0" )
     ProcedureReturn @time$
   EndIf
EndProcedure

ProcedureDLL GetDate_Short_A()
   If GetSystemTime_ (@Tml.SYSTEMTIME)
     Restore Mois
     For i = 1 To Tml\wMonth
       Read Mois$
     Next
    time$ = RSet ( Str (Tml\wDay),2, "0" )+ " " +Mois$+ " " + RSet ( Str (Tml\wYear),4, "0" )
     ProcedureReturn @time$
   EndIf
EndProcedure

ProcedureDLL GetDate_Long_A()
   If GetSystemTime_ (@Tml.SYSTEMTIME)
     Restore Mois
     For i = 1 To Tml\wMonth
       Read Mois$
     Next
   
     Restore Jour
     For i = 0 To Tml\wDayOfWeek
       Read Jour$
     Next
   time$ = Jour$ + " " + RSet ( Str (Tml\wDay),2, "0" )+ " " +Mois$+ " " + RSet ( Str (Tml\wYear),4, "0" )
     ProcedureReturn @time$
   EndIf
EndProcedure

ProcedureDLL GetDate_Long_N()
   If GetSystemTime_ (@Tml.SYSTEMTIME)
     Restore Mois
     For i = 1 To Tml\wMonth
       Read Mois$
     Next
   
     Restore Jour
     For i = 0 To Tml\wDayOfWeek
       Read Jour$
     Next
   time$ = Jour$ + " " + RSet ( Str (Tml\wDay),2, "0" )+ " / " + RSet ( Str (Tml\wMonth),2, "0" )+ " / " + RSet ( Str (Tml\wYear),4, "0" )
     ProcedureReturn @time$
   EndIf
EndProcedure

ProcedureDLL GetDay_Name()
   If GetSystemTime_ (@Tml.SYSTEMTIME)
     Restore Jour
     For i = 0 To Tml\wDayOfWeek
       Read Jour$
     Next
   time$=Jour$
     ProcedureReturn @time$
   EndIf
EndProcedure

ProcedureDLL GetMonth_Name()
   If GetSystemTime_ (@Tml.SYSTEMTIME)
     Restore Mois
     For i = 1 To Tml\wMonth
       Read Mois$
     Next
   time$ = mois$
     ProcedureReturn @time$
   EndIf
EndProcedure

ProcedureDLL ConvertMonth_Name(M)
   If M >=1 And M <=12
     Restore Mois
     For i = 1 To M
       Read Mois$
     Next
   time$ = mois$
     ProcedureReturn @time$
   EndIf
EndProcedure

DataSection
Mois:
Data.s "Janvier" , "Fevrier" , "Mars" , "Avril" , "Mai" , "Juin" , "Juillet" , "Août" , "Septembre" , "Octobre" , "Novembre" , "Décembre"

Jour:
Data.s "Dimanche" , "Lundi" , "Mardi" , "Mercredi" , "Jeudi" , "Vendredi" , "Samedi"
EndDataSection


la source


; PureBasic Visual Designer v3.92 build 1460


;- Window Constants
;
Enumeration
   #Win_0
EndEnumeration

;- Gadget Constants
;
Enumeration
   #String_0
   #String_1
   #String_2
   #String_3
   #String_4
   #String_5
   #String_6
   #String_7
   #String_8
EndEnumeration

Procedure Open_Win()
   If OpenWindow ( #Win_0 , 396, 128, 210, 285, #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_TitleBar , "Test" )
     If CreateGadgetList ( WindowID ())
       StringGadget ( #String_1 , 10, 40, 190, 25, "" )
       StringGadget ( #String_0 , 10, 10, 190, 25, "" )
       StringGadget ( #String_2 , 10, 70, 190, 25, "" )
       StringGadget ( #String_3 , 10, 100, 190, 25, "" )
       StringGadget ( #String_4 , 10, 130, 190, 25, "" )
       StringGadget ( #String_5 , 10, 160, 190, 25, "" )
       StringGadget ( #String_6 , 10, 190, 190, 25, "" )
       StringGadget ( #String_7 , 10, 220, 190, 25, "" )
       StringGadget ( #String_8 , 10, 250, 190, 25, "" )
     EndIf
   EndIf
EndProcedure

Procedure TimerProc(hwnd.l, uMsg.l, idEvent.l, dwTime.l)
   Select uMsg
     Case #WM_TIMER
       Select idEvent
         Case 1
           SetGadgetText ( #String_0 , PeekS ( CallFunction (0, "GetLocal_Time" )))
           SetGadgetText ( #String_1 , PeekS ( CallFunction (0, "GetSystem_Time" )))
           SetGadgetText ( #String_2 , PeekS ( CallFunction (0, "GetDate_Short_N" )))
           SetGadgetText ( #String_3 , PeekS ( CallFunction (0, "GetDate_Short_A" )))
           SetGadgetText ( #String_4 , PeekS ( CallFunction (0, "GetDate_Long_N" )))
           SetGadgetText ( #String_5 , PeekS ( CallFunction (0, "GetDate_Long_A" )))
           SetGadgetText ( #String_6 , PeekS ( CallFunction (0, "GetDay_Name" )))
           SetGadgetText ( #String_7 , PeekS ( CallFunction (0, "GetMonth_Name" )))
           SetGadgetText ( #String_8 , PeekS ( CallFunction (0, "ConvertMonth_Name" ,6)))
       EndSelect
   EndSelect
EndProcedure

Open_Win()
If OpenLibrary (0, "Date_System.dll" ) = 0
   End
EndIf


SetTimer_ ( WindowID ( #Win_0 ), 1, 10, @TimerProc())
Repeat
Until WaitWindowEvent () = #PB_EventCloseWindow
End
Avatar de l’utilisateur
Chris
Messages : 3731
Inscription : sam. 24/janv./2004 14:54
Contact :

Message par Chris »

Ouais, ça à l'air de fonctionner :)

Super! Merci.

Je vais lancer le truc et tester pendant un moment pour voir si ça plante ou pas :wink:
Gillou
Messages : 373
Inscription : sam. 28/août/2004 17:35
Localisation : Bretagne, 22
Contact :

Message par Gillou »

ça fait 5 minutes que ça tourne impec :D (v=42000)
Répondre