home *** CD-ROM | disk | FTP | other *** search
- VBClean
- VB Clean
- Form1
- cmdSave
- &Save/Load
- FindWindow
- lpClassName
- lpWindowName
- GetActiveWindow
- GetWindowText
- lpString
- nMaxChars
- SetActiveWindow~
- Window_Captionn
- RtnLen
- WndCaption
- Active_Window_Caption
- cmdSave_Click
- cmdSave_Click_proc
- FileName
- ProjectName
- LastFileName
- VBhWnd
- this_dir
- VB_Class_Name
- Design_Window_Caption
- Abort_if_caption_is_not
- default_filename
- FilaName
- MB_ICONSTOP
- MB_OK
- captionn
- The cmdSave_Click_Proc does most of the work in this program.
- Refer to it for an explanation of how the program works.g
- David Hitee
- Compuserve ID: 72130,2400
- Userr
- Window_Caption
- Initialize a string for an API call-
- Get Window caption
- Strip Chr$(0)d
- Active_Window_Caption
- cmdSave_Click
- cmdSave_Click_proc
- This program works by saving the name of the last file in the project
- window, then going to the first file in the project
- window and doing a save/load on each file in thee
- project. It stops after doing the last file. At each step, it
- compares the caption of the active window to the one it expects and
- aborts if they don't match.
- wndclass_desked_gsk"
- Microsoft Visual Basic [design]"
- Make sure VB is running before we do anything
- And make sure it's the active windowi
- Save the current directory name. We will use it explicitly to save/load3
- each text file, since form and module files in different directoriesl
- confuse the save/load process sometimes.l
- Now compose the fully qualified filename to use for each save/load.
- We use the same filename each time to avoid generating lots ofl
- unnecessary txt files.m
- vbclean.txt"
- Make sure that the Design Window is not minimized. The following is
- the only way that I've been able to guarantee this, since the API
- functions IsIconic and OpenIcon do not appear to work correctly for
- ' Visual Basic for some reason.
- %wp{Home}{Enter}
- Find out the name of the last form or module in the project windowr
- Go to the project windowt
- Save the project name
- {END}"
- Move to last file
- open code windowi
- Save the name of the last file
- The active window is still the project window, which means that
- F7 did not open the code window, so this entry
- is not a module or a form. It's most likely a custom control.t
- Anyway, whatever it is, we can't and don't want to do a save/load
- for this file, so get the previous one.
- Now we know the name of the last form or module in the project.
- Go back to the first file in the project window.i
- Close the code window
- Go back to the project window
- {HOME}
- Go to the first file
- Now loop through each file in the project, doing a save/load for each
- Open code windowt
- Get the module name
- The active window is still the project window, which means that
- F7 did not open the code window, therefore this entry
- is not a module or a form. Skip it.r
- Code|Save
- Save Text"$
- Enter the filename to save
- {ENTER}"
- Save txt file
- Microsoft Visual Basic
- It's asking us if we want to replace an existing text file. Say yes.
- {ENTER}"
- Code|Load
- Load Text"$
- Enter filename & Click "Replace"
- Code Menu|Close
- Open the project window
- Expected Project Window. Program Stopped.
- {DOWN}
- Go to the next file
- Now delete the text file that we were using in the save/load process.
- Visual Basic [Design] is not running."
- Nothing done."
- VBhWnd
- Abort_if_caption_is_not
- If the caption of the currently active window does not
- match the "caption" parameter, stop this program. It means
- that we have an unexpected window displayed.g
- Expected:
- Found: "
- Program stopped.
-