• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 187
  • Last Modified:

how to disable minizing of MDI form?

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
fathimasulthan
Asked:
fathimasulthan
1 Solution
 
SirNickCommented:
Hello fathimasulthan

You could use the following as the resize procedure.

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

Hope this helps...
0
 
rovermCommented:
You can also just disable the Minimize button by setting the MinButton property to false.

D'Mzzl!
RoverM
0
 
SirNickCommented:
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

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

Good catch tho!

D'Mzzl!
RoverM
0
 
fathimasulthanAuthor Commented:
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
 
SirNickCommented:
Hello fathimasulthan

I'm sorry I don't know any other way.
0
 
SirNickCommented:
0
 
DanRollinsCommented:
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
 
SpideyModCommented:
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now