CREATION ICONE VALIDE A PARTIR DE SECTIONDATA

Vous débutez et vous avez besoin d'aide ? N'hésitez pas à poser vos questions
Avatar de l’utilisateur
Fortix
Messages : 559
Inscription : mar. 30/mai/2006 17:03

CREATION ICONE VALIDE A PARTIR DE SECTIONDATA

Message par Fortix »

Bonsoirs à tous :D , je suis de retour de vacance(rien à foutre :cry: ),bref,
j'ais un petit souci: l'îcone que je crées est inutilisable :?: :?: ,

mon "systrayIcon" n'arrive pas à se servir de cet icone pourtant consideré comme valide par windows????

à la 2ème execution il devrait y avoir une îcone dans la barre des taches(la 1ère execution = création de l'îcone dans c:\)

Code : Tout sélectionner

;UsePNGImageEncoder()


Procedure Recreate_Picture_(Image,Largeur,Hauteur)

    If CreateImage(Image,Largeur,Hauteur) 
    
        StartDrawing(ImageOutput(Image))            
            For y=0 To Hauteur -1        
                    For x=0 To Largeur -1               
                        Read a.l
                        Plot(x, y ,a.l)
                    Next x         
            Next Y           
        StopDrawing() 
    EndIf
    
EndProcedure

; Procedure structureICO()
; 
;     CreateIcon(hinst,32,32,1,1)
; 
; EndProcedure




If OpenWindow(0, 100, 200, 300, 200, "Pti test")
    CreateGadgetList(WindowID(0))

    If ExamineDirectory(0,"c:\","PrSystray.ico")=0
    
        Recreate_Picture_(0,32,32)
        ImageGadget(0, 0, 0, 0, 0, ImageID(0))
        
        If SaveImage(0, "c:\PrSystray.ico")
            Debug "Image sauveguardee"
        EndIf
    Else
    
        ImageGadget(0, 0, 0, 0, 0, LoadImage(1, "c:\PrSystray.ico"))
        
        If AddSysTrayIcon(0, WindowID(0), LoadImage(1, "c:\PrSystray.ico"))=0
            Debug "Element non valide: îcone"
        Else
            SysTrayIconToolTip(0, "Icon 1")
        EndIf
    EndIf
    
    Repeat
        EventID = WaitWindowEvent() 
    Until EventID = #PB_Event_CloseWindow 
  
EndIf

End 

DataSection

Data.l $000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000
Data.l $000000,$AA25FF,$AA25FF,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000
Data.l $000000,$AA25FF,$AA25FF,$000000,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000
Data.l $000000,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$FF4873,$AA25FF,$000000,$000000,$000000,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000
Data.l $000000,$000000,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$FF4873,$FF4873,$FF4873,$AA25FF,$000000,$000000,$000000,$AA25FF,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000
Data.l $000000,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$FF4873,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$AA25FF,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000
Data.l $000000,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$000000,$AA25FF,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000
Data.l $AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000
Data.l $AA25FF,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000
Data.l $AA25FF,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$FF4873,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000
Data.l $AA25FF,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$FF4873,$FF4873,$FF4873,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000
Data.l $AA25FF,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$FF4873,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000
Data.l $AA25FF,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$000000
Data.l $AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000
Data.l $000000,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$FF4873,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000
Data.l $000000,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$FF4873,$FF4873,$FF4873,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000
Data.l $000000,$000000,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$FF4873,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$FF4873,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000
Data.l $000000,$000000,$000000,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$FF4873,$FF4873,$FF4873,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000
Data.l $000000,$000000,$000000,$000000,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$FF4873,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000
Data.l $000000,$AA25FF,$AA25FF,$AA25FF,$000000,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000
Data.l $000000,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$FF4873,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000
Data.l $000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$FF4873,$FF4873,$FF4873,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000
Data.l $000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$FF4873,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000
Data.l $000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000
Data.l $000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$FF4873,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000
Data.l $000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$FF4873,$FF4873,$FF4873,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000
Data.l $000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$FF4873,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000
Data.l $000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$000000
Data.l $000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$AA25FF,$AA25FF,$000000
Data.l $000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$000000
Data.l $000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000
Data.l $000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000
 

;_Hauteur: 32 px
;_Largeur: 32 px
EndDataSection


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

Message par Ar-S »

Hum je n'ai ni systray ico qui s'affiche dans la barre systeme ni le fichier .ico qui apparait dans c:
Avatar de l’utilisateur
Kwai chang caine
Messages : 6989
Inscription : sam. 23/sept./2006 18:32
Localisation : Isere

Message par Kwai chang caine »

Bah moi j'ai une jolie barre rouge à la ligne 42 au premier demarrage :cry:
Donc je peux pas te parler du 2e :wink:
Avatar de l’utilisateur
Fortix
Messages : 559
Inscription : mar. 30/mai/2006 17:03

Message par Fortix »

éssayez ceci: :wink:

Code : Tout sélectionner


Procedure Recreate_Picture_(Image,Largeur,Hauteur)

    If CreateImage(Image,Largeur,Hauteur) 
    
        StartDrawing(ImageOutput(Image))            
            For y=0 To Hauteur -1        
                    For x=0 To Largeur -1               
                        Read a.l
                        Plot(x, y ,a.l)
                    Next x         
            Next Y           
        StopDrawing() 
    EndIf
    
EndProcedure


If OpenWindow(0, 100, 200, 300, 200, "Pti test")
    CreateGadgetList(WindowID(0))

        Recreate_Picture_(0,32,32)
        ImageGadget(0, 0, 0, 0, 0, ImageID(0))
        
        If SaveImage(0, "c:\PrSystray.ico")
            Debug "Image sauveguardee"
        Else
            Debug "Image NON sauveguardee"
        EndIf
       
        If AddSysTrayIcon(0, WindowID(0), LoadImage(1, "c:\PrSystray.ico"))=0
            Debug "Element non valide: îcone"
        Else
            Debug "Element autorisé: îcone"
        EndIf
   
    Repeat
        EventID = WaitWindowEvent() 
    Until EventID = #PB_Event_CloseWindow 
  
EndIf

End 

DataSection

Data.l $000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000
Data.l $000000,$AA25FF,$AA25FF,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000
Data.l $000000,$AA25FF,$AA25FF,$000000,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000
Data.l $000000,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$FF4873,$AA25FF,$000000,$000000,$000000,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000
Data.l $000000,$000000,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$FF4873,$FF4873,$FF4873,$AA25FF,$000000,$000000,$000000,$AA25FF,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000
Data.l $000000,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$FF4873,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$AA25FF,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000
Data.l $000000,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$000000,$AA25FF,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000
Data.l $AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000
Data.l $AA25FF,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000
Data.l $AA25FF,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$FF4873,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000
Data.l $AA25FF,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$FF4873,$FF4873,$FF4873,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000
Data.l $AA25FF,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$FF4873,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000
Data.l $AA25FF,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$000000
Data.l $AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000
Data.l $000000,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$FF4873,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000
Data.l $000000,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$FF4873,$FF4873,$FF4873,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000
Data.l $000000,$000000,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$FF4873,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$FF4873,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000
Data.l $000000,$000000,$000000,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$FF4873,$FF4873,$FF4873,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000
Data.l $000000,$000000,$000000,$000000,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$FF4873,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000
Data.l $000000,$AA25FF,$AA25FF,$AA25FF,$000000,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000
Data.l $000000,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$FF4873,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000
Data.l $000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$FF4873,$FF4873,$FF4873,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000
Data.l $000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$FF4873,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000
Data.l $000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000
Data.l $000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$FF4873,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000
Data.l $000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$FF4873,$FF4873,$FF4873,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000
Data.l $000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$FF4873,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000
Data.l $000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$000000
Data.l $000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$AA25FF,$AA25FF,$000000
Data.l $000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$000000
Data.l $000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000
Data.l $000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000
 

;_Hauteur: 32 px
;_Largeur: 32 px
EndDataSection

ça marche très bien chez moi, le tout c'est de copier le contenu tel quel
Avatar de l’utilisateur
case
Messages : 1546
Inscription : lun. 10/sept./2007 11:13

Message par case »

en fait j'ai l'impression que l'image n'est pas au format ICO de windows

a savoir que le format ICO de windows est different du bmp, si ton icone est sauvée au format BMP c'est peut etre ca le souci non ?
Avatar de l’utilisateur
case
Messages : 1546
Inscription : lun. 10/sept./2007 11:13

Message par case »

bon petite modification de ton programme j'ai rajouté une fonction de creation d'icone que j'avais ecrit a l'epoque en blitz basic (je l'ai adapté brut de coffrage et la methode de fonctionnement est un peu brutale on vas dire)
je connais rien en pure, je debute .
mais cette fois ca fonctionne et pas besoin de le lancer deux fois :)


Code : Tout sélectionner



Declare poke(mem,offset,value,typ)

Procedure saveicon(filename$,hauteur,largeur)
buffer=AllocateMemory(10000)
If buffer
;-------------------------------ICONDIR structure
		offset=poke(buffer,offset,0,1)						;reserved must be 0 					(WORD)0
		offset=poke(buffer,offset,1,1)						;ressource type icon=1					(WORD)2
		offset=poke(buffer,offset,1,1)						;how many images 1						(WORD)4
		;-------------------------------ICONDIR ENTRY
		offset=poke(buffer,offset,largeur,0)      ;width in pixel of the picture			(BYTE)6
		offset=poke(buffer,offset,hauteur,0)		;height in pixel of the picture			(BYTE)7
		offset=poke(buffer,offset,0,0)						;#color in image 0 if >8bpp 			(BYTE)8
		offset=poke(buffer,offset,0,0)						;reserved must be 0 					(BYTE)9
		offset=poke(buffer,offset,1,1)						;color planes 							(WORD)10
		offset=poke(buffer,offset,32,1)						;bit per pixel							(WORD)12
		bytecount=((largeur*hauteur)*4);x,y*4 bytes
		offset=poke(buffer,offset,bytecount+40+(largeur*hauteur)/8,2)	;how many bytes in this ressource		(DWORD)14
		offset=poke(buffer,offset,offset+4,2)				;where in the file is the bitmap data	(DWORD)18
		;--------------------------------DIB header
		offset=poke(buffer,offset,40,2)						;lenght of the header					(DWORD)22
		offset=poke(buffer,offset,largeur,2)		;width in pixel of the picture			(DWORD)26
		offset=poke(buffer,offset,hauteur*2,2)		;width in pixel of the picture		(DWORD)30
		offset=poke(buffer,offset,1,1)						;color planes 1 in most case			(WORD)34
		offset=poke(buffer,offset,32,1)						;bit per pixel							(WORD)36
		offset=poke(buffer,offset,0,2)						;compression value						(DWORD)38
		offset=poke(buffer,offset,bytecount,2)				;pixeldata size							(DWORD)42
		offset=poke(buffer,offset,0,2)						;ppm									(DWORD)46
		offset=poke(buffer,offset,0,2)						;ppm									(DWORD)50
		offset=poke(buffer,offset,0,2)						;number of color 0=max                  (DWORD)54
		offset=poke(buffer,offset,0,2)						;number of color indice importants 0=max(DWORD)58



  For y=0 To Hauteur -1       
    For x=0 To Largeur -1               
      Read a.l
       b=(a <<8)>>24
       g=(a <<16)>>24
       r=(a <<24)>>24
       offset=poke(buffer,offset,B,0)
			 offset=poke(buffer,offset,G,0)
			 offset=poke(buffer,offset,R,0)
			 offset=poke(buffer,offset,255,0)
    Next x         
  Next Y           
EndIf
	For a=1 To bytecount/8
		offset=poke(buffer,offset,0,0)
	Next
  sav=OpenFile(0,filename$)
  WriteData(0,buffer,offset)
  CloseFile(0)
  FreeMemory(buffer)
EndProcedure
Procedure poke(mem,offset,value,typ)
Select typ
	Case 0;byte
		PokeB(mem+offset,value):offset=offset+1
	Case 1;word
		PokeW(mem+offset,value):offset=offset+2
	Case 2;long
		PokeL(mem+offset,value):offset=offset+4
EndSelect
ProcedureReturn offset
EndProcedure





If OpenWindow(0, 100, 200, 300, 200, "Pti test")
    CreateGadgetList(WindowID(0))  
        saveicon("c:\blah.ico",32,32)
      
        If AddSysTrayIcon(0, WindowID(0), LoadImage(1, "c:\blah.ico"))=0
            Debug "Element non valide: îcone"
        Else
            Debug "Element autorisé: îcone"
        EndIf
    Repeat
        EventID = WaitWindowEvent()
    Until EventID = #PB_Event_CloseWindow
 
EndIf

End

DataSection

Data.l $000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000
Data.l $000000,$AA25FF,$AA25FF,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000
Data.l $000000,$AA25FF,$AA25FF,$000000,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000
Data.l $000000,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$FF4873,$AA25FF,$000000,$000000,$000000,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000
Data.l $000000,$000000,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$FF4873,$FF4873,$FF4873,$AA25FF,$000000,$000000,$000000,$AA25FF,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000
Data.l $000000,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$FF4873,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$AA25FF,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000
Data.l $000000,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$000000,$AA25FF,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000
Data.l $AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000
Data.l $AA25FF,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000
Data.l $AA25FF,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$FF4873,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000
Data.l $AA25FF,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$FF4873,$FF4873,$FF4873,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000
Data.l $AA25FF,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$FF4873,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000
Data.l $AA25FF,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$000000
Data.l $AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000
Data.l $000000,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$FF4873,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000
Data.l $000000,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$FF4873,$FF4873,$FF4873,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000
Data.l $000000,$000000,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$FF4873,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$FF4873,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000
Data.l $000000,$000000,$000000,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$FF4873,$FF4873,$FF4873,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000
Data.l $000000,$000000,$000000,$000000,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$FF4873,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000
Data.l $000000,$AA25FF,$AA25FF,$AA25FF,$000000,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000
Data.l $000000,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$FF4873,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000
Data.l $000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$FF4873,$FF4873,$FF4873,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000
Data.l $000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$FF4873,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000
Data.l $000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000
Data.l $000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$FF4873,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000
Data.l $000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$FF4873,$FF4873,$FF4873,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000
Data.l $000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$FF4873,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000
Data.l $000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$000000
Data.l $000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$AA25FF,$AA25FF,$000000
Data.l $000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$000000
Data.l $000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000
Data.l $000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000
 

;_Hauteur: 32 px
;_Largeur: 32 px
EndDataSection 
Avatar de l’utilisateur
Fortix
Messages : 559
Inscription : mar. 30/mai/2006 17:03

Message par Fortix »

Salutation @CASE,

merci beaucoup, je vais enfin pouvoir passer à autre chose, encore merci :D
Avatar de l’utilisateur
Fortix
Messages : 559
Inscription : mar. 30/mai/2006 17:03

Message par Fortix »

C'est plus que du super ton code, un grand merci :D :D :D
Ollivier
Messages : 4197
Inscription : ven. 29/juin/2007 17:50
Localisation : Encore ?
Contact :

Message par Ollivier »

En effet : sympa ton code case!
Avatar de l’utilisateur
Kwai chang caine
Messages : 6989
Inscription : sam. 23/sept./2006 18:32
Localisation : Isere

Message par Kwai chang caine »

C'tte fois j'ai un icone rose dans la systray, à la place d'un barre rouge :lol:
Bravo à tous les deux 8)
Avatar de l’utilisateur
Fortix
Messages : 559
Inscription : mar. 30/mai/2006 17:03

Message par Fortix »

Bonsoirs à vous

salut @case y a t il un moyen d'obtenir un pixel transparent,
y a t il une constante pour laisser certaines zones de l'îcone transparent,
même après la sauvegarde?

Merci @case :D
Avatar de l’utilisateur
case
Messages : 1546
Inscription : lun. 10/sept./2007 11:13

Message par case »

je regarderais ca :)
Ollivier
Messages : 4197
Inscription : ven. 29/juin/2007 17:50
Localisation : Encore ?
Contact :

