Solved

MDIForm, Windows Taskbar and GetWindowLong

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

760 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

19 Experts available now in Live!

Get 1:1 Help Now