Solved

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

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

Industry Leaders: 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

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

749 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