The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: jay20 on July 11, 2011, 05:27:27 AM

Title: Monitor pixel accesing project
Post by: jay20 on July 11, 2011, 05:27:27 AM
how to access the pixel of the computer monitor using MASM32 assembler.... anybody who is knowledgeable about this please help me with the codes....
Title: Re: Monitor pixel accesing project
Post by: qWord on July 11, 2011, 05:50:43 AM
The question should be: How to access the desktop content/pixels using the WinAPI?
The simples, but also slowest method is to use GetPixel(GetDC(0),x,y) (http://msdn.microsoft.com/en-us/library/dd145078(v=vs.85).aspx) and SetPixel(GetDC(0),x,y,color) (http://msdn.microsoft.com/en-us/library/dd144909(v=vs.85).aspx). A better approach is to copy the Desktop-DC (GetDC(0)) to an memory DC (CreateCompatibleDC+CreateCompatibleBitmap) and then use GetDIBits() for accessing pixel data.