Solved

MDIForm, Windows Taskbar and GetWindowLong

Posted on 2008-06-10
4
774 Views
Last Modified: 2010-04-21
Hi
I have an MDI Parent form that I wish to disable the Maximize button on. I can do this sucessfully with GetWindowLong, SetWindowLong with no problems as below.

  Dim lngStyle As Long
  lngStyle = GetWindowLong(Me.hwnd, GWL_STYLE)
  lngStyle = lngStyle And Not (WS_MAXIMIZEBOX) 'Disables Maximize Button
  lngStyle= SetWindowLong(Me.hwnd, GWL_STYLE, lngStyle)

However once I do this, the bottom part of my MDI parent form is drawn UNDER the Windows taskbar. The MDI form has not been redrawn to fit in the Windows destop area above the Taskbar rather it looks like it has been resized to the available screen area with the Taskbar drawn over it on the bottom of the screen.

I would like to have the MDIParent form redrawn to the desktop area above the Taskbar so the whole form can be seen.

Can't figure out how to do it - over to you experts.

Thanks in advance
Graeme
0
Comment
Question by:superg65
  • 3
4 Comments
 
LVL 3

Accepted Solution

by:
NizzeK earned 500 total points
ID: 21756018
Hi!
Try this:
wMDI.Top = 1
wMDI.Left = 1
wMDI.Width = Screen.Width - 1
wMDI.Height = Screen.Height - 540
This will cover screen, except task bar of single height

BR
Nils
0
 
LVL 2

Author Comment

by:superg65
ID: 21764528
Hi Nils
Thanks for your answer. I have tried that but it doesn't do what I am after as it interferes with my code to manage screen resolution changes and I will need to repeatedly call it and change a bunch of stuff to use it.
My issue seems to be that after I have disabled the Maximize/Restore Down button as in my original post, the Window Style of having the Window maximised seems to set the maximised size as the whole screen and not just the desktop area excluding the TaskBar. I have fiddled around with changing the window style using SetWindow Long but WS_Maximized seems to be operating on entire screen rather than desktop now. I was hoping someone could point me to a way to resize the window back to the desktop size via API.
The other option I am thinking about is to subclass the window and catch the resizing event without passing it on.
Will leave the question open for a bit to see if any other answers pop up.
Thanks
Graeme
0
 
LVL 2

Author Comment

by:superg65
ID: 21764567
Hi Again
Have tried the disable Maximize button code (as in original post)  again in a simple project with just a form and a button and the same thing happens - so it doesn't appear that my code in my original project is causing this. Is it a bug in this API procedure or do I need to do something else to make it work correctly.
?
Thanks
Graeme
0
 
LVL 2

Author Closing Comment

by:superg65
ID: 31465960
Thanks for taking the time to answer. Not what I was after tho - have decided to go down the sub-classing road. Cheers
 Graeme
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

914 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

15 Experts available now in Live!

Get 1:1 Help Now