Important alert: (current site time 7/16/2013 3:28:50 AM EDT)
 

winzip icon

WinHandler

Email
Submitted on: 10/11/2000 6:15:32 PM
By: Kimon Andreou 
Level: Advanced
User Rating: By 42 Users
Compatibility: VB 6.0
Views: 28518
 
     WinHandler lets you manipulate the existing windows on your system. You can resize, move, change style and text, kill, copy, paste, undo etc. All by using Win32 API calls. It is a good demonstration (in my opinion) of Enumeration functions, SendMessage() and SetWindowPos()
 

Windows API/Global Declarations:

Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
'**************************************
'Windows API/Global Declarations for :WinHandler
'**************************************
<check the source code>
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.
  3. Scan the source code with Minnow's Project Scanner

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.


Other 1 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Advanced category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments

10/11/2000 8:07:42 PMJeff

can you tell me how to get the window text from a edit box like you can set it in an edit box? great code! i gave it an excellent
(If this comment was disrespectful, please report it.)

 
10/11/2000 11:47:19 PMEric (EmX)

This is smooth. Nice Code. 5 stars
-EmX
(If this comment was disrespectful, please report it.)

 
10/20/2000 11:29:25 PMAnoop M Nedumkunnam

Jeff, you can use the GetWindowText API call to get the text in a window (in a text box too).
(If this comment was disrespectful, please report it.)

 
11/2/2000 7:28:04 PMJared

Hey, this is semi-relevant. If anyone knows, although this is directed to Kimon, please email me at The_Only_One_Left@hotmail.com. Anyway here's my question. For example, different instances of the Instant Message box in AIM have the same class name but different handles. However, they are all the same level, as in, not child or parent to each other. Is there a way to cycle through all the different IMs and retrieve information from each? Thanks.
(If this comment was disrespectful, please report it.)

 
11/3/2000 7:56:15 AMKimon Andreou

Jared:
If you check the source code, in the function "EnumWindowProc" in the module
"basMain" I use the function "GetClassName" which returns a string. You can
use this function in your own "EnumWindowProc" and disregard all windows
whose class name is not the one you're looking for.

(If this comment was disrespectful, please report it.)

 
11/8/2000 9:45:50 AMJohn

I know that the MSDN docs say that you can't change window styles after the window has been created. I want to change a style on-the-fly. Can it be done? Specifically I want to inhibit the resizing of a window in a foreign application.
(If this comment was disrespectful, please report it.)

 
1/25/2001 6:45:39 AMMark

This is really good piece of code, has answered some hard questions I had.

Thanks.
(If this comment was disrespectful, please report it.)

 
2/23/2001 9:54:29 AMRyan

can anyone tell my how to have my form load modally to a window that is not a part of my program but i do have the hWnd for. I'm trying to use this for the settings window of a screensaver i want it to unload if the user unloads the display properties window. any help would be greatly appreciated. rlh7234@excite.com
(If this comment was disrespectful, please report it.)

 
7/7/2001 9:37:14 PMFrank D. Jimenez

Thank you very much for the code! You've done an excellent job. I have a very strong need, though, that I was hoping you could help me with. I need to be able to release as many Windows Resources as possible. Do you know of any code that would work in WIN95, WIN98, and WIN2000? Your help would be very much appreciated.

Also, exactly what does your REFRESH WINDOWS command do?

Thanks again for your work.
(If this comment was disrespectful, please report it.)

 
7/15/2001 5:04:09 PMVitaly

Amazing! Your code helped me ALOT.

5 green circles.
(If this comment was disrespectful, please report it.)

 
3/19/2002 6:17:11 AMSalman Ashraf

Hey your code is wonderful, I gave it an excellent. But I have a question, when I run notepad with your program and then i select notepad and settext in the notepad using child window it works fine, but how can I paste the text continuing from the cursor, suppose I write hello, in notepad and then switch to your code and type "how are you" in the text box of child window and after that the notepad displays me hello, how are you (i.e it pastes the how are you after hello, Please let me know this, I'm very depressed over this one.
(If this comment was disrespectful, please report it.)

 
7/27/2002 2:12:24 PMAnph

Jeff, If you want to set the text for a entrybox you need three things. You need the API, the constant and a window handle for a textbox.

Private Declare Function SendMessageByString Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long
Private Const WM_SETTEXT = &HC

Sub Main()
call SendMessageByString(frmMain.Text1.hWnd, WM_SETTEXT, 0&, "Hello")
End Sub
(If this comment was disrespectful, please report it.)

 
8/9/2002 6:16:31 PMegbert

hello,

great code, but i could not find what i needed i need a code to recieve the text thats currently in the textbox. do you know how to do that? please help :'( mail me if you know
(If this comment was disrespectful, please report it.)

 
11/4/2005 8:48:28 PMIron

could you help me with some stuff related with window??? If yes, please mail me ironmancomsono@uol.com.br

Tnx!
(If this comment was disrespectful, please report it.)

 
3/7/2006 7:53:06 AMVadim Tepper

eqbert and iron... for winds and controls stuff check out this page. http://www.autoitscript.com/autoit3/docs/ Free vb dll also available there.
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.