une petite horloge Double

Vous débutez et vous avez besoin d'aide ? N'hésitez pas à poser vos questions
Backup
Messages : 14526
Inscription : lun. 26/avr./2004 0:40

une petite horloge Double

Message par Backup »

.......
Dernière modification par Backup le mar. 19/août/2014 13:06, modifié 1 fois.
SpaceMan
Messages : 290
Inscription : mar. 26/oct./2004 19:35
Contact :

Message par SpaceMan »

nice one ! :D
Avatar de l’utilisateur
venom
Messages : 3138
Inscription : jeu. 29/juil./2004 16:33
Localisation : Klyntar
Contact :

Message par venom »

salut dobro,

oui c'est bien comme idée pae contre je serais toi j'y ajouterai aussi la date car la moi je ne sais pas qui est en avance et qui et en retard :wink:
voila


@++
Windows 10 x64, PureBasic 5.73 x86 & x64
GPU : radeon HD6370M, CPU : p6200 2.13Ghz
Backup
Messages : 14526
Inscription : lun. 26/avr./2004 0:40

Message par Backup »

venom a écrit :salut dobro,

oui c'est bien comme idée pae contre je serais toi j'y ajouterai aussi la date car la moi je ne sais pas qui est en avance et qui et en retard :wink:
voila


@++
la variable "decalage=11' t'indique si c'est plus tard ou plus tot
si tu met

Code : Tout sélectionner

decalage=11
cela veut dire que le decalage sera de +11 heure

si tu met

Code : Tout sélectionner

decalage=-11
cela veut dire que le decalage sera de MOINS 11 heures


l'heure du Haut est l'heure Locale , et l'heure du bas c'est l'heure distante :D

L'heure Locale est prise sur l'heure du pc , alors que l'heure distante est calculé d'apres la variable decalage=
Avatar de l’utilisateur
kernadec
Messages : 1606
Inscription : ven. 25/avr./2008 11:14

Sorsnet

Message par kernadec »

bonjour
j'ai mis a jour le code precedent, car j'avais oublier que nessie
apres son test hr >23 <0 n'avait pas reecrit dans la gadjet 2
et je me rappellais plus de ce fait. voila c'est corriger
j'utilse ceci pour sortir du coltard pour mes rendez vous,
si ca peut rendre service
elle fonctionne a tahiti aussi !

code de nessie voilà: http://www.purebasic.fr/english/viewtop ... highlight=

Code : Tout sélectionner

;********************************** 
; kernadec 08/08 Forum fench PB460
; an alarm for an appointment
;********************************** 
;
Enumeration
  #window
  #image
  #SGadget1
  #spin  
  #hours  
  #sepa 
  #mins
  #CheckBox
  #SGadget2
EndEnumeration

