Solved

MDIForm, Windows Taskbar and GetWindowLong

Posted on 2008-06-10
4
779 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
[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
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
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…
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…

717 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