Message par Ollivier »

Ben ça tombe pile dans la période où je me prends la tête avec le coef Alpha (le 4ème octet après le rouge, le vert et le bleu).

J'ai donc fait une petite modif : le paramètre ColorKey est rajouté, c'est la couleur de transparence.

Au passage, merci case pour ce petit code qui, mine de rien est très utile.

Code : Tout sélectionner

Declare poke(mem,offset,value,typ) 

Procedure saveicon(filename$,hauteur,largeur, ColorKey) 
buffer=AllocateMemory(10000) 
If buffer 
;-------------------------------ICONDIR structure 
      offset=poke(buffer,offset,0,1)                  ;reserved must be 0                (WORD)0 
      offset=poke(buffer,offset,1,1)                  ;ressource type icon=1               (WORD)2 
      offset=poke(buffer,offset,1,1)                  ;how many images 1                  (WORD)4 
      ;-------------------------------ICONDIR ENTRY 
      offset=poke(buffer,offset,largeur,0)      ;width in pixel of the picture         (BYTE)6 
      offset=poke(buffer,offset,hauteur,0)      ;height in pixel of the picture         (BYTE)7 
      offset=poke(buffer,offset,0,0)                  ;#color in image 0 if >8bpp          (BYTE)8 
      offset=poke(buffer,offset,0,0)                  ;reserved must be 0                (BYTE)9 
      offset=poke(buffer,offset,1,1)                  ;color planes                      (WORD)10 
      offset=poke(buffer,offset,32,1)                  ;bit per pixel                     (WORD)12 
      bytecount=((largeur*hauteur)*4);x,y*4 bytes 
      offset=poke(buffer,offset,bytecount+40+(largeur*hauteur)/8,2)   ;how many bytes in this ressource      (DWORD)14 
      offset=poke(buffer,offset,offset+4,2)            ;where in the file is the bitmap data   (DWORD)18 
      ;--------------------------------DIB header 
      offset=poke(buffer,offset,40,2)                  ;lenght of the header               (DWORD)22 
      offset=poke(buffer,offset,largeur,2)      ;width in pixel of the picture         (DWORD)26 
      offset=poke(buffer,offset,hauteur*2,2)      ;width in pixel of the picture      (DWORD)30 
      offset=poke(buffer,offset,1,1)                  ;color planes 1 in most case         (WORD)34 
      offset=poke(buffer,offset,32,1)                  ;bit per pixel                     (WORD)36 
      offset=poke(buffer,offset,0,2)                  ;compression value                  (DWORD)38 
      offset=poke(buffer,offset,bytecount,2)            ;pixeldata size                     (DWORD)42 
      offset=poke(buffer,offset,0,2)                  ;ppm                           (DWORD)46 
      offset=poke(buffer,offset,0,2)                  ;ppm                           (DWORD)50 
      offset=poke(buffer,offset,0,2)                  ;number of color 0=max                  (DWORD)54 
      offset=poke(buffer,offset,0,2)                  ;number of color indice importants 0=max(DWORD)58 



  For y=0 To Hauteur -1        
    For x=0 To Largeur -1                
      Read a.l 
       b=(a <<8)>>24 
       g=(a <<16)>>24 
       r=(a <<24)>>24 
       If RGB(r, g, b) = ColorKey: Alpha = 0: Else: Alpha = 255: EndIf
       offset=poke(buffer,offset,B,0) 
          offset=poke(buffer,offset,G,0) 
          offset=poke(buffer,offset,R,0) 
          offset=poke(buffer,offset,Alpha,0) 
    Next x          
  Next Y            
