Jump to content
Sign in to follow this  
wnight77

How Exactly Does WinList Work

Recommended Posts

wnight77

Hi again fellas. This one should be a quicky and ive read some post on the forums about simular stuff but im having some difficulties still so i thought id give it a new topic ^.^

I am trying to mirror the effect that WinList has in autoit in C# but im not quite sure how to go about it. some ideas ive had are..

1. use findwindow and nextwindow in a loop to filter out only the windows with the name i want.

2. somehow use enumerate windows to get the desired results <no idea how that would work>

3. some great other methode that works 1million times better than a more experianced win32 dev. comes up with that can point me in the right direction not nessasarly tell me the answer<best option hehe>

4. i can die in a fire =X

Share this post


Link to post
Share on other sites
SmOke_N

EnumWindows

EnumChildWindows


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites
wnight77

Hmmm when i look at Enum Windows and Enum ChildWindows tho its Declared and a Bool... so how can i use that in user32 to return a array of windows? and how would i filter out the windows i want? i mean i know i filter easy if i had an array of the data however i do not understand how i go from point a to point b

BOOL EnumWindows(

WNDENUMPROC lpEnumFunc,

LPARAM lParam

);

lpEnumFunc

[in] Pointer to an application-defined callback function. For more information, see EnumWindowsProc.

lParam

[in] Specifies an application-defined value to be passed to the callback function.

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

If EnumWindowsProc returns zero, the return value is also zero. In this case, the callback function should call SetLastError to obtain a meaningful error code to be returned to the caller of EnumWindows

My best guess is Lparam can be the Title of the Windows im looking for but i mean its a total guess and no idea what the other variable is for.

Edited by wnight77

Share this post


Link to post
Share on other sites
SmOke_N

You need to use a callback function, if you don't know how to do that, then you should probably go to a C# site and ask them.


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites
wnight77

yeah ill have to brush up on my c# ive been using it for awhile but my college dosnt go over windows API and such so im self teaching all of these parts. thanks for the point in the right direction ill go take a look into the matter and find out exactly how to use enumwindows correctly thank you again for the point in the right dir. i had a feeling it would be enum windows its just that i had no idea how to use it properly so i was hoping it wasnt haha. anyways thnx again man.

oh man i let myself get all worked up for nothing Easy pie i just need to right a function that handles the returned HWND values for example i pass the returned HWND and the "Match" i want and then create an array all done in this "callback" function easy pie thnx again for the tip i leanred alot =)

so to clearify for anyone else reading...

1. Call EnumWindows

Param1=CallbackFunction Adress

lParam = (for me) Window Titles to Filter

2.Have your Callback Function use EnumWindows HWND pass + LParam - Compare if Match add to your Array of Stuff also u can use a Counter to even add the Totale like WinList Does.

Edited by wnight77

Share this post


Link to post
Share on other sites
SmOke_N

yeah ill have to brush up on my c# ive been using it for awhile but my college dosnt go over windows API and such so im self teaching all of these parts. thanks for the point in the right direction ill go take a look into the matter and find out exactly how to use enumwindows correctly thank you again for the point in the right dir. i had a feeling it would be enum windows its just that i had no idea how to use it properly so i was hoping it wasnt haha. anyways thnx again man.

oh man i let myself get all worked up for nothing Easy pie i just need to right a function that handles the returned HWND values for example i pass the returned HWND and the "Match" i want and then create an array all done in this "callback" function easy pie thnx again for the tip i leanred alot =)

so to clearify for anyone else reading...

1. Call EnumWindows

Param1=CallbackFunction Adress

lParam = (for me) Window Titles to Filter

2.Have your Callback Function use EnumWindows HWND pass + LParam - Compare if Match add to your Array of Stuff also u can use a Counter to even add the Totale like WinList Does.

In your case you don't really need an array, I generally just pass a byref struct type to my enum processing function, and get all the info I want (ie.. hwnd/title/window rect/client rect/class etc...).

Glad you found how easy it was to do.


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.