[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

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

Posted on 1998-08-14
4
Medium Priority
?
355 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 100 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

What’s Wrong with Your Cloud Strategy ?

Even as many CIOs are embracing a cloud-first strategy, the reality is that moving to the cloud is a lengthy process and the end-state is likely to be a blend of multiple clouds—public and private. Learn why multicloud solutions matter in this webinar by Nimble Storage.

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…
Suggested Courses

650 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