Solved

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

Posted on 1998-08-14
4
351 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
[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
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 Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
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.
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…
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…

739 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