Contribute  :  Web Resources  :  Past Polls  :  Site Statistics  :  Downloads  :  Forum  
    BiW ReversingThe challenge is yours    
 Welcome to BiW Reversing
 Friday, August 17 2018 @ 05:28 AM CEST
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Play with hWMD's properties by using an external application

 
Post new topic   Reply to topic    www.reversing.be Forum Index -> Coding Corner
View previous topic :: View next topic  
Author Message
Devoney
Regular
Regular


Joined: 12 Sep 2005
Posts: 110
Location: The Netherlands

PostPosted: Wed Jan 24, 2007 4:38 pm    Post subject: Play with hWMD's properties by using an external application Reply with quote

Hi All,
I wanted to share the application I am making so far. It is not finished yet. that is why the executable is called project1.exe and the title of the screen is form1 Razz.

Features:
- Find a windows handle by its name or class
- Scan this window for available control by an range of ID (from 0 to 1,000,000 is doable)
- Change the propertie of this control/window by its handle to Show, Normal, Hide, Destroy (if possible), Enable and Disable
- Change its text with SetWindowText api.
- user friendly options by clicking and automatic copying values etc.

This is all I have so far. All api wrapping but I like it Very Happy.
It is written in VB6.0. Slow and messy language but in masm32 it probarly took me 10 times the time because I suck at user interface with masm32.
I have tested it on windows calculator. number "7" has control ID 131.
Hopefully you like it and give me usefull tips.

Currently apis used:
FindWindow
EnableWindow
GetDlgItem
ShowWindow
Apis I wish to add:
GetDlgItemText (but VB6 breakes down :S )
SetDlgItemText
SetWindowText
GetWindowText

Grtz Devoney



Project1.rar
 Description:
View windows/controls with this app and change their property's

Download
 Filename:  Project1.rar
 Filesize:  6.44 KB
 Downloaded:  582 Time(s)

Back to top
View user's profile Send private message Visit poster's website
bpx
Occasional Poster
Occasional Poster


Joined: 22 Jan 2006
Posts: 25
Location: Earth

PostPosted: Thu Jan 25, 2007 12:42 am    Post subject: Reply with quote

Instead of scanning for windows/controls you may consider doing this:

Call EnumWindows / EnumChildWindows

This way you can list all windows/controls rather than brute force.
Plus, no need for name of class/caption Cool


See reference @ MSDN

EnumWindows Link
EnumChildWindows Link
Back to top
View user's profile Send private message
Devoney
Regular
Regular


Joined: 12 Sep 2005
Posts: 110
Location: The Netherlands

PostPosted: Thu Jan 25, 2007 9:36 am    Post subject: Reply with quote

Gee thanks for the tip! I read yester evening about that API. Did not quiete understand how to use it. It should speed up the application very much and it wont miss any controls! (which is a big improvement Smile )
I am gonna check how I can get it running in my VB app Razz

Thanks bpx!

Update:
Just checked out the functions. I dont understand the second and third parameters:
Quote:
hWndParent
[in]
Handle to the parent window whose child windows are to be enumerated. If this parameter is NULL, this function is equivalent to EnumWindows.

Windows 95/98/Me: hWndParent cannot be NULL.

lpEnumFunc
[in] Pointer to an application-defined callback function. For more information, see EnumChildProc.
lParam
[in] Specifies an application-defined value to be passed to the callback function.


hWndParent is the handle to the window. But what do I have to use in the other parameters. I only want a list of the the windows and not a build in function which checks if it run into some certain window and close, update or whatever do with it. How can I just simply get that list?

Thanks in advance
Back to top
View user's profile Send private message Visit poster's website
bpx
Occasional Poster
Occasional Poster


Joined: 22 Jan 2006
Posts: 25
Location: Earth

PostPosted: Thu Jan 25, 2007 2:28 pm    Post subject: Reply with quote

aah, Regretfully I am not well versed in VB, but on this site you will find example code of EnumChildWindows:

VB code Examples

the code works like this though:

call EnumChildWindows,HwndOfParent,AddressOf Callback,0
// we can ignore lparam, it is not important

CallBack proc (hwnd,ignored)
{
// This hwnd is the a child we are currently scanning.
AddtoList(hwnd);
return 1; // Keep scanning till end.
}

EnumChildWindows keeps calling the Callback untill no more child HWNDs are left.

Also check the GetWindow function, you can enum all [child]windows without subprocs there, but it is less reliable.

good luck Smile
Back to top
View user's profile Send private message
Devoney
Regular
Regular


Joined: 12 Sep 2005
Posts: 110
Location: The Netherlands

PostPosted: Thu Jan 25, 2007 4:53 pm    Post subject: Reply with quote

Fast reply! Thanks, Gonna check it out right now! (as a matter of fact I am already busy Smile)

THanks bpx for the reply! I appreciate you dont only reply, but give an example code in VB and explain what is happening. I understand more how a callback function works now (and how the function itself works)

Grtz Devoney



FindWindow.rar
 Description:
VB6.0 App to change window properties. NOT FINISHED YET. But it already works. Source included.

Download
 Filename:  FindWindow.rar
 Filesize:  11.29 KB
 Downloaded:  576 Time(s)

Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    www.reversing.be Forum Index -> Coding Corner All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
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 can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
 Copyright © 2018 BiW Reversing
 All trademarks and copyrights on this page are owned by their respective owners.
Powered By Geeklog 
Created this page in 0.12 seconds