flat assembler
Message board for the users of flat assembler.
Index
> Windows > simulate a dead pixel? |
Author |
|
revolution 29 Feb 2008, 03:17
In Windows just create a window that is 1 pixel by 1 pixel and set the attributes to WS_EX_TOPMOST
|
|||
29 Feb 2008, 03:17 |
|
asmhack 29 Feb 2008, 13:00
or using gdi32.SetPixelV
|
|||
29 Feb 2008, 13:00 |
|
revolution 29 Feb 2008, 13:04
asmhack wrote: or using gdi32.SetPixelV |
|||
29 Feb 2008, 13:04 |
|
asmhack 29 Feb 2008, 13:49
get foreground window's dc, get pos x,y of the window and use a loop to set there the 'dead' pixel, but the 2 methods will not work at fullscreen applications or the applications that use for example opengl..
|
|||
29 Feb 2008, 13:49 |
|
edfed 29 Feb 2008, 13:51
Quote: In Windows just create a window that is 1 pixel by 1 pixel and set the attributes to WS_EX_TOPMOST can you show me an example pleaaase? |
|||
29 Feb 2008, 13:51 |
|
revolution 29 Feb 2008, 13:58
1. Set you WNDCLASS with a background of black.
2. invoke CreateWindowEx, blah, blah, blah, ... 3. That's all really, just process all message in the loop as default until the quit is sent. Just make sure that it doesn't take the focus else the user will know that it is just anther topmost window. |
|||
29 Feb 2008, 13:58 |
|
asmhack 29 Feb 2008, 14:35
+ hiding it from the taskbar ?
|
|||
29 Feb 2008, 14:35 |
|
revolution 29 Feb 2008, 14:50
asmhack wrote: + hiding it from the taskbar ? |
|||
29 Feb 2008, 14:50 |
|
revolution 29 Feb 2008, 14:56
Oh, one other thing that may give the game away is the cursor. If your cursor is different than the immediately underneath app then each time the user points onto the "dead pixel" the cursor will change. That will be tricky to solve if the underneath app is using it's own custom cursors.
|
|||
29 Feb 2008, 14:56 |
|
asmhack 29 Feb 2008, 15:15
yeah i thought that too.. but it's kinda hard to put your cursor over 1x1 pixel, except if the user want to click the 'deadpixel'
|
|||
29 Feb 2008, 15:15 |
|
itsnobody 01 Mar 2008, 12:02
you don't really need a window, it's unnecessary
Just use a timer Use something like this to get the hDC: Code: invoke GetDC,HWND_DESKTOP mov [hdc],eax Then in your redraw method put something like this: Code: invoke SetPixel,[hdc],x,y,0xrrggbb I tried it works just like a dead pixel Last edited by itsnobody on 01 Mar 2008, 12:29; edited 1 time in total |
|||
01 Mar 2008, 12:02 |
|
revolution 01 Mar 2008, 12:06
itsnobody: Nice trick, does it work if you have other processes that use the WS_EX_TOPMOST style?
|
|||
01 Mar 2008, 12:06 |
|
itsnobody 01 Mar 2008, 12:17
revolution wrote: itsnobody: Nice trick, does it work if you have other processes that use the WS_EX_TOPMOST style? hey revolution I was just testing it some more It seems to work over all windows, even with videos at fullscreen using VLC or WMP, but then it gets blinky, it doesn't seem to work over the cursor, and it doesn't seem to work if the user switches to fullscreen with DirectX EDIT: I got it working even in DX Fullscreen mode by adding GetDC,HWND_DESKTOP to the redraw method, but it becomes blinky |
|||
01 Mar 2008, 12:17 |
|
revolution 01 Mar 2008, 12:31
itsnobody wrote: but it becomes blinky |
|||
01 Mar 2008, 12:31 |
|
itsnobody 01 Mar 2008, 12:38
revolution wrote:
I set the timer to 1, it still blinks Here's the full code I used I'm wondering if anyone can get it working better: Code: include 'win32ax.inc' .data MessageWindow MSG hdc dd ? .code redraw: invoke GetDC,HWND_DESKTOP mov [hdc],eax invoke SetPixel,eax,100,100,0xffffff invoke ReleaseDC,HWND_DESKTOP,[hdc] ret start: invoke SetTimer,HWND_DESKTOP,0,1,redraw msg_loop: invoke GetMessage,MessageWindow,NULL,0,0 or eax,eax jz end_loop invoke TranslateMessage,MessageWindow invoke DispatchMessage,MessageWindow jmp msg_loop end_loop: invoke ExitProcess,[MessageWindow.wParam] .end start |
|||
01 Mar 2008, 12:38 |
|
revolution 01 Mar 2008, 12:42
If you have a spare core that you don't mind dedicating to this then you can just start a thread that continuously loops on itself without sleeping and just setting the pixel over and over. Not very efficient of course.
|
|||
01 Mar 2008, 12:42 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.