- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is this a 64 or 32 bit build? What is the type of the hdc?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is a 64 bit build
Trevhdc is Integer (handle) and is used in several other calls, prior to the StretchdiBits call, without problem.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
iret = StretchDIBits (Trevhdc, 0, 0, cxPage, cyPage, 0, 0,& cxDib,cyDib, pbits, bits, DIB_RGB_COLORS, SRCCOPY)
pbits is not "A pointer to the image bits, which are stored as an array of bytes. For more information, see the Remarks section."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you,
I've replaced pbits with lpbits and that solves the problem (although I'm not sure why it used to work in my Fortran 10 version).

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page