flat assembler
Message board for the users of flat assembler.

Index > Windows > simulate a dead pixel?

Author
Thread Post new topic Reply to topic
edfed



Joined: 20 Feb 2006
Posts: 4242
Location: 2018
edfed
how to make a background application that simulate a dead pixel?

the goal is to be boring and take the control af the screen on windows, just to make you feel crazy...
Quote:
ho my god, i have a dead pixel on my new lcd!


i know it's posssible as i made it by accident with msdos programming bug.
it wasn't only one dead pixel but all the screen, or a full column..
Post 29 Feb 2008, 01:54
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17669
Location: In your JS exploiting you and your system
revolution
In Windows just create a window that is 1 pixel by 1 pixel and set the attributes to WS_EX_TOPMOST
Post 29 Feb 2008, 03:17
View user's profile Send private message Visit poster's website Reply with quote
asmhack



Joined: 01 Feb 2008
Posts: 431
asmhack
or using gdi32.SetPixelV
Post 29 Feb 2008, 13:00
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17669
Location: In your JS exploiting you and your system
revolution
asmhack wrote:
or using gdi32.SetPixelV
Under what DC? That won't affect an app window unless 1) you know the current top app at the coordinates you want, 2) you can get a DC for it, and then you can set the pixel. But as soon as the app redraws itself your pixel is gone.
Post 29 Feb 2008, 13:04
View user's profile Send private message Visit poster's website Reply with quote
asmhack



Joined: 01 Feb 2008
Posts: 431
asmhack
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..
Post 29 Feb 2008, 13:49
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4242
Location: 2018
edfed
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?
Post 29 Feb 2008, 13:51
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17669
Location: In your JS exploiting you and your system
revolution
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.
Post 29 Feb 2008, 13:58
View user's profile Send private message Visit poster's website Reply with quote
asmhack



Joined: 01 Feb 2008
Posts: 431
asmhack
+ hiding it from the taskbar ?
Post 29 Feb 2008, 14:35
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17669
Location: In your JS exploiting you and your system
revolution
asmhack wrote:
+ hiding it from the taskbar ?
That is easily done with the window styles in the CreateWindowEx call.
Post 29 Feb 2008, 14:50
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17669
Location: In your JS exploiting you and your system
revolution
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.
Post 29 Feb 2008, 14:56
View user's profile Send private message Visit poster's website Reply with quote
asmhack



Joined: 01 Feb 2008
Posts: 431
asmhack
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' Razz
Post 29 Feb 2008, 15:15
View user's profile Send private message Reply with quote
itsnobody



Joined: 01 Feb 2008
Posts: 93
Location: Silver Spring, MD
itsnobody
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
Post 01 Mar 2008, 12:02
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17669
Location: In your JS exploiting you and your system
revolution
itsnobody: Nice trick, does it work if you have other processes that use the WS_EX_TOPMOST style?
Post 01 Mar 2008, 12:06
View user's profile Send private message Visit poster's website Reply with quote
itsnobody



Joined: 01 Feb 2008
Posts: 93
Location: Silver Spring, MD
itsnobody
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
Post 01 Mar 2008, 12:17
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17669
Location: In your JS exploiting you and your system
revolution
itsnobody wrote:
but it becomes blinky
Maybe make your timer faster?
Post 01 Mar 2008, 12:31
View user's profile Send private message Visit poster's website Reply with quote
itsnobody



Joined: 01 Feb 2008
Posts: 93
Location: Silver Spring, MD
itsnobody
revolution wrote:
itsnobody wrote:
but it becomes blinky
Maybe make your timer faster?


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
    
Post 01 Mar 2008, 12:38
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17669
Location: In your JS exploiting you and your system
revolution
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.
Post 01 Mar 2008, 12:42
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.