Solved

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

Posted on 1998-08-14
4
334 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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…

706 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

18 Experts available now in Live!

Get 1:1 Help Now