Message sous l'averse de neige

Vous débutez et vous avez besoin d'aide ? N'hésitez pas à poser vos questions
Avatar de l’utilisateur
kernadec
Messages : 1606
Inscription : ven. 25/avr./2008 11:14

Message sous l'averse de neige

Message par kernadec »

bonjour à tous
J'avais besoin d'une boite d'alerte avec plus de 3 options...
alors au passage, je vous envoie le ptit bonjour d'un ami fauché.

Cordialement

Code : Tout sélectionner

;####### kernadec décembre 2010 #######
Enumeration
  #WinAlert
  #image
  #image_gadget
  #button01
  #button02
  #button03
  #button04
  #button05
  #button06
EndEnumeration
Global iconselect.l


Procedure Alerte()
  
 LoadFont(5, "Curlz MT", 28,#PB_Font_Bold)
; LoadFont(5, "Forte", 27,#PB_Font_Bold)

OpenWindow(#WinAlert,0,0,270,140,"Message Requester du Père Noël", #PB_Window_ScreenCentered|#PB_Window_SystemMenu)

CreateImage(#image,WindowWidth(#WinAlert),WindowHeight(#WinAlert),32) ;|#PB_Image_Transparent
StartDrawing(ImageOutput(#image)) 

 cb=RGB(Random(255),Random(255),Random(255))
 Box(0,0,WindowWidth(#WinAlert),WindowHeight(#WinAlert),cb) 
 If iconselect=0
 SendMessage_(WindowID(#WinAlert),#WM_SETICON,#False,LoadIcon_(0,#IDI_ASTERISK))     ;IDI_ASTERISK = 32516
 DrawImage(LoadIcon_(0, #IDI_ASTERISK), 5, 5)
 PlaySound_("SystemAsterisk" ,0, #SND_ALIAS|#SND_NODEFAULT|#SND_NOWAIT|#SND_ASYNC ):EndIf
 If iconselect=1
 SendMessage_(WindowID(#WinAlert),#WM_SETICON,#False,LoadIcon_(0,#IDI_EXCLAMATION))  ;IDI_EXCLAMATION = 32515
 DrawImage(LoadIcon_(0, #IDI_EXCLAMATION), 10, 10)
 PlaySound_("SystemExclamation",0, #SND_ALIAS|#SND_NODEFAULT|#SND_NOWAIT |#SND_ASYNC ):EndIf
 If iconselect=2
 SendMessage_(WindowID(#WinAlert),#WM_SETICON,#False,LoadIcon_(0,#IDI_HAND))         ;IDI_HAND = 32513
 DrawImage(LoadIcon_(0, #IDI_HAND), 10, 10)
 PlaySound_("SystemHand" ,0, #SND_ALIAS|#SND_NODEFAULT|#SND_NOWAIT |#SND_ASYNC ):EndIf
 If iconselect=3
 SendMessage_(WindowID(#WinAlert),#WM_SETICON,#False,LoadIcon_(0,#IDI_QUESTION))     ;IDI_QUESTION = 32514    
 DrawImage(LoadIcon_(0, #IDI_QUESTION), 10, 10)
 PlaySound_("SystemQuestion",0, #SND_ALIAS|#SND_NODEFAULT|#SND_NOWAIT|#SND_ASYNC):EndIf
 If iconselect=4
 SendMessage_(WindowID(#WinAlert),#WM_SETICON,#False,LoadIcon_(0,#IDI_APPLICATION))  ;IDI_APPLICATION = 32512  
 DrawImage(LoadIcon_(0, #IDI_APPLICATION), 10, 10)
 PlaySound_("SystemStart" ,0, #SND_ALIAS|#SND_NODEFAULT|#SND_NOWAIT|#SND_ASYNC ):EndIf
 If iconselect=5
 SendMessage_(WindowID(#WinAlert),#WM_SETICON,#False,LoadIcon_(0,#IDI_WINLOGO))      ;#IDI_WINLOGO = 32517
 DrawImage(LoadIcon_(0, #IDI_WINLOGO), 10, 10)
 PlaySound_("SystemExit" ,0, #SND_ALIAS|#SND_NODEFAULT|#SND_NOWAIT |#SND_ASYNC ):EndIf                              
 
 ; Zone texte
 DrawingFont(FontID(5))
 DrawText(43,0,"Joyeux  Noël ",RGB(255,255,255),cb)
 DrawingMode(1)
 DrawText(42,1,"Joyeux  Noël ",RGB(255,0,0),cb)
 DrawText(43,32,"    à Tous... ",RGB(255,255,255),cb)
 DrawingMode(1)
 DrawText(42,33,"    à Tous...  ",RGB(255,0,0),cb)
StopDrawing() 
ImageGadget(#image_gadget,0,0,WindowWidth(#WinAlert),WindowHeight(#WinAlert),ImageID(#image))
DisableGadget(#image_gadget,1) 

Debug "Fond=RGB("+Str(Red(cb))+","+Str(Green(cb))+","+Str(Blue(cb))+")"

ButtonGadget(#button01, 25, 80, 60, 20, "Icône 1")
ButtonGadget(#button02, 105, 80, 60, 20, "Icône 2")
ButtonGadget(#button03, 185, 80, 60, 20, "Icône 3")
ButtonGadget(#button04, 25, 110, 60, 20, "Icône 4")
ButtonGadget(#button05, 105, 110, 60, 20, "Icône 5")
ButtonGadget(#button06, 185, 110, 60, 20, "Icône 6")
 
Repeat
  Event = WaitWindowEvent()
  If Event = #PB_Event_Gadget
    Select EventGadget()
      Case #button01 : Debug "Bouton 1  SystemAsterisk (stern)"
        iconselect=0
        Alerte()
      Case #button02 : Debug "Bouton 2  SystemExclamation (Advice)"
        iconselect=1
        Alerte()
      Case #button03 : Debug "Bouton 3  SystemHand (Kritischer Abbruch)"
        iconselect=2
        Alerte()
      Case #button04 : Debug "Bouton 4  SystemQuestion (Frage)"
        iconselect=3
        Alerte()
      Case #button05 : Debug "Bouton 5  SystemExit (Systemstart)"
        iconselect=4
        Alerte()
      Case #button06 : Debug "Bouton 6  SystemExit (Systemstart)"
        iconselect=5
        Alerte()
    EndSelect
  EndIf
  If Event = #PB_Event_CloseWindow
    End
  EndIf
ForEver
EndProcedure
Alerte()
End
Dernière modification par kernadec le jeu. 02/déc./2010 8:34, modifié 2 fois.
Patrick88
Messages : 1564
Inscription : mer. 21/janv./2004 18:24

Re: Message sous la neige

Message par Patrick88 »

super(be)

mais pas de différence entre #IDI_APPLICATION et #IDI_WINLOGO = (petite boite de dialogue windows) ?

pat
Avatar de l’utilisateur
kernadec
Messages : 1606
Inscription : ven. 25/avr./2008 11:14

Re: Message sous la neige

Message par kernadec »

oui, c'est pas normal
j'ai fais une petite recherche et apparemment
il semble que IDI_WINLOGO soit absent de la ressource.
Alors Je l'ai laissé dans le code pour Vista ou Seven peut être...

Cordialement
Avatar de l’utilisateur
Ar-S
Messages : 9540
Inscription : dim. 09/oct./2005 16:51
Contact :

Re: Message sous la neige

Message par Ar-S »

même chose sous 7, les icones sont les mêmes. Sinon c'est bien sympa. :mrgreen: merci
~~~~Règles du forum ~~~~
⋅.˳˳.⋅ॱ˙˙ॱ⋅.˳Ar-S ˳.⋅ॱ˙˙ॱ⋅.˳˳.⋅
W11x64 PB 6.x
Section HORS SUJET : ICI
LDV MULTIMEDIA : Dépannage informatique & mes Logiciels PB
UPLOAD D'IMAGES : Uploader des images de vos logiciels
Warkering
Messages : 808
Inscription : ven. 08/janv./2010 1:14
Localisation : Québec, Canada

Re: Message sous la neige

Message par Warkering »

[HS]Tu devrais changer le titre pour "Message sous l'averse"! :mrgreen: [/HS]
Geo Trouvpatou
Messages : 471
Inscription : dim. 23/déc./2007 18:10

Re: Message sous l'averse de neige

Message par Geo Trouvpatou »

Salut.

Sous XP seul la 5 et 6 sont identiques.
Au passage voici un bout de code pour améliorer un peu ta boite d'alerte qui m'avait été filé par un joueur de harpe du forum :

Code : Tout sélectionner

; German forum: http://robsite.de/php/pureboard/viewtopic.php?t=2441&highlight=
; Author: GPI
; Date: 02. October 2003


;MessageRequester("","test")

; without #snd_async, the program is waiting

Debug "SystemAsterisk (stern)"
PlaySound_ ( "SystemAsterisk" ,0, #SND_ALIAS|#SND_NODEFAULT|#SND_NOWAIT|#SND_ASYNC )
Delay (2500)
Debug "SystemExclamation (Advice)"
PlaySound_ ( "SystemExclamation" ,0, #SND_ALIAS|#SND_NODEFAULT|#SND_NOWAIT |#SND_ASYNC )
Delay (2500)
Debug "SystemExit (Systemstart)"
PlaySound_ ( "SystemExit" ,0, #SND_ALIAS|#SND_NODEFAULT|#SND_NOWAIT |#SND_ASYNC )
Delay (2500)
Debug "SystemHand (Kritischer Abbruch)"
PlaySound_ ( "SystemHand" ,0, #SND_ALIAS|#SND_NODEFAULT|#SND_NOWAIT |#SND_ASYNC )
Delay (2500)
Debug "SystemQuestion (Frage)"
PlaySound_ ( "SystemQuestion" ,0, #SND_ALIAS|#SND_NODEFAULT|#SND_NOWAIT |#SND_ASYNC )
Delay (2500)
Debug "SystemStart (System-Start)"
PlaySound_ ( "SystemStart" ,0, #SND_ALIAS|#SND_NODEFAULT|#SND_NOWAIT|#SND_ASYNC )
Delay (3500)
Avatar de l’utilisateur
kernadec
Messages : 1606
Inscription : ven. 25/avr./2008 11:14

Re: Message sous l'averse de neige

Message par kernadec »

Bonjour geo Trouvpatou
merci,
Mise à jour du code : Ajout des sons, Mais j'ai rencontré un problème avec XP
pour le son "SystemQuestion" qui ne fonctionner pas... enfin sur ma bécane?
Au regard du registre, la clé n'avait pas de lien vers un son system,
j'ai corrigé mon registre avec le son Ding.wav.

Modification du registre pour la clé "SystemQuestion" : HKEY_CURRENT_USER\AppEvents\Schemes\Apps\
éditer le registre et mettre par défaut: "%SystemRoot%\\media\\Windows XP Ding.wav"
mais attention avec la clé : ".current" le (type) "REG_SZ" n'est pas éditable pour le remplacer par "REG_EXPAND_SZ"
pour ce problème la solution est d'exporter la clé "SystemQuestion"
et puis avec le Notepad dupliquer la séquence hex:
[HKEY_CURRENT_USER\AppEvents\Schemes\Apps\.Default\SystemQuestion\.Default]

dans: [HKEY_CURRENT_USER\AppEvents\Schemes\Apps\.Default\SystemQuestion\.Current]

et importer la clé modifiée..

Cordialement


je joint la clé du registre pour le son Ding.Wav au cas où..


Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\AppEvents\Schemes\Apps\.Default\SystemQuestion]

[HKEY_CURRENT_USER\AppEvents\Schemes\Apps\.Default\SystemQuestion\.Current]
@=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\
00,5c,00,6d,00,65,00,64,00,69,00,61,00,5c,00,57,00,69,00,6e,00,64,00,6f,00,\
77,00,73,00,20,00,58,00,50,00,20,00,44,00,69,00,6e,00,67,00,2e,00,77,00,61,\
00,76,00,00,00

[HKEY_CURRENT_USER\AppEvents\Schemes\Apps\.Default\SystemQuestion\.Default]
@=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\
00,5c,00,6d,00,65,00,64,00,69,00,61,00,5c,00,57,00,69,00,6e,00,64,00,6f,00,\
77,00,73,00,20,00,58,00,50,00,20,00,44,00,69,00,6e,00,67,00,2e,00,77,00,61,\
00,76,00,00,00

[HKEY_CURRENT_USER\AppEvents\Schemes\Apps\.Default\SystemQuestion\Minimal0?]
@=""
Backup
Messages : 14526
Inscription : lun. 26/avr./2004 0:40

Re: Message sous l'averse de neige

Message par Backup »

de memoire :
pour que les sons marchent, il faut qu'ils aient été activés dans le panneau de config
si le son system n'as pas été attribué , il ne marchera pas .. ;)
Avatar de l’utilisateur
kernadec
Messages : 1606
Inscription : ven. 25/avr./2008 11:14

Re: Message sous l'averse de neige

Message par kernadec »

Bonjour Dobro
:oops: c'est vrai j'avais zappé cette option
trop fort Dobro.. je dirais même Wiki-Dobro
Cordialement
Backup
Messages : 14526
Inscription : lun. 26/avr./2004 0:40

Re: Message sous l'averse de neige

Message par Backup »

:)
Répondre