Show Jpeg,Gif,Png or BMP Images

Share your advanced PureBasic knowledge/code with the community.
RValois
User
User
Posts: 16
Joined: Fri Aug 15, 2003 6:31 am
Location: Brazil
Contact:

Show Jpeg,Gif,Png or BMP Images

Post by RValois »

Code updated for 5.20+

Code: Select all

Structure LVBKIMAGE Align #PB_Structure_AlignC
    ulFlags.l       
    hbm.i
    pszImage.i
    cchImageMax.l
    xOffsetPercent.l
    yOffsetPercent.l
EndStructure

CoInitialize_(0)

If OpenWindow(0, 100, 100, 640, 480, "Show GIF,JPEG,PNG or BMP Images", #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget)
  hLV = CreateWindowEx_(#Null,"syslistview32", "", #WS_CHILD|#WS_VISIBLE, 10,10,620,460, WindowID(0), 1000, GetModuleHandle_(0), 0)
  If hLV
    lvbi.LVBKIMAGE
    szFile.s = #PB_Compiler_Home + "Examples\3D\Data\Textures\clouds.jpg"
    lvbi\ulFlags = 2
    lvbi\pszImage = @szFile
    lvbi\cchImageMax = Len(szFile)
    Result = SendMessage_(hLV,  #LVM_SETBKIMAGE, 0, lvbi)
   
    Repeat
    Until WaitWindowEvent()= #PB_Event_CloseWindow
  EndIf
EndIf

End
For some unknown reason PureBasic does not like CoUnInitialize at code end.

Regards,
RValois.