O
As first parameter https://msdn.microsoft.com/en-us/library/windows/desktop/dd145078%28v=vs.85%29.aspx accepts not the window identifier, but the identifier of the context of the device (in this case, the window identifier). The design of the device is simplified to compare with the drawing hottest.In your case, you need to get this identifier through a function. BeginPaint, draw a picsel, then release the context with help EndPaint♪Communication code WM_PAINT It' be like this:invoke BeginPaint, hwnd, addr ps
invoke SetPixel, eax, 15, 20, 65285
invoke EndPaint, hwnd, addr ps
It is also necessary to declare a variable pswhich is a structure https://msdn.microsoft.com/en-us/library/windows/desktop/dd162768%28v=vs.85%29.aspx ♪ It is likely that this structure is already defined in some of the MASM packages that are connected. addr - the key word for the variable address.For several challenges SetPixel For example:invoke BeginPaint, hwnd, addr ps
push ebx
mov ebx, eax
invoke SetPixel, ebx, 15, 20, 65285
invoke SetPixel, ebx, 30, 20, 65285
invoke SetPixel, ebx, 45, 20, 65285
pop ebx
invoke EndPaint, hwnd, addr ps
This is an option without an additional variable. Under agreements stdcall and cdecl, the resulting procedures should not modify registers ebx♪ edi♪ esi (but may be modified eax♪ ecx♪ edxThat's why ebxe.g. may be used for temporary storage of values that should not be laundry with procedural challenges. But since procedure WndProc must also comply with the stdcall agreement, before modification ebx His meaning needs to be preserved and restored. It can be done either locally, around the location where the modification takes place. ebx (as shown in this example) either maintain at the beginning of the procedure and at the end (precede) ret- re-establish.Another comment is that the colour code is better to be written in pulp form, in this case. 00FF05hThen it's clear that this color is closer to green. 0x00bbggrraccording to the type description https://msdn.microsoft.com/en-us/library/windows/desktop/dd183449%28v=vs.85%29.aspx )