Solved

how to disable minizing of MDI form?

Posted on 2002-05-18
9
179 Views
Last Modified: 2010-05-02
Hi ,
   I have Set the 'windowstate' property of my MDI form to 2( vbMAximized). When running my application, the form is loaded In  the maximized mode. If i  double click the  MDi form's caption( form Title bar)., then it is minimized. I do not want it to get minized even if i click on the Form's Title bar.
  Can any one give the solution.

Thanks is advance
Fathima
0
Comment
Question by:fathimasulthan
9 Comments
 
LVL 3

Expert Comment

by:SirNick
ID: 7018136
Hello fathimasulthan

You could use the following as the resize procedure.

Private Sub MDIForm_Resize()
    MDIForm1.WindowState = 2
End Sub

Hope this helps...
0
 
LVL 12

Expert Comment

by:roverm
ID: 7019552
You can also just disable the Minimize button by setting the MinButton property to false.

D'Mzzl!
RoverM
0
 
LVL 3

Accepted Solution

by:
SirNick earned 50 total points
ID: 7019744
Hi

roverm, there is no MinButton property for MDI forms although you can still manage to do the same thing by using the following.

''''''''''''''''''''''''''''''
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long

Const WS_MINIMIZEBOX = &H20000
Const WS_MAXIMIZEBOX = &H10000
Const GWL_STYLE = (-16)

Sub MDIForm_Load()
   Dim lWnd as Long
   lWnd = GetWindowLong(Me.hWnd, GWL_STYLE)

   lWnd = lWnd And Not (WS_MINIMIZEBOX)
   lWnd = lWnd And Not (WS_MAXIMIZEBOX)
   lWnd = SetWindowLong(Me.hWnd, GWL_STYLE, lWnd)
End Sub

'''''''''''''''''''''''''''''

I must admit that I cannot take the credit for the code, I was given it.

fathimasulthan, I would sugest that you use both pieces of code to solve your problem unless someone else comes up with a better solution.

Hope this helps...
0
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
LVL 12

Expert Comment

by:roverm
ID: 7019750
Whoops, SirNick, you are correct, I thought fathimasulthan meant the MDIChild forms...
Siwwy me ;-)

Good catch tho!

D'Mzzl!
RoverM
0
 

Author Comment

by:fathimasulthan
ID: 7064102
Hi SirNick,
   Thanks for ur Reply. I tried ur code. it works.. But The Mdi is getting minimzed first and then it becomes maximized. at that time I am getting the Flickering effect. Without that flickering effect could it be done???

  I tried, by adding teh line Me.Windowstate= vbmaximized in resize event of the MDI form, which is similar to ur code. I am getting the Flickering effect...

 Thanks

Fathima
0
 
LVL 3

Expert Comment

by:SirNick
ID: 7064263
Hello fathimasulthan

I'm sorry I don't know any other way.
0
 
LVL 3

Expert Comment

by:SirNick
ID: 7064267
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7817865
Hi fathimasulthan,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept SirNick's comment(s) as an answer.

fathimasulthan, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
0
 

Expert Comment

by:SpideyMod
ID: 7909717
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question