I am converting a program from Fortran 10 to fortran 16 (evaluation version at the moment) in Windows 10.
Most things have converted well but I am having problems with a bitmap routine (based on a routine that Steve Lionel gave me many years ago).
I have solved most of the problems, e.g. handles but when I call StretchDibit it give me a fortll severe (157) program exception, access violation error.
As far as I can see the values of all of the variable seem fine ...but obviously they are not. Below are the pertinent bits of code.
type (T_BITMAPFILEHEADER) :: pbmfh
pointer (pheader, pbmfh)
integer(4) pBits
type (T_BITMAPINFO) bits
pointer (lpbits, bits)
!
! Read Bitmap file
!
if (pheader /= 0) call free(pheader)
iret = GetBitMap('Temp.bmp'C)
iret = DeleteFile('Temp.bmp'C) ! Delete temporary .bmp file.
if (iret > 0) then
lpbits = pheader + sizeof(pbmfh)
pBits = pheader + pbmfh.bfOffBits
else
Stop ' Error with reading bitmap'
c PrintWin = PW_ERR_READBITMAP ! Failed to read bitmap file.
c goto 9999
end if
if ( bits.bmiHeader.biSize /= 40) then
Stop ' Bitmap header is the wrong size'
c PrintWin = PW_ERR_READDIBHEADER ! Bitmap header is wrong size.
c goto 9999
end if
iret = StretchDIBits (Trevhdc, 0, 0, cxPage, cyPage, 0, 0,
& cxDib,cyDib, pbits, bits, DIB_RGB_COLORS, SRCCOPY)
Trevhdc is a handle and is correct.