[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

MDIForm, Windows Taskbar and GetWindowLong

Posted on 2008-06-10
4
Medium Priority
?
784 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 1500 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

Technology Partners: 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 (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…
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.
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…
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…
Suggested Courses

650 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