I'm totally new to Masm and tryed to find some examples of how to write to the the video memory to write or draw pixels onto the screen. Could someone help me and explain how I would achieve this and also how to make a EXE file that runs but without a window.
Thanks to anyhow who replies.
Hi death-tree,
Welcome on board. I move the topic to the Campus so you would get more answers.
Writing to video memory in 32 bit protected mode is very different to DOS graphics. Your options are use the GDI Windows API functions or alternatiively use OpenGL or DirectX where you can get direct access to video memory. Have a look in the OpenGL forum as "hitch" knows a lot about this stuff.
Would you know how to just simply set a pixel onto the screen like in C++: SetPixel(hwnd,X,Y,RGB(255,255,255));
Quote from: death-tree on August 14, 2006, 03:04:07 PM
Would you know how to just simply set a pixel onto the screen like in C++: SetPixel(hwnd,X,Y,RGB(255,255,255));
With SetPixel (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/bitmaps_3030.asp) maybe? :wink
If you do not know how to obtain an HDC and the like. I would suggest you use the forum search as that question comes up very regularly.
Mhh yes I know how to set a pixel in C++ (I did post the code?!?). I was wondering how to do it in masm.
That is not much more difficult.
; Macro borrowed from Iczelions tutorials
RGB macro red,green,blue
xor eax,eax
mov ah,blue
shl eax,8
mov ah,green
mov al,red
endm
invoke SetPixel, hwnd, X, Y, RGB(255,255,255)
:8)
Quote from: death-tree on August 14, 2006, 12:49:10 PM
...also how to make a EXE file that runs but without a window.
May I ask why you want to do this?
If there is no window, the user cannot close it easily.
Hello,
With graphics all begin with getting the graphic space of the object.
If the object is a window whose handle is Hwnd
Quote
invoke GetDC,Hwnd ;or other simular functions specified for the painting object
mov Hdc,eax
........
invoke SetPixel,Hdc, X, Y, RGB(255,255,255)
You can also have to create the object to draw with,for example a pen
Quote
invoke CreatePen,PS_SOLID,1,couleur
mov Hpen,eax
and draw with it when he is created
Quote
invoke MoveToEx,Hdc,10,300,NULL
But cannot do it on the desk,you need a window .
ToutEnMasm
Nvm about how to make a programme without window.
Anyways thx for the replies, going to give them a try now. Thanks
...also how to make a EXE file that runs but without a window.
I've managed to do that quite a few times by accident while trying to learn win32asm so it can't be that difficult :bg :lol :bg
Yeah i found out how to do it, it's the same as in C++.