Solved

how to disable minizing of MDI form?

Posted on 2002-05-18
9
177 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
 
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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 

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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

706 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now