Programme qui se freeze après x minutes (aléatoire)
Publié : ven. 13/sept./2024 9:37
Salut,
Je voulais vous soumettre un problème que je rencontre.
J'ai fais un "screensaver". Enfin, ce n'est qu'un EXE (pas un SCR).
Après x minutes, windows passe en "veille" (ecran eteint). La zik de mon AIMP3 continue; ce que est normal et c'est ce que je veux.
Apres y minutes, quand je veux reprendre la main, je secoue la souris et je retombe sur mon EXE mais celui ci est parfois freeze !
Comme si il lui fallait un :
Hors, j'utilise un OpenScreen...
A votre avis, d'où viendrait ce problème ?
Thx 
Je voulais vous soumettre un problème que je rencontre.
J'ai fais un "screensaver". Enfin, ce n'est qu'un EXE (pas un SCR).
Après x minutes, windows passe en "veille" (ecran eteint). La zik de mon AIMP3 continue; ce que est normal et c'est ce que je veux.
Apres y minutes, quand je veux reprendre la main, je secoue la souris et je retombe sur mon EXE mais celui ci est parfois freeze !
Comme si il lui fallait un :
Code : Tout sélectionner
While WindowEvent():Wend ;<<-----------------------------
A votre avis, d'où viendrait ce problème ?
Code : Tout sélectionner
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Les horloges de SPH ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; Code : SPH(2022) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;é
InitSprite()
InitMouse()
InitKeyboard()
;SetPriorityClass_ ( GetCurrentProcess_ (), #IDLE_PRIORITY_CLASS )
ExamineDesktops()
dw.w=DesktopWidth(0)
dh.w=DesktopHeight(0)
do.b=DesktopDepth(0)
OpenScreen(dw,dh,do,"Les horloges de SPH")
xx=dw/2
yy=dh/2
pis.f=ATan(1)*12.1585
pim.f=ATan(1)*12.1585
pih.f=ATan(1)*2.4317
echp=yy/1.4
;echh=yy/2.4
echm=yy/1.5
col=RGB(33,33,33)
ii.f=Random(20)/100
uu.f=Random(20)/100
ii2.f=Random(20)/100
uu2.f=Random(20)/100
;;;;;;;;;;;
sphii.f=0
sphuu.f=0
sphii2.f=0
sphuu2.f=0
sphiii.f=Random(1000)/100000
sphuuu.f=Random(1000)/100000
sphiii2.f=Random(1000)/100000
sphuuu2.f=Random(1000)/100000
rayonx=dw/5
rayony=dh/6
ShowCursor_(0)
;;;;;;;;;;;
;;;;;;;;;;;
MouseLocate(xx,yy)
Repeat ; Boucle principale
xxx=Cos(ii)*45+Sin(ii2)*40
yyy=Sin(uu)*45-Cos(uu2)*40
decx.f=Cos(ii)/18+Sin(uu2)/15
ExamineMouse()
x2mouse=MouseX()
y2mouse=MouseY()
xmouse=Cos(sphii)*rayonx+Sin(sphii2)*rayonx
ymouse=Sin(sphuu)*rayony+Cos(sphuu2)*rayony
xx2021=xmouse+x2mouse
yy2021=ymouse+y2mouse
If MouseButton(#PB_MouseButton_Left)<>0
s+1:If s>=60:s-60:m+1:EndIf:If m=60:m=0:h+1:EndIf:If h=12:h=0:EndIf
Else
h=Hour(Date()):m=Minute(Date()):s=Second(Date())
EndIf
If MouseButton(#PB_MouseButton_Right)<>0
sphiii.f=Random(1000)/100000
sphuuu.f=Random(1000)/100000
sphiii2.f=Random(1000)/100000
sphuuu2.f=Random(1000)/100000
EndIf
;*****
ClearScreen(0)
StartDrawing(ScreenOutput())
;;;;;;;;;;;
ss.f=decx+s/pis
mm.f=decx+(m+s/60)/pim
hh.f=decx+(h+m/60)/pih
For i=0 To 11
For u=1 To 5
If i=0 Or i=3 Or i=6 Or i=9
co=RGB(255,255,255)
Else
co=RGB(80,80,80)
EndIf
sphx=xx2021+Sin(decx+i/pih)*(echp+xxx)+Random(6)-3 ;;;;;;;;;;;;xx
sphy=yy2021-Cos(decx+i/pih)*(echp+yyy)+Random(6)-3 ;;;;;;;;;;;;yy
If sphx<0
co=RGB(00,80,00)
sphx=(sphx*-1)/2
EndIf
If sphx>=dw
co=RGB(00,80,00)
sphx=dw-1-Abs(dw-sphx)/2
EndIf
If sphy<0
co=RGB(00,80,00)
sphy=(sphy*-1)/2
EndIf
If sphy>=dh
co=RGB(00,80,00)
sphy=dh-1-Abs(dh-sphy)/2
EndIf
Plot(sphx,sphy,co)
Next
Next
x1=Sin(mm)*(echm+xxx)
y1=-Cos(mm)*(echm+yyy)
;Line(xx,yy,x1,y1,RGB(200,200,0))
dist=Sqr(x1*x1+y1*y1)
xx1.f=x1/dist
yy1.f=y1/dist
xx2.f=xx2021;;;;;;;xx
yy2.f=yy2021;;;;;;;yy
u=0
;r=255;Random(255)
For i=0 To dist/3
co=RGB(255,255,00)
sphx=xx2-u/32+Random(u/16)
sphy=yy2-u/32+Random(u/16)
If sphx<0
co=RGB(00,80,00)
sphx=(sphx*-1)/2
EndIf
If sphx>=dw
co=RGB(00,80,00)
sphx=dw-1-Abs(dw-sphx)/2
EndIf
If sphy<0
co=RGB(00,80,00)
sphy=(sphy*-1)/2
EndIf
If sphy>=dh
co=RGB(00,80,00)
sphy=dh-1-Abs(dh-sphy)/2
EndIf
Plot(sphx,sphy,co)
xx2+xx1
yy2+yy1
u+2
Next
;r=255;Random(255)
For i=0 To dist/2
co=RGB(255,255,00)
u-1
sphx=xx2-u/32+Random(u/16)
sphy=yy2-u/32+Random(u/16)
If sphx<0
co=RGB(00,80,00)
sphx=(sphx*-1)/2
EndIf
If sphx>=dw
co=RGB(00,80,00)
sphx=dw-1-Abs(dw-sphx)/2
EndIf
If sphy<0
co=RGB(00,80,00)
sphy=(sphy*-1)/2
EndIf
If sphy>=dh
co=RGB(00,80,00)
sphy=dh-1-Abs(dh-sphy)/2
EndIf
Plot(sphx,sphy,co)
xx2+xx1
yy2+yy1
Next
x1=Sin(hh)*(echm+xxx)
y1=-Cos(hh)*(echm+yyy)
dist=Sqr(x1*x1+y1*y1)
xx1.f=x1/dist
yy1.f=y1/dist
xx2.f=xx2021;;;;;;;xx
yy2.f=yy2021;;;;;;;yy
u=0
;r=255;Random(255)
For i=0 To dist/8
co=RGB(255,20,86)
sphx=xx2-u/8+Random(u/4)
sphy=yy2-u/8+Random(u/4)
If sphx<0
co=RGB(00,80,00)
sphx=(sphx*-1)/2
EndIf
If sphx>=dw
co=RGB(00,80,00)
sphx=dw-1-Abs(dw-sphx)/2
EndIf
If sphy<0
co=RGB(00,80,00)
sphy=(sphy*-1)/2
EndIf
If sphy>=dh
co=RGB(00,80,00)
sphy=dh-1-Abs(dh-sphy)/2
EndIf
Plot(sphx,sphy,co)
xx2+xx1
yy2+yy1
u+2
Next
r=255;Random(255)
For i=0 To dist/4
u-1
co=RGB(255,20,86)
sphx=xx2-u/8+Random(u/4)
sphy=yy2-u/8+Random(u/4)
If sphx<0
co=RGB(00,80,00)
sphx=(sphx*-1)/2
EndIf
If sphx>=dw
co=RGB(00,80,00)
sphx=dw-1-Abs(dw-sphx)/2
EndIf
If sphy<0
co=RGB(00,80,00)
sphy=(sphy*-1)/2
EndIf
If sphy>=dh
co=RGB(00,80,00)
sphy=dh-1-Abs(dh-sphy)/2
EndIf
Plot(sphx,sphy,co)
xx2+xx1
yy2+yy1
Next
x1=Sin(ss)*(echm+xxx)
y1=-Cos(ss)*(echm+yyy)
dist=Sqr(x1*x1+y1*y1)
xx1.f=x1/dist
yy1.f=y1/dist
xx2.f=xx2021-2;;;;;;;xx-2
yy2.f=yy2021-2;;;;;;;yy-2
For i=0 To dist
If Random(2)=1
co=RGB(86,20,255)
sphx=xx2+Random(4)
sphy=yy2+Random(4)
If sphx<0
co=RGB(00,80,00)
sphx=(sphx*-1)/2
EndIf
If sphx>=dw
co=RGB(00,80,00)
sphx=dw-1-Abs(dw-sphx)/2
EndIf
If sphy<0
co=RGB(00,80,00)
sphy=(sphy*-1)/2
EndIf
If sphy>=dh
co=RGB(00,80,00)
sphy=dh-1-Abs(dh-sphy)/2
EndIf
Plot(sphx,sphy,co)
EndIf
xx2+xx1
yy2+yy1
Next
ii+0.007
uu+0.0059
ii2+0.0043
uu2+0.0031
sphii.f+sphiii.f
sphuu.f+sphuuu.f
sphii2.f+sphiii2.f
sphuu2.f+sphuuu2.f
;;;;;;;;;;;
StopDrawing()
;*****
FlipBuffers()
Delay(1)
ExamineKeyboard()
Until KeyboardPushed(#PB_Key_All)
ShowCursor_(1)
End
