My problem is that when i select the DIBSectionHandle in to my device context it appears offset from the upper left hand corner (down 100 pixels or so and to the right 50 pixels or so) i cant figure out why it is doing this pleas help me. Thanks in advance.

;Here is the code written in RosAsm

call 'USER32.GetDC' D$wHMain
mov D$wHDC eax

call 'GDI32.CreateCompatibleDC' eax
mov D$hMemDC eax

;<<<This function does not work yet need to fix later
call 'GDI32.CreateDIBSection' D$hMemDC BITMAPINFO &DIB_RGB_COLORS BitmapPointer 0 0
mov D$DIBSectionHandle eax

call 'GDI32.SelectObject' D$hMemDC D$DIBSectionHandle
;the DIBSection is not in the upper left hand corner it is offset but i cant figure out why

Posted on 2008-12-03 00:22:04 by ChaosVisum
I don't know anything about RosASM, but shouldn't that be
call 'GDI32.CreateDIBSection' D$hMemDC BITMAPINFO DIB_RGB_COLORS &BitmapPointer 0 0

Posted on 2008-12-03 17:32:34 by Ultrano
The & is a convention of RosAsm, all windows constants have it as a prefix they are built into the assembler ide

I have used nasm, fasm, goasm, spasm, masm, and radasm "editor", of them all Rosasm is the coolest by far because it has a built in debugger the lets you single step through your code, very nice

as for my code everything works except for the fact that the bitmap created by the DIBsection function when selected into the hMemDC does not appear in the upper left hand corner rather it is down and to the right of it a little.  I dont know what causes this.

I did try the constant value for the equate you mentioned, it had no different affect.
Posted on 2008-12-04 00:36:42 by ChaosVisum
btw, VisualStudio lets you debug MASM .asm code in single-step and whatever ;)
Posted on 2008-12-04 00:50:01 by Ultrano
i did not know that very interesting, is the asm syntax that is inlined in microsoft visual C++ 2008 express edition similar to MASM.  Can you code directly in assembler or do you need to inline?

I have been looking around and there seems to be something interesting about my code.  I don't think this is supposed to happen but write after i select the DIBsection into the compatibleDC that i create it appears within the client area of my main window without calling a bitblt.  Even more interesting if i do a bitblt of the compatibleDC to the main windowDC it does go to the upper left hand corner but the original DIBsection is still present.

Posted on 2008-12-04 02:46:45 by ChaosVisum
In VS, you can debug both inline and separate .asm files, attached to your C/C++ project.
I also use VS to debug my pure-masm projects, either on exception/breakpoint , or full debug with full debug-info (requires debug-switch at ml.exe)
Posted on 2008-12-04 04:50:12 by Ultrano