Solved

how to disable minizing of MDI form?

Posted on 2002-05-18
9
181 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

 
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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

726 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