Solved

MDIForm, Windows Taskbar and GetWindowLong

Posted on 2008-06-10
4
776 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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
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…

778 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