home *** CD-ROM | disk | FTP | other *** search
- VBSqueeze
- VB Squeeze
- Form1%
- btnSave
- &Save/Load Text
- FindWindow
- lpClassName
- lpWindowName
- GetActiveWindow
- GetWindowText
- lpString&
- nMaxChars
- SetActiveWindow
- FALSE
- FileName0
- OldFileName
- btnSave_Click
- VBhWnd>
- ActivehWnd
- PrevhWnd
- Clipboard
- WndCaption
- RtnLen
- MB_OK
- Form_Unload
- Cancel<
- VB SQUEEZE
- * What is it?
- . *'
- * VB Squeeze is another useful(hopefully) little utility *'
- * that will save some of you some time and make your life *'
- * a little easier.
- * What does it do?
- * We all know that VB accumualates extra garbage in our
- * Form files, and such, while we work, and the only way to *'
- * get rid of it is to do a SaveText/LoadText for each of *'
- * our forms. This can get to be very tedious indeed, so *'
- * VB Squeeze will do it for you, for each file in your
- * project.
- * How does it work?
- ( *'
- * VB Squeeze uses SendKeys to activate VB and perform the *'
- * necessary operations on each file.
- * WARNING!
- * I just got this idea and wanted to see if it would
- * work so I threw it together very quickly. The code is
- * commented but you will want to look it over for obvious *'
- * bugs that I missed and places to improve it(like error *'
- * checking of some sort). Since it relies on SendKeys it *'
- * is not the most reliable method of doing this but, hey, *'
- * it works. USE IT AT YOUR OWN RISK. If you modify and
- * improve it I would love to hear about it. If you think *'
- * it's a lousy idea and a complete waste of time I want
- * to know that too.
- ( *'
- * PLEASE!
- 2 *'
- * Look through the code before you run it(and don't use
- * it on anything important at first) so you know what it *'
- * does to get the job done. You may want to modify it to *'
- * operate on a single file instead of all the files in
- * your project.
- , *'
- * NOTES:
- * The biggest note is this. If you have two files with
- * the same prefix(i.e. MYAPP.FRM & MYAPP.BAS) then
- * VB Squeeze will stop if they are consecutive in the
- * project window(the global file seems to be the biggest *'
- * culprit). The reason is this. As VB Squeeze moves down *'
- * the list of files in the project window it compares the *'
- * name of the last file with that of the current file,
- * and, if they match, it assumes it's at the last file.
- * I hope someone comes up with a better method for this. *'
- * Why does only the prefix need to match? The filename is *'
- * taken from the Code|Save dialog box and .TXT is appended *'
- * automatically.
- * Error checking doesn't exist. You will want to add this *'
- * for safety(check for pre-existing files and such).
- * IMPROVEMENTS:
- , *'
- * Please do! I don't have the time to really make this a *'
- * priority project and I HATE doing the SaveText/LoadText *'
- * mambo.
- * Maybe the saved text could be opened and all the
- * comments and blank lines could be stripped to comapct
- * code before compilation.
- * Comments? Suggestions? I want 'em!
- * Gregg Irwin CIS:ID 72450,676
- Userr
- Const NULL = 0&
- '--If you want to pass NULL to FindWindow*
- btnSave_Click
- -- Class name for VB = "wndclass_desked_gsk"
- -- Caption for VB
- = "Microsoft Visual Basic [design]"o
- wndclass_desked_gsk
- Microsoft Visual Basic [design]
- -- Make sure VB is running before we do anything
- -- If VB isn't active then activate it.n
- -- Save the handle of the currently active window
- and activate VB.
- -- Start with a clean clipboardn
- !@#$%^&*()
- -- Initialize OldFileName so we don't have
- a match by accident or coinicidence.l
- -- Move to first file in project window-
- %{F6}
- -- Move to next VB owned window
- -- Initialize a string for an API call
- -- Get Window captiona
- -- Strip Chr$(0)
- -- We found the project window
- {HOME}
- -- Move to first fileh
- -- For each file in the project...
- Save the code as text and then reload it to get
- rid of all the old trash that hangs around.
- -- Reset file name for next iteration-
- -- Code|Save
- ^{INSERT}{ENTER}
- -- Clip filename to clipboard & Save txt file
- -- Save filename in variable
- -- Find the project window
- %{F6}
- -- Move to next VB owned window
- -- Initialize a string for an API call
- -- Get Window captiona
- -- Strip Chr$(0)
- -- We found the project window
- -- If you don't open the code window before loading-
- the text it will load as a separate module.
- --Open code window
- --Code|Loadd
- +{INSERT}%R
- --Paste filename & Click "&Replace"
- -- Close the window before moving to the next file
- otherwise the focus won't be in the project
- window(and you're in big trouble then).
- % %{F4}
- --System Menu|Close-
- * NOTE: The File|Save command is commented out for good
- reason. As I was working on this I ran the program *'
- to test it and it ate my file(becuase it loads the *'
- text in over the original file code). I consider
- this to be a bad thing. I recommend that you let it *'
- Save/Load-Text all your files and then look at them *'
- to make sure it all worked *before* you save them. *'
- This is a quick hack with very little planning and *'
- forethought behind it. MAKE NO ASSUMPTION THAT IT
- IS A FULLY TESTED PROGRAM THAT WILL WORK FOR YOU!!! *'
- I say this because it works on your entire project *'
- and could destroy a lot of work. I am posting this *'
- app and all it's source in the hopes that someone
- will find it useful(and maybe improve it as well). *'
- I don't have time right now to make it bulletproof. *'
- **SendKeys "%FS", TRUE
- '--File|Save
- {DOWN}
- --Move to next filee
- Visual Basic is not running
- VB Squeeze...Didn't
- Len(VBhWnd)c
- -- Un-REM this to re-activate the window that wase
- active when we started.
- dummy = SetActiveWindow(PrevhWnd)
- Form_Unload
-