|
-
Nov 14th, 2001, 07:08 PM
#1
Thread Starter
Frenzied Member
Ok for the first question:
Add a Module
In the module, add this code:
VB Code:
Public Sub Main()
Load frm1
Load frm2
' etc.
End Sub
Now rightclick the project name in the file list and select Properties, then change Startup Object to SubMain
For the screen size, you can use the SysInfo control (Project, Components...scroll thru list, find Microsoft System info, check the box by it, and hit OK)
-
Nov 14th, 2001, 08:06 PM
#2
Actually, you don't event need a module. You can just load the 2nd Form from the first Form's load event. Also, frm Load only calls the Form's load event. You need to use the Show method to display it on the screen (unless you already have the code to do this in your 2nd Form)
For the screen size, and relative positioning, use the Screen object. It contains a Width, ScaleWidth, Height, and ScaleHeight property.
-
Nov 14th, 2001, 08:10 PM
#3
Thread Starter
Frenzied Member
OK I'll concede the Show thing but loading from Sub Main is better, because if you reload the form later it will try to reload the other form, and if the other form is still open -- poof, you have a crash.
Also, loading from SubMain is better coding practice because its easier to follow.
-
Nov 15th, 2001, 09:31 AM
#4
Member
To MLewis,
Thank you ! Thank you! Thank you! The Microsoft Sysinfo control did the trick. Here's the code that the I was able to put up in the Module's Sub Main():
Public lngHeight as Long ' variable to hold the screen's workarea height
Public Sub Main()
lngHeight = MDIForm1.SysInfo1.WorkAreaHeight
frmLibrary.Move 0, 0, Screen.Width / 5, lngHeight
MDIForm1.Move Screen.Width / 5, 0, (Screen.Width * 4) / 5, lngHeight
frmLibrary.Show
MDIForm1.Show
End Sub
Thank you again!!!!!
-
Nov 15th, 2001, 10:17 AM
#5
If you don't want to use a control for getting the workarea, you can use the SystemsParameterInfo API function.
The comments are in Dutch, sorry.
Put the following code in a standard module (.bas)
Code:
Private Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, ByRef lpvParam As Any, ByVal fuWinIni As Long) As Long
Public Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Const SPI_GETWORKAREA = 48
Public Sub GetWorkArea(ByRef udtRect As RECT)
' deze functie haalt de afmetingen van de workarea van de desktop op
' de taskbar, en application bars blijven hierdoor zichtbaar
Dim lngRet As Long
' haal de workarea op (functie retourneert afmetingen in pixels)
lngRet = SystemParametersInfo(SPI_GETWORKAREA, 0, udtRect, 0)
' omrekenen naar twips
With udtRect
.Left = .Left * Screen.TwipsPerPixelX
.Top = .Top * Screen.TwipsPerPixelY
.Right = .Right * Screen.TwipsPerPixelX
.Bottom = .Bottom * Screen.TwipsPerPixelY
End With
End Sub
You can use the function like this:
In a form
Code:
Private Sub MDIForm_Load()
Dim udtRect As RECT
' haal de maximum afmetingen op van de desktop
Call GetWorkArea(udtRect)
' resize naar de maximale afmetingen
Me.Move udtRect.Left, udtRect.Top, udtRect.Right - udtRect.Left, udtRect.Bottom - udtRect.Top
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|