flat assembler
Message board for the users of flat assembler.

Index > Windows > How can i get all my windows on my computer?

Author
Thread Post new topic Reply to topic
lilljocke



Joined: 28 Dec 2004
Posts: 34
Location: Sweden
lilljocke 17 Jun 2005, 19:41
I wonder how can i get all my windows on my computer?
can i use EnumWindows? How?
Post 17 Jun 2005, 19:41
View user's profile Send private message Visit poster's website Reply with quote
coconut



Joined: 02 Apr 2004
Posts: 326
Location: US
coconut 17 Jun 2005, 20:26
EnumWindows is the answer. the system will send you a message containing the handle to every top-level window. you can do whatever processing you like or get child level windows by using EnumChildWindows. after processing the message, return true to get the next window. if youve found a particular window handle and want to stop the enumwindows, return false

try something like:

....
invoke EnumWindows,EnumWindowsProc,0
....


proc EnumWindowsProc,hwnd,lparam
...process handle...
...call EnumChildWindows...
mov eax,1
endp
Post 17 Jun 2005, 20:26
View user's profile Send private message Reply with quote
lilljocke



Joined: 28 Dec 2004
Posts: 34
Location: Sweden
lilljocke 17 Jun 2005, 20:37
thanks a lot Very Happy i just missed that hWnd:DWORD,lParam:DWORD Sad.
Post 17 Jun 2005, 20:37
View user's profile Send private message Visit poster's website Reply with quote
lilljocke



Joined: 28 Dec 2004
Posts: 34
Location: Sweden
lilljocke 26 Jun 2005, 13:41
I notice that EnumWindows doesn't get the windows after the Taskbar's order how can i get the taskbar windows order?
Post 26 Jun 2005, 13:41
View user's profile Send private message Visit poster's website Reply with quote
coconut



Joined: 02 Apr 2004
Posts: 326
Location: US
coconut 26 Jun 2005, 15:37
i dont understand what you mean by 'after taskbar's order' could you be more specific? maybe the windows youre looking for are child windows of some other window, did you try EnumChildWindows?
Post 26 Jun 2005, 15:37
View user's profile Send private message Reply with quote
Azu



Joined: 16 Dec 2008
Posts: 1159
Azu 03 Apr 2009, 20:59
I think he wants to get the windows in the order they appear in the taskbar.
Post 03 Apr 2009, 20:59
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 03 Apr 2009, 22:28
Yep, I think that too, but " 17 Jun 2005, 17:37" probably means that he doesn't care anymore Very Happy
Post 03 Apr 2009, 22:28
View user's profile Send private message Reply with quote
Azu



Joined: 16 Dec 2008
Posts: 1159
Azu 03 Apr 2009, 22:51
I'm kind of curious to though. :p
Post 03 Apr 2009, 22:51
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
Picnic



Joined: 05 May 2007
Posts: 1404
Location: Piraeus, Greece
Picnic 23 Jun 2009, 13:13
Searching google for a simple way to shut off my monitor through code, i discovered this small tip that seems to work.
I felt it's better not to start a new topic and just glue it here.

Code:
        ; shut off monitor
        ; tested on Windows XP SP3
        format PE GUI 4.0

        include 'include\win32ax.inc'

        HWND_BROADCAST = -1

main:
.code
        ; stop interaction for 500 ms
        invoke Sleep, 500

        ; lParam value -1 - turn on, 1 - low power, 2 - shut off
        invoke SendMessage, HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, 2

        ; terminate process
        invoke ExitProcess, 0
.end main
    
Post 23 Jun 2009, 13:13
View user's profile Send private message Visit poster's website Reply with quote
eskizo



Joined: 22 Nov 2005
Posts: 59
eskizo 24 Jun 2009, 18:51
Is this code dangerous to monitor hardware?

Code:
format PE GUI 4.0
include 'include\win32ax.inc'

HWND_BROADCAST = -1

.code      

        mov ecx, 0x0000FFFF

        @@:
        push ecx

        invoke SendMessage, HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, -1
        invoke SendMessage, HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, 2

        invoke Sleep, 1

        pop ecx
        loop @b

        invoke ExitProcess, 0

.end
    
Post 24 Jun 2009, 18:51
View user's profile Send private message Reply with quote
Picnic



Joined: 05 May 2007
Posts: 1404
Location: Piraeus, Greece
Picnic 29 Jun 2009, 09:03
Hi eskizo,
I guess it's not safe to rely on this method. It works on my monitor(s) but beyond that i don't know.
Post 29 Jun 2009, 09:03
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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.