Solved

how to disable minizing of MDI form?

Posted on 2002-05-18
9
180 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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

839 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