home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form SaveMe
- BorderStyle = 1 'Fixed Single
- Caption = "VB Save Me"
- ClientHeight = 360
- ClientLeft = 1110
- ClientTop = 1515
- ClientWidth = 5760
- Height = 765
- Icon = SAVEME2.FRX:0000
- Left = 1050
- LinkMode = 1 'Source
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 360
- ScaleWidth = 5760
- Top = 1170
- Width = 5880
- Begin CommandButton btnSave
- Caption = "Sav&e Project As..."
- Height = 375
- Index = 3
- Left = 3960
- TabIndex = 3
- Top = 0
- Width = 1815
- End
- Begin CommandButton btnSave
- Caption = "Sa&ve Project"
- Height = 375
- Index = 2
- Left = 2580
- TabIndex = 1
- Top = 0
- Width = 1395
- End
- Begin CommandButton btnSave
- Caption = "Save File &As..."
- Height = 375
- Index = 1
- Left = 1080
- TabIndex = 2
- Top = 0
- Width = 1515
- End
- Begin CommandButton btnSave
- Caption = "&Save File"
- Height = 375
- Index = 0
- Left = 0
- TabIndex = 0
- Top = 0
- Width = 1095
- End
- '**********************************************************'
- '* *'
- '* SAVE ME! *'
- '* *'
- '* This is just a little program that I threw together *'
- '* to help remind me to save my Forms, Files, and *'
- '* Projects while I work in VB. I have a tendency to *'
- '* make changes and run the program without saving my *'
- '* latest changes, and, if it bombs, I kick myself *'
- '* repeatedly. SAVE ME! uses SendKeys to save the *'
- '* currrent file or project in VB when in design mode. *'
- '* Obviously it is not as reliable as using the VB *'
- '* menus directly, and I use it mainly as a visual *'
- '* reminder. You can make the form even less obtrusive *'
- '* by placing it on your screen and then turning off *'
- '* Control Box and making the Form caption "". You *'
- '* won't be able to drag it around but, by putting a *'
- '* Timer on the form that looks to see if VB is still *'
- '* active, you could have it shut down automatically *'
- '* when VB is closed. *'
- '* *'
- '* Let me know if you find it useful, or not. *'
- '* *'
- '* Gregg Irwin CIS:ID 72450,676 *'
- '* *'
- '**********************************************************'
- DefInt A-Z
- Declare Function FindWindow Lib "User" (ByVal lpClassName As Any, ByVal lpWindowName As Any) As Integer
- Declare Function GetActiveWindow Lib "User" () As Integer
- Declare Function SetActiveWindow Lib "User" (ByVal hWnd As Integer) As Integer
- Const FALSE = 0
- Const TRUE = Not FALSE
- 'Const NULL = 0& '--If you want to pass NULL to FindWindow
- Sub btnSave_Click (Index As Integer)
-
- '-- Class name for VB = "wndclass_desked_gsk"
- '-- Caption for VB = "Microsoft Visual Basic [design]"
- '** NOTE: Looks for VB in DESIGN mode only **'
- VBhWnd = FindWindow("wndclass_desked_gsk", "Microsoft Visual Basic [design]")
-
- '-- Make sure VB is running before we do anything
- If Len(VBhWnd) Then
- '-- if VB isn't active then activate it.
- ActivehWnd = GetActiveWindow()
- If VBhWnd <> ActivehWnd Then
- '-- Save the handle of the currently active window
- PrevhWnd = SetActiveWindow(VBhWnd)
- End If
-
- '-- Command it to do our bidding
- Select Case Index
- Case 0 '-- Save File
- SendKeys "%FS", True
- Case 1 '-- Save File As...
- SendKeys "%FA", True
- Case 2 '-- Save Project
- SendKeys "%FV", True
- Case 3 '-- Save Project As...
- SendKeys "%FE", True
- End Select
- Else
- MsgBox "Visual Basic is not running", MB_OK, "Save Me...Didn't"
- End If 'Len(VBhWnd)
- '-- Un-REM this to re-activate the window that was
- ' active when we started.
- 'dummy = SetActiveWindow(PrevhWnd)
- End Sub
-