Solved

Fixed (non sizeable) MDI Child -> NOT POSSIBLE ?

Posted on 1998-08-14
4
337 Views
Last Modified: 2008-02-01
Hi,

Is it possible to create a MDI child that's not sizeable ?

When I set the borderstyle property to Fixed Single, VB changes this run-time to sizeable (try it !). So I came up with this solution:

lResult = GetWindowLong(Me.hWnd, GWL_STYLE)
NwLong = lResult - WS_THICKFRAME
lResult = SetWindowLong(Me.hWnd, GWL_STYLE, NwLong)

(Be sure to make a child window with borderstyle 2 -sizeable !)

This works, but the window redraw rect misses about one pixel, so you get garbage on a small line of the window.

Try this code and resize the MDI Parent from small to large etc. then you'll see the garbage.

Anyone ?
0
Comment
Question by:michelv
4 Comments
 
LVL 1

Expert Comment

by:jsuper
ID: 1468836
Why don't you just disable the ability to resize by adding code to the form resize event that resets the size of the form back to the original size?
0
 
LVL 2

Accepted Solution

by:
bernfarr earned 50 total points
ID: 1468837
You can do this (add code that detects the resize and sets the form back to the original, but it looks messy).

Have a look at this article:
  http://support.microsoft.com/support/kb/articles/q185/7/33.asp
0
 
LVL 6

Expert Comment

by:clifABB
ID: 1468838
I tried it and I can set the border to 1 - Fixed Single after the form is set to MDIChild = True.

I'm using VB5 (SP3)
0
 
LVL 1

Author Comment

by:michelv
ID: 1468839
For anyone still interested, I found it myself, it is possible: here's the code to do it...


Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long

Const GWL_STYLE = (-16)
Const WS_MAXIMIZEBOX = &H10000
Const WS_THICKFRAME = &H40000


   wStyle = GetWindowLong(Me.hWnd, GWL_STYLE)
   wStyle = wStyle - WS_MAXIMIZEBOX - WS_THICKFRAME
   SetWindowLong Me.hWnd, GWL_STYLE, wStyle

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

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…
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…
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…
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…

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

16 Experts available now in Live!

Get 1:1 Help Now