home *** CD-ROM | disk | FTP | other *** search
- ' ********************************************************
- ' MDI Standard Application Shell
- ' ********************************************************
- '
- ' SUMMARY
- ' -------
- ' This file is part of an MDI application "skeleton"
- ' created by John Blessing of Leigh Business Enterprises Ltd.
- '
- ' FEATURES
- ' --------
- ' Selection of application database.
- ' Compact/Repair of database.
- ' 'Helptips' on toolbar items.
- ' Support for Help files.
- ' MDI child forms tiling etc.
- ' Error trapping.
- ' 'Nag' screen support for shareware authors.
- ' Support for 3D dialogs (switched off in design mode
- ' to prevent GPFs)
- '
- ' USE
- ' ---
- ' You need VB Pro to use this shell, although it could be
- ' modified to run under the standard edition.
- '
- ' You will need to set up some information in APP.BAS,
- ' particularly in SetAppInfo(). You will also need to add
- ' your own application specific code to this module.
- '
- ' DISTRIBUTION
- ' ------------
- ' This program is "FreeWare" and may be used and distributed
- ' as you wish.
- '
- ' It incorporates some ideas/code from other authors and these
- ' are acknowledged in the appropriate module.
- '
- ' We hope that you will find it useful. If you wish to discuss it
- ' then please e-mail us on Compuserve 100444,623.
- '
- ' ADVERTISEMENT!
- ' --------------
- ' Are you looking for a helpdesk system? Or does your company
- ' want to track and monitor the progress of any work activity?
- ' We market a system which could be of interest to you.
- '
- ' PROGRESS is available for download from the Business section
- ' of the Windows Shareware forum on Compuserve
- ' (filename PRGRSS10.ZIP). It's a large program, so in the
- ' same section you will also find the help files and
- ' documentation as PRGSSDOC.ZIP which is quicker to download
- ' and will give you a good idea of the functionality of PROGRESS.
- '
- ' Dec 1994
- '
- 'The KeepOnTop function is taken from the Dec 94
- 'Visual Basic Tips and Tricks
- '
- Option Explicit
-
- 'centre a form on the screen or within mdiMain if a child
- 'if not an mdi form then call with frmParent = ""
- Sub centre (frmChild As Form, frmParent As Form)
-
- If frmChild.WindowState <> 0 Then Exit Sub
-
- If TypeOf frmChild Is MDIForm Then
- 'centre on the screen
- frmChild.Move (screen.Width - frmChild.Width) \ 2, (screen.Height - frmChild.Height) \ 2
- ElseIf (frmChild.MDIChild = True) And Not (frmParent Is Nothing) Then
- 'centre the mdichild
- frmChild.Move (frmParent.ScaleWidth - frmChild.Width) \ 2, (frmParent.ScaleHeight - frmChild.Height) \ 2
- Else
- 'centre on the screen
- frmChild.Move (screen.Width - frmChild.Width) \ 2, (screen.Height - frmChild.Height) \ 2
- End If
-
-
- End Sub
-
- '======================================================================
- 'Form/Module:
- ' Forms.bas
- '
- 'Procedure:
- ' CloseAllChildren
- '
- 'Modifications:
- ' 23/12/94 JBL Build
- '
- 'Description:
- ' Closes all but the main MDI form in an application
- '======================================================================
- Sub CloseAllChildren ()
- 'Used for loop through forms
- Dim i, max, temp, abort As Integer
-
- 'General Error Handler
- If Not bDesignMode() Then
- On Error GoTo Error_CloseAll
- End If
-
- max = forms.Count - 1
- i = 0
- abort = False
- Do While i <= max
- If TypeOf forms(i) Is MDIForm Then
- 'do nothing
- i = i + 1
- Else
- temp = forms.Count
- Unload forms(i)
- If temp = forms.Count Then
- abort = True
- Exit Do
- End If
- max = max - 1
- End If
- Loop
-
- Exit Sub
-
- Error_CloseAll:
- 'call the generic error handler
- GenErrorHandler "Forms.bas - CloseAllChildren()", Err, Error$
-
- Resume Exit_CloseAll
-
- Exit_CloseAll:
-
-
- End Sub
-
- '*******************************************************
- '* Procedure Name: KeepOnTop *
- '*-----------------------------------------------------*
- '* Created: 4/18/94 By: KeepOnTop *
- '* Modified: By: *
- '*=====================================================*
- '*Keep form on top. Note that this is switched off if *
- '*form is minimised, so place in resize event as well. *
- '* *
- '* *
- '* *
- '*******************************************************
- Sub KeepOnTop (F As Form, Mode As Integer)
- 'Keep form on top. Note that this is switched off if form is
- 'minimised, so place in resize event as well.
- Const wFlags = SWP_NOMOVE Or SWP_NOSIZE
-
-
- If Mode Then
- SetWindowPos F.hWnd, HWND_TOPMOST, 0, 0, 0, 0, wFlags
- Else
- SetWindowPos F.hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, wFlags
- End If
-
- DoEvents
- End Sub
-
-