EndIf 
   For a=1 To bytecount/8 
      offset=poke(buffer,offset,0,0) 
   Next 
  sav=OpenFile(0,filename$) 
  WriteData(0,buffer,offset) 
  CloseFile(0) 
  FreeMemory(buffer) 
EndProcedure 
Procedure poke(mem,offset,value,typ) 
Select typ 
   Case 0;byte 
      PokeB(mem+offset,value):offset=offset+1 
   Case 1;word 
      PokeW(mem+offset,value):offset=offset+2 
   Case 2;long 
      PokeL(mem+offset,value):offset=offset+4 
EndSelect 
ProcedureReturn offset 
EndProcedure 





If OpenWindow(0, 100, 200, 300, 200, "Pti test") 
    CreateGadgetList(WindowID(0))  
        saveicon("c:\blah.ico",32,32, RGB(0, 0, 0) ) 
      
        If AddSysTrayIcon(0, WindowID(0), LoadImage(1, "c:\blah.ico"))=0 
            Debug "Element non valide: îcone" 
        Else 
            Debug "Element autorisé: îcone" 
        EndIf 
    Repeat 
        EventID = WaitWindowEvent() 
    Until EventID = #PB_Event_CloseWindow 
  
EndIf 

End 

DataSection 

Data.l $000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000 
Data.l $000000,$AA25FF,$AA25FF,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000 
Data.l $000000,$AA25FF,$AA25FF,$000000,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000 
Data.l $000000,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$FF4873,$AA25FF,$000000,$000000,$000000,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000 
Data.l $000000,$000000,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$FF4873,$FF4873,$FF4873,$AA25FF,$000000,$000000,$000000,$AA25FF,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000 
Data.l $000000,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$FF4873,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$AA25FF,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000 
Data.l $000000,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$000000,$AA25FF,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000 
Data.l $AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000 
Data.l $AA25FF,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000 
Data.l $AA25FF,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$FF4873,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000 
Data.l $AA25FF,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$FF4873,$FF4873,$FF4873,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000 
Data.l $AA25FF,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$FF4873,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000 
Data.l $AA25FF,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$000000 
Data.l $AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000 
Data.l $000000,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$FF4873,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000 
Data.l $000000,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$FF4873,$FF4873,$FF4873,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000 
Data.l $000000,$000000,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$FF4873,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$FF4873,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000 
Data.l $000000,$000000,$000000,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$FF4873,$FF4873,$FF4873,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000 
Data.l $000000,$000000,$000000,$000000,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$FF4873,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000 
Data.l $000000,$AA25FF,$AA25FF,$AA25FF,$000000,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000 
Data.l $000000,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$FF4873,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000 
Data.l $000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$FF4873,$FF4873,$FF4873,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000 
Data.l $000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$FF4873,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000 
Data.l $000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000 
Data.l $000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$FF4873,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000 
Data.l $000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$FF4873,$FF4873,$FF4873,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000 
Data.l $000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$FF4873,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000 
Data.l $000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$000000 
Data.l $000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$AA25FF,$AA25FF,$000000 
Data.l $000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$000000 
Data.l $000000,$000000,$000000,$000000,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$AA25FF,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000 
Data.l $000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000,$000000 
  

;_Hauteur: 32 px 
;_Largeur: 32 px 
EndDataSection 
Avatar de l’utilisateur
Fortix
Messages : 559
Inscription : mar. 30/mai/2006 17:03

Message par Fortix »

Salutation, c'est vraiement super les gars

Merci beaucoup :D
Avatar de l’utilisateur
case
Messages : 1546
Inscription : lun. 10/sept./2007 11:13

Message par case »

oui mais il est quand meme pas parfaitement bien implementé :) enfin il fait son travail de base convertir une image en icone :)
Répondre