I'm trying to draw something on a 32-bit 800*600 GDI window (DirectX is for later), but the call to StretchDIBits fails. GetLastError says there's a parameter wrong, but I don't see which on is bad.
I've created a minimal file that shows the problem (hardcoded sizes, needs 32-bit desktop etc). Can anyone tell what's wrong with it? It should just show a white window. Pressing any key closes it.
Posted on 2002-05-09 03:19:44 by james
Is this supposed to be negative?:

mov [(BITMAPINFOHEADER( VV_Bitmap_Info.bmiHeader)).biHeight], -600
Posted on 2002-05-09 06:46:48 by Brad
Yes, from the win32 programmers reference, BITMAPINFOHEADER entry:

biHeight:
Specifies the height of the bitmap, in pixels. If biHeight is positive, the bitmap is a bottom-up DIB and its origin is the lower left corner. If biHeight is negative, the bitmap is a top-down DIB and its origin is the upper left corner.

And I've tried flipping the sign but it doesn't solve the problem :(
Posted on 2002-05-09 08:12:17 by james
After further investigations, I've tried to assemble the same small file in TASM and it works as expected. So I guess the problem is not specifically in the StretchDIBits call but more something like a wrong library or so. If you've any suggestions, please post them in the "Help! Does windows hate MASM"-thread.
Posted on 2002-05-09 14:55:27 by james
james,

my asm is not up to par yet.....but I can give you a PowerBASIC example that does all you wish if you like....pretty easy to follow:

http://www.powerbasic.com/support/forums/Forum7/HTML/001247.html

B


added:
here's a much simplier one at the bottom of the thread....
http://www.powerbasic.com/support/forums/Forum4/HTML/005635.html
Posted on 2002-05-09 15:32:07 by Brad
Hi James,



.data
;.code
align 4
; B I T M A P F I L E HEADER - Len Eh=14 bytes (w ,dw,dw,dw)
; B M F i l e s i z e R e s e r v ed b f O f f B i t s
;Bit1 DB "B" "M" 09Bh, 002h, 000h, 000h, 000h, 000h, 000h, 000h, 036h,004h,000h,000h ;14
Bit1 DB 036h,004h,000h,000h ;14
; B I T M A P I N F O -
; B I T M A P I N F O H E A D E R - Len here -> 28h=40bytes
; b i S i z e b i W i d t h b i H e i g h t biPlanes
DB 028h,000h,000h,000h, 010h,000h,000h,000h, 010h,000h,000h,000h, 001h, 000h
; biBitCount biCompression biSizeImage biXPelsPerMeter
DB 008h,000h, 000h,000h,000h,000h, 000h,001h,000h,000h, 088h,00Bh,000h,000h
; biYPelsPerMeter biClrUsed biClrImportant
DB 088h,00Bh,000h,000h, 000h,000h,000h,000h, 000h,000h,000h,000h ;end BITMAPINFOHEADER
; bmiColors[1] - Len here->400h=1024 bytes =bfOffBits - 0Eh - biSize =436h-0Eh-28h=400h
DB 000h, 000h, 000h, 000h, 000h, 0BFh, 0BFh, 000h, 000h, 0FFh, 0FFh, 000h, 080h, 080h
DB 080h, 000h, 0C0h, 0C0h, 0C0h, 000h, 0ECh, 0ECh, 0ECh, 000h, 0FFh, 0FFh, 0FFh, 000h
DB 0C1h, 053h, 011h, 000h, 0F8h, 06Fh, 004h, 000h, 0A2h, 06Eh, 080h, 000h, 087h, 0BFh
DB 0F6h, 000h, 0BFh, 0F6h, 0B4h, 000h, 060h, 060h, 000h, 000h, 000h, 000h, 081h, 000h
DB 090h, 000h, 000h, 000h, 080h, 0F8h, 06Fh, 000h, 068h, 0E2h, 0B8h, 000h, 000h, 015h
DB 081h, 000h, 0B4h, 000h, 000h, 000h, 081h, 068h, 0E2h, 000h, 0F8h, 06Fh, 050h, 000h
DB 03Ch, 022h, 080h, 000h, 000h, 0BFh, 0F6h, 000h, 081h, 060h, 060h, 000h, 000h, 000h
DB 000h, 000h, 0E2h, 0B8h, 000h, 000h, 015h, 081h, 068h, 000h, 000h, 000h, 000h, 000h
DB 0F8h, 06Fh, 090h, 000h, 0CFh, 0D5h, 080h, 000h, 0DEh, 000h, 001h, 000h, 000h, 001h
DB 0CFh, 000h, 000h, 000h, 000h, 000h, 000h, 015h, 000h, 000h, 050h, 000h, 000h, 000h
DB 0E7h, 08Ch, 057h, 000h, 0FFh, 000h, 017h, 000h, 01Eh, 0C8h, 015h, 000h, 020h, 02Bh
DB 087h, 000h, 000h, 000h, 000h, 000h, 0F6h, 013h, 0E2h, 000h, 013h, 0E2h, 0BFh, 000h
DB 06Fh, 0BFh, 0F6h, 000h, 000h, 000h, 001h, 000h, 0F6h, 012h, 0C5h, 000h, 057h, 000h
DB 0BFh, 000h, 001h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 0F6h, 060h, 035h, 000h
DB 003h, 031h, 0BFh, 000h, 0D5h, 000h, 000h, 000h, 000h, 001h, 0CFh, 000h, 000h, 003h
DB 031h, 000h, 06Fh, 098h, 000h, 000h, 08Ch, 080h, 0F8h, 000h, 0BFh, 0F7h, 013h, 000h
DB 000h, 003h, 031h, 000h, 046h, 08Fh, 000h, 000h, 077h, 0E5h, 0E6h, 000h, 000h, 000h
DB 001h, 000h, 0F8h, 06Fh, 0E8h, 000h, 000h, 000h, 080h, 000h, 000h, 000h, 000h, 000h
DB 000h, 000h, 000h, 000h, 000h, 001h, 005h, 000h, 03Ah, 043h, 000h, 000h, 000h, 000h
DB 05Ch, 000h, 000h, 000h, 000h, 000h, 022h, 088h, 060h, 000h, 06Fh, 0C8h, 000h, 000h
DB 0B3h, 080h, 0F8h, 000h, 0BFh, 0F8h, 047h, 000h, 0F8h, 070h, 088h, 000h, 000h, 000h
DB 080h, 000h, 031h, 003h, 031h, 000h, 000h, 000h, 003h, 000h, 0F8h, 047h, 0D1h, 000h
DB 000h, 000h, 0BFh, 000h, 0B8h, 000h, 000h, 000h, 080h, 0F8h, 06Fh, 000h, 097h, 030h
DB 093h, 000h, 016h, 015h, 044h, 000h, 088h, 001h, 067h, 000h, 046h, 08Fh, 0E6h, 000h
DB 000h, 000h, 000h, 000h, 019h, 0B8h, 000h, 000h, 01Ah, 0BFh, 0F6h, 000h, 000h, 000h
DB 0E6h, 000h, 0FFh, 0FFh, 0FFh, 000h, 018h, 06Dh, 0FFh, 000h, 08Fh, 0BFh, 0F6h, 000h
DB 0E5h, 0E6h, 046h, 000h, 000h, 000h, 000h, 000h, 0E5h, 0E6h, 000h, 000h, 07Eh, 000h
DB 00Ch, 000h, 000h, 000h, 001h, 000h, 040h, 035h, 00Bh, 000h, 044h, 0CFh, 033h, 000h
DB 07Eh, 001h, 07Eh, 000h, 00Dh, 000h, 001h, 000h, 07Eh, 001h, 07Eh, 000h, 000h, 001h
DB 001h, 000h, 07Eh, 035h, 0CCh, 000h, 001h, 07Eh, 001h, 000h, 00Bh, 000h, 000h, 000h
DB 033h, 040h, 035h, 000h, 07Eh, 044h, 0CFh, 000h, 001h, 07Eh, 001h, 000h, 07Eh, 000h
DB 000h, 000h, 001h, 07Eh, 001h, 000h, 0CCh, 000h, 001h, 000h, 001h, 07Eh, 035h, 000h
DB 032h, 001h, 080h, 000h, 033h, 040h, 035h, 000h, 07Eh, 044h, 0CFh, 000h, 001h, 07Eh
DB 001h, 000h, 07Eh, 001h, 000h, 000h, 001h, 07Eh, 001h, 000h, 0CCh, 000h, 001h, 000h
DB 001h, 07Eh, 035h, 000h, 07Eh, 000h, 000h, 000h, 000h, 000h, 001h, 000h, 0F7h, 000h
DB 000h, 000h, 03Ah, 048h, 000h, 000h, 000h, 0E8h, 041h, 000h, 015h, 0FFh, 000h, 000h
DB 067h, 000h, 000h, 000h, 0E6h, 06Ch, 001h, 000h, 057h, 05Fh, 0A4h, 000h, 001h, 080h
DB 001h, 000h, 000h, 000h, 000h, 000h, 001h, 07Eh, 000h, 000h, 09Dh, 0E7h, 08Ch, 000h
DB 0E7h, 08Ch, 063h, 000h, 000h, 000h, 017h, 000h, 000h, 000h, 000h, 000h, 0B6h, 001h
DB 07Fh, 000h, 000h, 000h, 003h, 000h, 0B6h, 0E7h, 08Ch, 000h, 001h, 07Fh, 003h, 000h
DB 09Ah, 0E8h, 012h, 000h, 0E7h, 08Ch, 053h, 000h, 041h, 046h, 08Fh, 000h, 046h, 08Fh
DB 0E8h, 000h, 08Fh, 009h, 0E2h, 000h, 015h, 0FFh, 046h, 000h, 0AEh, 046h, 08Fh, 000h
DB 0F6h, 097h, 0F0h, 000h, 000h, 000h, 005h, 000h, 03Ah, 043h, 000h, 000h, 046h, 050h
DB 05Ch, 000h, 049h, 050h, 05Ch, 000h, 050h, 054h, 043h, 000h, 034h, 042h, 055h, 000h
DB 050h, 050h, 05Ch, 000h, 04Eh, 049h, 02Eh, 000h, 053h, 000h, 049h, 000h, 070h, 0C4h
DB 0C1h, 000h, 0D8h, 080h, 0F8h, 000h, 080h, 0F8h, 070h, 000h, 060h, 098h, 018h, 000h
DB 0E8h, 044h, 081h, 000h, 080h, 082h, 009h, 000h, 0C1h, 053h, 011h, 000h, 0F8h, 070h
DB 0D8h, 000h, 0A2h, 06Eh, 080h, 000h, 087h, 0BFh, 0F6h, 000h, 0BFh, 0F6h, 0B4h, 000h
DB 0F8h, 070h, 0F4h, 000h, 098h, 018h, 080h, 000h, 040h, 081h, 060h, 000h, 082h, 009h
DB 07Eh, 000h, 053h, 011h, 080h, 000h, 070h, 0F4h, 0C1h, 000h, 008h, 080h, 0F8h, 000h
DB 080h, 0F8h, 071h, 000h, 060h, 098h, 018h, 000h, 0E7h, 098h, 081h, 000h, 080h, 082h
DB 009h, 000h, 0C1h, 053h, 011h, 000h, 0F8h, 071h, 008h, 000h, 0A2h, 06Eh, 080h, 000h
DB 087h, 0BFh, 0F6h, 000h, 0BFh, 0F6h, 0B4h, 000h, 009h, 050h, 000h, 000h, 000h, 000h
DB 082h, 000h, 08Fh, 000h, 000h, 000h, 0E7h, 062h, 046h, 000h, 000h, 001h, 077h, 000h
DB 050h, 000h, 000h, 000h, 038h, 082h, 008h, 000h, 080h, 0F8h, 071h, 000h, 060h, 098h
DB 018h, 000h, 0E7h, 064h, 081h, 000h, 080h, 082h, 009h, 000h, 0C1h, 053h, 011h, 000h
DB 0F8h, 071h, 038h, 000h, 0A2h, 06Eh, 080h, 000h, 050h, 0BFh, 0F6h, 000h, 080h, 0F8h
DB 071h, 000h, 060h, 097h, 0E4h, 000h, 016h, 0D8h, 081h, 000h, 080h, 081h, 0E9h, 000h
DB 0C1h, 053h, 011h, 000h, 0F8h, 071h, 050h, 000h, 0A2h, 06Eh, 080h, 000h, 087h, 0BFh
DB 0F6h, 000h, 0BFh, 0F6h, 0B4h, 000h, 0E8h, 050h, 000h, 000h, 000h, 000h, 081h, 000h
DB 08Fh, 002h, 086h, 000h, 046h, 08Fh, 056h, 000h, 0A0h, 002h, 086h, 000h, 0E7h, 061h
DB 08Ah, 000h, 086h, 0E7h, 061h, 000h, 056h, 08Fh, 002h, 000h, 030h, 0E7h, 061h, 000h
DB 001h, 04Fh, 089h, 000h, 04Fh, 002h, 086h, 000h, 045h, 00Fh, 00Dh, 000h, 08Fh, 0F6h
DB 097h, 000h, 0E8h, 00Fh, 046h, 000h, 06Fh, 09Ah, 01Dh, 000h, 0E7h, 0BCh, 046h, 000h
DB 0AAh, 0E7h, 06Ch, 000h, 03Ah, 043h, 0E7h, 000h, 059h, 04Dh, 05Ch, 000h, 043h, 04Fh
DB 044h, 000h, 031h, 07Eh, 055h, 000h, 053h, 041h, 05Ch, 000h, 044h, 05Ch, 04Dh, 000h
DB 070h, 05Ch, 042h, 000h, 031h, 030h, 070h, 000h, 030h, 036h, 037h, 000h, 002h, 000h
DB 036h, 000h, 046h, 08Fh, 000h, 000h, 09Ch, 002h, 087h, 000h, 089h, 030h, 0E7h, 000h
DB 087h, 001h, 04Fh, 000h, 00Bh, 04Ah, 002h, 000h, 08Fh, 01Bh, 046h, 000h, 0E7h, 0B5h
DB 046h, 000h, 00Fh, 004h, 0FBh, 000h, 00Ah, 02Fh, 045h, 000h, 010h, 0F6h, 097h, 000h
DB 000h, 000h, 000h, 000h, 08Fh, 000h, 000h, 000h, 0E8h, 013h, 046h, 000h, 06Fh, 09Ah
DB 068h, 000h, 0E8h, 022h, 046h, 000h, 0C0h, 046h, 08Fh, 000h, 046h, 08Fh, 0E7h, 000h
DB 05Ch, 03Ah, 043h, 000h, 044h, 059h, 04Dh, 000h, 055h, 043h, 04Fh, 000h, 05Ch, 031h
DB 07Eh, 000h
;
DB 006h, 006h, 006h, 006h, 006h, 006h, 006h, 006h, 006h, 006h, 006h, 006h, 006h, 006h
DB 006h, 006h, 006h, 006h, 006h, 006h, 006h, 006h, 006h, 001h, 006h, 003h, 006h, 006h
DB 006h, 006h, 006h, 006h, 006h, 006h, 006h, 006h, 006h, 006h, 001h, 000h, 004h, 004h
DB 003h, 006h, 006h, 006h, 003h, 006h, 006h, 006h, 006h, 006h, 006h, 001h, 003h, 003h, 005h, 005h
DB 003h, 006h, 006h, 003h, 006h, 006h, 006h, 006h, 006h, 006h, 001h, 002h, 000h, 004h, 005h, 005h
DB 003h, 006h, 003h, 006h, 006h, 006h, 006h, 006h, 006h, 001h, 002h, 005h, 000h, 004h, 005h, 005h
DB 003h, 006h, 006h, 006h, 006h, 006h, 006h, 001h, 003h, 002h, 005h, 002h, 000h, 000h, 005h, 005h
DB 003h, 006h, 006h, 006h, 006h, 006h, 001h, 002h, 004h, 005h, 002h, 005h, 000h, 003h, 000h, 005h
DB 003h, 006h, 003h, 003h, 003h, 003h, 001h, 002h, 004h, 002h, 005h, 002h, 000h, 004h, 000h, 005h
DB 003h, 006h, 006h, 006h, 006h, 006h, 001h, 005h, 004h, 005h, 002h, 005h, 000h, 000h, 005h, 005h
DB 003h, 006h, 006h, 006h, 006h, 006h, 006h, 001h, 001h, 002h, 005h, 002h, 000h, 004h, 005h, 005h
DB 003h, 006h, 003h, 006h, 006h, 006h, 006h, 006h, 006h, 001h, 002h, 005h, 000h, 004h, 005h, 005h
DB 003h, 006h, 006h, 003h, 006h, 006h, 006h, 006h, 006h, 006h, 001h, 002h, 003h, 003h, 004h, 005h
DB 003h, 006h, 006h, 006h, 003h, 006h, 006h, 006h, 006h, 006h, 006h, 001h, 002h, 000h, 004h, 004h
DB 006h, 006h, 006h, 006h, 006h, 006h, 006h, 006h, 006h, 006h, 006h, 006h, 001h, 003h, 006h, 003h
DB 006h, 006h, 006h, 006h, 006h, 006h, 006h, 006h, 006h, 006h, 006h, 006h, 006h, 006h, 006h, 006h
DB 006h, 006h, 006h, 006h, 006h, 006h

align 4
Bit2 DB 036h, 004h, 000h, 000h, 028h, 000h
DB 000h, 000h, 010h, 000h, 000h, 000h, 010h, 000h, 000h, 000h, 001h, 000h, 008h, 000h, 000h, 000h
DB 000h, 000h, 000h, 001h, 000h, 000h, 088h, 00Bh, 000h, 000h, 088h, 00Bh, 000h, 000h, 000h, 000h
DB 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 0BFh, 0BFh, 000h, 000h, 0FFh
DB 0FFh, 000h, 080h, 080h, 080h, 000h, 0C0h, 0C0h, 0C0h, 000h, 0ECh, 0ECh, 0ECh, 000h, 0FFh, 0FFh
DB 0FFh, 000h, 0C1h, 053h, 011h, 000h, 0F8h, 06Fh, 004h, 000h, 0A2h, 06Eh, 080h, 000h, 087h, 0BFh
DB 0F6h, 000h, 0BFh, 0F6h, 0B4h, 000h, 060h, 060h, 000h, 000h, 000h, 000h, 081h, 000h, 090h, 000h
DB 000h, 000h, 080h, 0F8h, 06Fh, 000h, 068h, 0E2h, 0B8h, 000h, 000h, 015h, 081h, 000h, 0B4h, 000h
DB 000h, 000h, 081h, 068h, 0E2h, 000h, 0F8h, 06Fh, 050h, 000h, 03Ch, 022h, 080h, 000h, 000h, 0BFh
DB 0F6h, 000h, 081h, 060h, 060h, 000h, 000h, 000h, 000h, 000h, 0E2h, 0B8h, 000h, 000h, 015h, 081h
DB 068h, 000h, 000h, 000h, 000h, 000h, 0F8h, 06Fh, 090h, 000h, 0CFh, 0D5h, 080h, 000h, 0DEh, 000h
DB 001h, 000h, 000h, 001h, 0CFh, 000h, 000h, 000h, 000h, 000h, 000h, 015h, 000h, 000h, 050h, 000h
DB 000h, 000h, 0E7h, 08Ch, 057h, 000h, 0FFh, 000h, 017h, 000h, 01Eh, 0C8h, 015h, 000h, 020h, 02Bh
DB 087h, 000h, 000h, 000h, 000h, 000h, 0F6h, 013h, 0E2h, 000h, 013h, 0E2h, 0BFh, 000h, 06Fh, 0BFh
DB 0F6h, 000h, 000h, 000h, 001h, 000h, 0F6h, 012h, 0C5h, 000h, 057h, 000h, 0BFh, 000h, 001h, 000h
DB 000h, 000h, 000h, 000h, 000h, 000h, 0F6h, 060h, 035h, 000h, 003h, 031h, 0BFh, 000h, 0D5h, 000h
DB 000h, 000h, 000h, 001h, 0CFh, 000h, 000h, 003h, 031h, 000h, 06Fh, 098h, 000h, 000h, 08Ch, 080h
DB 0F8h, 000h, 0BFh, 0F7h, 013h, 000h, 000h, 003h, 031h, 000h, 046h, 08Fh, 000h, 000h, 077h, 0E5h
DB 0E6h, 000h, 000h, 000h, 001h, 000h, 0F8h, 06Fh, 0E8h, 000h, 000h, 000h, 080h, 000h, 000h, 000h
DB 000h, 000h, 000h, 000h, 000h, 000h, 000h, 001h, 005h, 000h, 03Ah, 043h, 000h, 000h, 000h, 000h
DB 05Ch, 000h, 000h, 000h, 000h, 000h, 022h, 088h, 060h, 000h, 06Fh, 0C8h, 000h, 000h, 0B3h, 080h
DB 0F8h, 000h, 0BFh, 0F8h, 047h, 000h, 0F8h, 070h, 088h, 000h, 000h, 000h, 080h, 000h, 031h, 003h
DB 031h, 000h, 000h, 000h, 003h, 000h, 0F8h, 047h, 0D1h, 000h, 000h, 000h, 0BFh, 000h, 0B8h, 000h
DB 000h, 000h, 080h, 0F8h, 06Fh, 000h, 097h, 030h, 093h, 000h, 016h, 015h, 044h, 000h, 088h, 001h
DB 067h, 000h, 046h, 08Fh, 0E6h, 000h, 000h, 000h, 000h, 000h, 019h, 0B8h, 000h, 000h, 01Ah, 0BFh
DB 0F6h, 000h, 000h, 000h, 0E6h, 000h, 0FFh, 0FFh, 0FFh, 000h?~G
Posted on 2002-05-09 19:04:26 by buliaNaza
continue...



.data
rect RECT <> ;

.code

OnDrawitem: ;
mov ebx, [esp+16+24] ; ebx->lParam->DRAWITEMSTRUCT
mov ecx, [esp+16+20] ; ecx->wParam->control identifier
;
test ecx, ecx ; if ecx=0->menu
jne EndOd ; end
;...... ;
;...... ;
;
mov edx, [ebx].DRAWITEMSTRUCT.rcItem.top ;
mov rect.top, edx ;
mov edx, [ebx].DRAWITEMSTRUCT.rcItem.right ;
mov rect.right, edx ;
mov edx, [ebx].DRAWITEMSTRUCT.rcItem.bottom ;
mov rect.bottom, edx ;
;....... ;
;....... ;
mov ebp, [ebx].DRAWITEMSTRUCT.hdc ; ebp->hDC
mov eax, offset Bit1 ; or offset Bit2
mov ecx, offset rect ;
call StretchBitmap ; call my proc
;........ ;
;........ ;
EndOd: ;
ret ;


;Usage: ;
; mov eax, offset Bitmap ; eax->bitmap offset in memory
; mov ecx, offset rect ; ecx->offset of target rectangle
; mov ebp, hDC ; ebp->hDC
; call StretchBitmap ;
;.......................................;
StretchBitmap: ;
push ebx ;
push 0CC0020h ; dwRop, raster operation code
lea ebx, [eax+4] ; calculate pointer to BITMAPINFOHEADER
push 0 ; iUsage, DIB_RGB_COLORS
push ebx ; pointerBMI+4 ; lpBitsInfo, address of bitmap data
mov eax, [ebx-4] ; offset to bitmap data
lea edx, [eax+ebx-14] ; calculate pointer to bitmap data
mov eax, [ebx+8] ; member biHeight of BITMAPINFO
push edx ; lpBits, address of bitmap bits
;Source Rect ;
mov edx, [ebx+4] ; member biWidth of BITMAPINFO
push eax ; nSrcHeight, height of src rectangle
push edx ; nSrcWidth, width of source rectangle
push 0 ; YSrc, y=src. rect. up-left
push 0 ; XSrc, x=src. rect. up-left
;Destination Rect ;
mov eax, [ecx+12] ; nDestHeight, height dest. rectangle
mov edx, [ecx+8] ; nDestWidth, width dest. rectangle
push eax ; Ypos_max
push edx ; Xpos_max
mov eax, [ecx+4] ; YDest, y=dest. rect. up-left
mov edx, [ecx] ; XDest, x=dest. rect. up-left
push eax ; YDest, y=dest. rect. up-left
push edx ; XDest, x=dest. rect. up-left
push ebp ; ebp->hDC
call StretchDIBits ; call API
pop ebx ;
ret ;
Posted on 2002-05-09 19:08:45 by buliaNaza
Thanks for the suggestions, Brad and BuliaNaza, but I wasn't looking for a workaround. I'm trying to convert lots of old TASM code to MASM, so it's important I know *why* something fails. In this case, it seems that MASM did not understand this TASM construct

mov [(BITMAPINFOHEADER( VV_Bitmap_Info.bmiHeader)).biWidth], 800

Instead, I had to use this:

mov [ VV_Bitmap_Info.bmiHeader.biWidth], 800

If you wonder why I used that BITMAPINFOHEADER(): In the original code (not the simplyfied bugtest code), there was a register in there:

mov [(BITMAPINFOHEADER( eax ).biWidth], 800

The "cast" tells TASM that eax is a pointer to a Bitmapinfoheader. Appearently MASM does not understand this type of addressing syntax, but generates the wrong address instead of giving an error.

The correct syntax in MASM with a register seems to be:

mov .BITMAPINFOHEADER.biWidth, 800

Kudos to NaN who figured that out.
Posted on 2002-05-10 14:27:52 by james