Paul,
JPG and BMP are OK but GIF or PNG are not. Other types were not checked
The code i made in the hurry has some defect: Program crashes when you push esc, no time to investigate why. Just ignore
Some additional suggestions: confusing diagnostics.
if you by mistake do not declare hres and vres as integer the compiler gives confusing diagnostics below instead of clearly saying that it expected integers
allocate ( ImageArr(3,hres, vres), stat = kAllocOK)
*** Operand incompatible with opcode
Here is code
INTEGER , EXTERNAL :: DropFiles
i=winio@('%ww[no_border]&')
i=winio@('%bg[#cc9999]&')
i=winio@('%si! Drag-n-drop BMP file here %ff %ff&')
i=winio@('%dr&', DropFiles)
i=winio@('%ac[Alt+X]&','exit')
i=winio@(' %ff %cn%tt[OK]')
END PROGRAM
integer function DropFiles()
use clrwin
character*128 filename1
integer*1, dimension(:,:,:), allocatable :: ImageArr
integer hres, vres, colours, ier
filename1 = clearwin_string@ ('DROPPED_FILE')
call get_dib_size@(filename1, hres, vres, nb_colours, ier)
print*,' hres,vres,nb_colours=',hres, vres, nb_colours
kAllocOK=0
allocate ( ImageArr(3,hres, vres), stat = kAllocOK)
if (kAllocOK /= 0) write (*,*) 'Allocation problem #', kAllocOK, hres, vres
call get_dib_block@(filename1,ImageArr,hres, vres,0,0,hres, vres,0,0,ier)
if(ier.ne.0) Print*, 'get Err=',ier
i=winio@('%ww&')
i=winio@('%gr[full_mouse_input,rgb_colours,popup]&',hres,vres)
i=winio@('%ac[Alt+X]&','exit')
i=winio@('%ac[esc]&','set', LWwindow_control,0) ! 'exit')
i=winio@('%lw', LWwindow_control)
call display_dib_block@(0,0,ImageArr,hres,vres,0,0,hres,vres,0,0,ier)
if(ier.ne.0) Print*, 'Display Err=',ier
! deallocate(ImageArr, stat = ios)
! if (ios /= 0) then
! print *, 'Was nothing to deallocate'
! end if
DropFiles=2
end function