- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
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 kopiert
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
Is this a 64 or 32 bit build? What is the type of the hdc?
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
This is a 64 bit build
Trevhdc is Integer (handle) and is used in several other calls, prior to the StretchdiBits call, without problem.
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
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."
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
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).

- RSS-Feed abonnieren
- Thema als neu kennzeichnen
- Thema als gelesen kennzeichnen
- Diesen Thema für aktuellen Benutzer floaten
- Lesezeichen
- Abonnieren
- Drucker-Anzeigeseite