FontID1=LoadFont(1, "arial", 12, #PB_Font_Bold) 
FontID2=LoadFont(2, "arial", 16, #PB_Font_Bold) 

buffer$=Space(128) 
file$="c:\windows\media\town.mid" 
mciSendString_("OPEN "+file$+" TYPE SEQUENCER ALIAS midi",buffer$,128,0) 

hr=Hour(Date()):hr$=Str(Hour(Date())) 
state=Minute(Date()):state$=Str(Minute(Date())) 

If hr=00:hr$="00":EndIf 
If state=0:state$="00":EndIf 
If hr<10:hr$="0"+Str(hr):EndIf 
If hr>9:hr$=Str(hr):EndIf 
If state<10:state$="0"+Str(state):EndIf 
If state>9:state$=Str(state):EndIf 

hwnd=OpenWindow(#window,0,0,155,25,"",#PB_Window_ScreenCentered| #PB_Window_MinimizeGadget |#PB_Window_SystemMenu) 
SendMessage_(WindowID(#window),#WM_SETICON,#False,CatchImage(#image,?clock_ico_Start)) ;icon in the title bar 

StringGadget(#SGadget1, 0, -1,49, 23,"") 
DisableGadget(#SGadget1,1) 
SpinGadget(#spin, 52, 0, 10, 24, -1, 60) 
SetGadgetState(#spin,Minute(Date()))
StringGadget(#hours, 2, 2, 19, 20, hr$, #PB_String_Numeric | #PB_String_BorderLess) 
SetGadgetFont(#hours, FontID1) 
SendMessage_(GadgetID(#hours), #EM_LIMITTEXT, 2, 0) 
StringGadget(#sepa, 23, 2, 6, 20, ":", #PB_String_BorderLess) 
SetGadgetFont(#sepa, FontID1) 
SendMessage_(GadgetID(#sepa), #EM_LIMITTEXT, 1, 0) 
StringGadget(#mins, 31, 2, 20, 20, state$, #PB_String_Numeric | #PB_String_BorderLess) 
SetGadgetFont(#mins, FontID1)
SendMessage_(GadgetID(#mins), #EM_LIMITTEXT, 2, 0) 
CheckBoxGadget(#CheckBox,64,4,15,15,"") 
StringGadget(#SGadget2, 77,0,80,22,"", #PB_String_BorderLess) 
SetGadgetFont(#SGadget2, FontID2)
SetTimer_(WindowID(#window),30,1000,0) 
StartTime = ElapsedMilliseconds()
;------------------------------------------------------------------------------
StartDrawing(WindowOutput(0)) 
SetGadgetColor(#SGadget2,#PB_Gadget_BackColor,Point(1,1)) 
SetGadgetText(#SGadget2,"Alarme") 
Repeat 
  If EventGadget()=#sepa:SetActiveGadget(#mins):EndIf 
  EventID = WaitWindowEvent() 
  If (ElapsedMilliseconds()-StartTime)> 59000
    mouse_event_(#MOUSEEVENTF_MOVE, 0, 0, 0, 0)       
    StartTime = ElapsedMilliseconds()
  EndIf
  Select EventID 
    Case #PB_Event_Gadget 
      Select EventGadget() 
        Case #mins                                     
          If EventType()=#PB_EventType_Change 
            state=Val(GetGadgetText(#mins)):SetGadgetState(#spin,state) 
          EndIf 
        Case #spin 
          hr=Val(GetGadgetText(#hours)) 
          state=GetGadgetState(#spin)
          If state=-1:state=59:SetGadgetState(#spin,59):hr=hr-1::EndIf
          If state>60:SetGadgetState(#spin,59):hr=hr-1:EndIf 
          If state=>60 And state <70 :hr=hr+1:SetGadgetState(#spin,0):state=0:EndIf 
          If state<10:SetGadgetText(#mins,"0"+Str(GetGadgetState(#spin))):EndIf 
          If state>9:SetGadgetText(#mins,Str(GetGadgetState(#spin))):EndIf 
          If hr<0 :hr=23:EndIf 
          If hr>23:hr=0:EndIf 
          SetGadgetText(#hours ,Str(hr))
          If hr<10:SetGadgetText(#hours ,"0"+Str(hr)):EndIf 
          If hr>9::EndIf 
      EndSelect 
  EndSelect 
  If GetGadgetState(#CheckBox)=1 
    If (Val(GetGadgetText(#hours))=Hour(Date()) And GetGadgetState(#spin)=Minute(Date())) 
      StickyWindow(#window, 1) 
      SetWindowState(#window,#PB_Window_Normal) 
      SetGadgetFont(#SGadget2, FontID2) 
      SetGadgetColor(#SGadget2,#PB_Gadget_FrontColor,RGB(255,0,0)) 
      SetGadgetText(#SGadget2," "+GetGadgetText(#hours)+":"+GetGadgetText(#mins))
      ;PlaySound(0,1) 
      Repeat 
        Event=WindowEvent() 
        FlashWindow_(WindowID(#window),1) 
        Delay(30) 
        FlashWindow_(WindowID(#window),0) 
        mciSendString_("PLAY MIDI",0,0,0) 
        SetWindowTitle(#window,Str(Hour(Date()))+":"+Str(Minute(Date()))+":"+Str(Second(Date()))) 
        Select Event 
          Case #SC_RESTORE    
            SetWindowState(#window,#PB_Window_Normal) 
          Case #PB_Event_CloseWindow 
            EventID=#PB_Event_CloseWindow
        EndSelect 
        If GetGadgetState(#CheckBox)=0
          SetGadgetColor(#SGadget2,#PB_Gadget_BackColor,Point(1,1))
          SetGadgetColor(#SGadget2,#PB_Gadget_FrontColor,#Black)
          mciSendString_("STOP MIDI",0,0,0)
        SetGadgetText(#SGadget2,"Alarme"):Break:EndIf
      Until Event=#PB_Event_CloseWindow 
    EndIf 
  EndIf 
  ;              display the time in the title bar 
  SetWindowTitle(#window,Str(Hour(Date()))+":"+Str(Minute(Date()))+":"+Str(Second(Date()))) 
Until EventID=#PB_Event_CloseWindow 
mciSendString_("CLOSE MIDI",0,0,0) 
StopDrawing()  
;  IncludeBinary "clock.ico" [?clock_ico_Start , ?clock_ico_End] 
;{ Size = 766 bytes 
DataSection 
  ; PureBin2Data header 
  Data.l 766 
  Data.b 0 
  ; Data 
  clock_ico_Start: 
  Data.l $00010000,$20200001,$00000010,$02E80000,$00160000,$00280000,$00200000,$00400000,$00010000,$00000004,$02800000,$00000000 
  Data.l $00000000,$00000000,$00000000,$00000000,$00800000,$00FF0000,$FFFF0000,$00000000,$800000FF,$FF000080,$808000FF,$C0C00080 
  Data.l $FFFF00C0,$000000FF,$00000000,$00000000,$00000000,$00000000,$00000000,$00000000,$00004004,$00000000,$00400400,$00000000 
  Data.l $04004407,$40444444,$00704400,$00000000,$44400400,$44444444,$00004004,$00000000,$40440000,$04000000,$00000044,$00000000 
  Data.l $08447400,$90982288,$00004704,$00000000,$89084407,$89892289,$00704480,$00000000,$28814074,$92999898,$00470429,$00000000 
  Data.l $29820844,$92999989,$00449029,$07000000,$98988840,$99999999,$70049999,$04000000,$89891240,$99999999,$40042299,$74000000 
  Data.l $99982208,$99899999,$47902299,$44000000,$99898908,$99899099,$44909999,$44000000,$99989808,$88889099,$44909988,$44000000 
  Data.l $99892901,$00000490,$44209209,$44000000,$99982801,$99899099,$44209299,$44000000,$99898908,$99899099,$44909999,$44000000 
  Data.l $99989808,$99899099,$44909999,$74000000,$89298208,$99899099,$47902299,$04000000,$99288140,$99899099,$40042199,$07000000 
  Data.l $89898844,$99899099,$70449899,$00000000,$28824844,$92999099,$00448429,$00000000,$29814474,$92998989,$00474418,$00000000 
  Data.l $88084407,$88881188,$00704480,$00000000,$08447400,$80881188,$00004744,$00000000,$40440770,$04000000,$00077044,$07000000 
  Data.l $44040050,$44444444,$70050740,$00000000,$04708085,$00444444,$00550507,$00000000,$70606658,$07000000,$00555508,$07000000 
  Data.l $50688689,$06000000,$70588866,$00000000,$85669606,$66100002,$00809668,$00000000,$50680907,$06102103,$00706099,$00000000 
  Data.l $00000700,$00000000,$00007000,$FFF80000,$60F87FFC,$00FC7F18,$00FEFF00,$00FCFF01,$00F8FF00,$00F07F00,$00F03F00,$00E03F00 
  Data.l $00E01F00,$00C01F00,$00C00F00,$00C00F00,$00C00F00,$00C00F00,$00C00F00,$00C00F00,$00C00F00,$00E00F00,$00E01F00,$00F01F00 
  Data.l $00F03F00,$00F83F00,$00FC7F00,$00F6FF00,$80E1BF01,$60E01F06,$1CE01F18,$0CE01FE0,$00F01FC0,$08F83F00,$1FFE7F40 
  Data.b $E1,$FF 
  clock_ico_End: 
EndDataSection ;} 
End
Dernière modification par kernadec le mar. 01/nov./2011 11:12, modifié 5 fois.
Avatar de l’utilisateur
Ar-S
Messages : 9540
Inscription : dim. 09/oct./2005 16:51
Contact :

Message par Ar-S »

Héhé super sympa cette petite alarme :P
Avatar de l’utilisateur
Chris
Messages : 3731
Inscription : sam. 24/janv./2004 14:54
Contact :

Message par Chris »

Si tu te bases sur l'heure de Tahiti pour aller au boulot, tu risques de passer un bon moment devant la porte, à mon avis. :lol:
Avatar de l’utilisateur
kernadec
Messages : 1606
Inscription : ven. 25/avr./2008 11:14

Message par kernadec »

bonjour
pour recuperer l'icone voilal
a partir de ce code archive écrit avant l'existence de catchimage!, comme le dit le texte allemand.
reécrit maintenant avec cette commande pour récuperer un fichier inclu en data au prg.

Code : Tout sélectionner

; German forum: http://www.purebasicforums.com/german/archive/viewtopic.php?t=431
; Author: Rings (updated for PB4.00 by blbltheworm)
; Date: 08. April 2003
; OS: Windows
; Demo: Yes

;ExPandBinary (c) 2002 by Siegfried Rings (known as  'CodeGuru' ) 
;expand files which includes via IncludeBinary 

; Zu allem Überfluss (Als es das Catch-Commando noch nicht gab) habe ich mal mein ExpandBinary hier
; beigefügt. Anstatt das Bild kann man natürlich auch eine EXE nehmen und die dann starten. 


CatchImage(0,?clock_ico_Start)

Procedure ExpandBinaryfile(Filename.s) 
  If CreateFile(1, Filename) ;Create File      
    ;Use File 1      
    L1= ?clock_ico_End-?clock_ico_Start    ;get the size of it        
    WriteData(1,?clock_ico_Start,L1) ;write it down to the file      
    CloseFile(1); Close Filepointer 
  EndIf 
  ProcedureReturn 
EndProcedure 

ExpandBinaryfile("clock.ico") 

;  IncludeBinary "clock.ico" [?clock_ico_Start , ?clock_ico_End]
;{ Size = 766 bytes
DataSection
; PureBin2Data header
Data.l 766
Data.b 0
; Data
clock_ico_Start:
Data.l $00010000,$20200001,$00000010,$02E80000,$00160000,$00280000,$00200000,$00400000,$00010000,$00000004,$02800000,$00000000
Data.l $00000000,$00000000,$00000000,$00000000,$00000000,$80000080,$80000000,$00800080,$00800000,$80800080,$C0C00000,$808000C0
Data.l $00000080,$FF0000FF,$FF000000,$00FF00FF,$00FF0000,$FFFF00FF,$FFFF0000,$000000FF,$00000000,$00000000,$00000000,$00000000
Data.l $0000B708,$00000000,$00803700,$00000000,$03700B00,$30333333,$00007003,$00000000,$30070000,$03000000,$00000070,$00000000
Data.l $07308000,$F0F7CC77,$00000803,$00000000,$7F070308,$7F7FCC7F,$00803070,$00000000,$C7743080,$FCFFF7F7,$000803CF,$00000000
Data.l $CF7C0707,$FCFFFF7F,$0030F0CF,$08000000,$F7F777B0,$FFFFFFFF,$8003FFFF,$00000000,$7F7F4C70,$FFFFFFFF,$0003CCFF,$8B000000
Data.l $FFF7CC07,$FF7FFFFF,$38F0CCFF,$07000000,$FF7F7F07,$FF7FF0FF,$30F0FFFF,$0B000000,$FFF7F707,$7777F0FF,$30F0FF77,$07000000
Data.l $FF7FCF04,$000009F0,$30C0FC0F,$0B000000,$FFF7C704,$FF7FF0FF,$30C0FCFF,$07000000,$FF7F7F07,$FF7FF0FF,$30F0FFFF,$0B000000
Data.l $FFF7F707,$FF7FF0FF,$30F0FFFF,$87000000,$7FCF7C07,$FF7FF0FF,$38F0CCFF,$00000000,$FFC774B0,$FF7FF0FF,$0003C4FF,$08000000
Data.l $7F7F7770,$FF7FF0FF,$8003F7FF,$00000000,$C77C070B,$FCFFF0FF,$003070CF,$00000000,$CF74B080,$FCFF7F7F,$00080347,$00000000
Data.l $77070B08,$77774477,$00803070,$00000000,$07B08000,$70774477,$00000803,$00000000,$700B0880,$03000000,$00088030,$08000000
Data.l $0B000030,$30B7B7BB,$80030800,$00000000,$00807073,$00000000,$00330308,$00000000,$80B0BB37,$08000000,$00333307,$08000000
Data.l $30B77B7F,$0B000000,$803777BB,$00000000,$73BBFB0B,$BB40000C,$0070FBB7,$00000000,$30B70F08,$0B40C40E,$0080B0FF,$00000000
Data.l $00000800,$00000000,$00008000,$FFF80000,$60F87FFC,$00FC7F18,$00FEFF00,$00FCFF01,$00F8FF00,$00F07F00,$00F03F00,$00E03F00
Data.l $00E01F00,$00C01F00,$00C00F00,$00C00F00,$00C00F00,$00C00F00,$00C00F00,$00C00F00,$00C00F00,$00E00F00,$00E01F00,$00F01F00
Data.l $00F03F00,$00F83F00,$00FC7F00,$00F6FF00,$80E1BF01,$60E01F06,$1CE01F18,$0CE01FE0,$00F01FC0,$08F83F00,$1FFE7F40
Data.b $E1,$FF
clock_ico_End:
EndDataSection ;}
Répondre