image sur le bureau
Publié : lun. 18/juil./2016 16:53
Bonjour, j'ai essaye de faire un petit code qui afficherait une petite image sur le bureau (genre de watermark), ca marche bien, mais au bout de qqe minutes l'image devient blanche.
ci joint mon code, apparement ca n'est pas la bonne facon de le faire, je crois avoir vu une fois un code pour ca sur le forum mais je ne l'ai pas retrouve
ci joint mon code, apparement ca n'est pas la bonne facon de le faire, je crois avoir vu une fois un code pour ca sur le forum mais je ne l'ai pas retrouve
Code : Tout sélectionner
#position = "bottom"
#taille_image = 70
#distance_from_border = 4
UsePNGImageDecoder()
UseJPEGImageDecoder()
ExamineDesktops()
Declare Toast_RemoveFromTaskBar(Window.l, state.l)
Declare move_window()
Define.l position
Define.RECT ScreenSize
SystemParametersInfo_(#SPI_GETWORKAREA, 0, @ScreenSize.RECT, 0) ;on recupere les informations sur la taille de l'ecran
If #position = "up"
position = #distance_from_border
Else
position = ScreenSize\bottom - #taille_image - #distance_from_border
EndIf
If OpenWindow(0, #distance_from_border, position, #taille_image, #taille_image, "", #PB_Window_BorderLess)
Toast_RemoveFromTaskBar(0, 1)
StartDrawing(WindowOutput(0))
CatchImage(0, ?naki)
ResizeImage(0,#taille_image, #taille_image)
DrawImage(ImageID(0), 0,0)
StopDrawing()
AddKeyboardShortcut(0, #PB_Shortcut_Escape, 0)
AddKeyboardShortcut(0, #PB_Shortcut_F10, 1)
Repeat
Select WaitWindowEvent()
Case #PB_EventType_RightClick
; move_window()
Case #PB_Event_Menu
Select EventMenu()
Case 1
move_window()
Case 0
End
EndSelect
EndSelect
ForEver
EndIf
DataSection
naki:
IncludeBinary "nak.png"
EndDataSection
Procedure move_window()
If WindowX(0) = #distance_from_border
posX = DesktopWidth(0) - #distance_from_border - #taille_image
Else
posX = #distance_from_border
EndIf
ResizeWindow(0, posX, #PB_Ignore, #PB_Ignore, #PB_Ignore)
EndProcedure
Procedure Toast_RemoveFromTaskBar(Window.l, state.l)
Protected hwnd.l = WindowID(Window)
; cache la fen?tre
ShowWindow_(hwnd, #SW_HIDE)
; change le style de la fen?tre ( le plus important )
If state
SetWindowLong_(hwnd, #GWL_EXSTYLE, GetWindowLong_(hwnd, #GWL_EXSTYLE) | #WS_EX_TOOLWINDOW)
Else
SetWindowLong_(hwnd, #GWL_EXSTYLE, GetWindowLong_(hwnd, #GWL_EXSTYLE) & (~#WS_EX_TOOLWINDOW))
EndIf
; notifie la fen?tre que son apparence a chang? (mais ni sa taille, ni sa position)
If SetWindowPos_(hwnd, 0, 0, 0, 0, 0, #SWP_NOSIZE|#SWP_NOMOVE|#SWP_SHOWWINDOW| #SWP_FRAMECHANGED)
ProcedureReturn #True
EndIf
EndProcedure