application window resize

xezekielx

straight edge
Local time
Today, 03:53
Joined
Jul 19, 2005
Messages
7
Hi! I wondered if it was possible to trap the 'application window resize' event. The reason I need to do this is because I have a main form (kind of like a splash screen) but it's not maximised to avoid problems with the other forms (problems like restoring, etc). So I set the main form to be the same size as the application window but I have a button on it that's dynamically positionned (in the bottom right corner) in the Form_Resize sub of the main form. If the user resizes the application window, the Form_Resize event won't be called because the main form isn't maximised per se. Any idea how I should proceed?

Thanks in advance!
 
This will all have to be done using APIs

Before going that route, I'd suggest just not dynamically positioning the button. Keep the form one size.
 
I prefer to customize and force the size of my forms with the InsideHeight & InsideWidth properties using the forms OnOpen event. I set my forms property to PopUp to NO and Modal to YES and I set the forms Control Box to NO and the Min Max buttons to NONE and the Close button to NO.

Code:
Private Sub Form_Open(Cancel As Integer)
On Error GoTo Err_Form_Open
    
    'just for testing
    MsgBox "InsideHeight = " & InsideHeight & vbCrLf & vbLf & "InsideWidth = " & InsideWidth
    
    InsideHeight = 5450 'twips is the unit of measurement
    InsideWidth = 7870
    
Exit_Form_Open:
    Exit Sub
    
Err_Form_Open:
    MsgBox Err.Number & " - " & Err.Description
    Resume Exit_Form_Open
    
End Sub
 
Hudson, for some reason he wants the forms width to be the same space as the application window. When the window is resized... he wants the form to resize too.
 
Thanks for your answers! The reason why I want my main form to be the same size as the app window is because it's splash screen. Normally, I would use the DoCmd.Maximize method to make the form the same size as the app window and to be able to trap the Form_Resize event.

The problem is that I have several forms that have to be opened later. If I use the DoCmd.Restore in the Form_Load event of these forms, the main form (the splash screen) will restore as well and I don't want that to happen. I tried opening the other windows with the acDialog argument in the DoCmd.OpenForm method, but if I do it that way, the newly opened windows won't be able to access the menu bars that I created.

If you have any other solution (simpler or more complex, it doesn't matter) that I could use, I would greatly appreciate it. If not, then I like to know which API calls I should use (and how to use them if possible, since I never used them before).

Thanks in advance!
 

Users who are viewing this thread

Back
Top Bottom