thomas@ssd.kodak.com (Thomas B. Kinsman (37681)) (06/14/91)
Return-Path: <wilcox@wucs1.wustl.edu> Date: Thu, 13 Jun 91 13:42:51 CDT From: wilcox@wucs1.wustl.edu (Don Wilcox) Message-Id: <9106131842.AA01900@wucs1.wustl.edu> To: thomas@ssd.Kodak.Com Subject: Re: Windows of Fixed Size (was Re: Iconic Windows) Newsgroups: comp.windows.ms.programmer In-Reply-To: <1991Jun12.215651.1313@ssd.kodak.com> References: <1991Jun12.131526.207@minyos.xx.rmit.oz.au> <1991Jun12.193240.22429@athena.mit.edu> <1124@venice.SEDD.TRW.COM> Organization: Washington University, St. Louis MO Cc: Status: RO Two winning solutions to making a fixed size window came from Don Wilcox. <wilcox@wucs1.wustl.edu> The first one is the direct approach, the second one is easier and faster. Edited versions follow: Direct Method: > 1. Make sure you correctly reference the lParam field of the > WM_GETMINMAXINFO. It must be cast as LPPOINT, not POINT * : > LPPOINT rgpt = (LPPOINT)lParam; > rgpt[3].x = rgpt[4].y = theRightWidth; > rgpt[3].y = rgpt[4].y = theRightHeight; > 2. All you need to change are the minimum and maximum tracking sizes > in the WM_GETMINMAXINFO data. The iconic size you will want to > leave alone, and the maximized size you can get around if you never > let the use maximize the window (by not putting a maximize box in > the caption). So: hWnd = CreateWindow( "MyWindowName", "MyAppTittle", WS_OVERLAPPEDWINDOW & ~WS_MAXIMIZEBOX, etc... This works fine, however his second suggestion was better: Better Method: >It seems to me that this might be easily solved another way. If your window >does not have resizable borders, and you size the window in the WM_CREATE (or >WM_INITDIALOG) message, then the window can never be resized. Just what you >want. So: hWnd = CreateWindow( "MyWindowName", "MyAppTittle", WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX, CW_USEDEFAULT, /* initial X position */ CW_USEDEFAULT, /* initial Y position */ 640, /* FIXED WIDTH OF OPEN WINDOW */ 480, /* FIXED HEIGHT OF OPEN WINDOW */ etc... I wrote out the style flags explicitly, if you wanted to show what was *not* included from the standard set of style flags you could have written it as: WS_OVERLAPPEDWINDOW & ~(WS_MAXIMIZEBOX | WS_THICKFRAME), Thanks to all who replied. -- ---- thomas@ssd.kodak.com Voice: 716/477-9379(w) Fax: 716/722-5008 Thomas B. Kinsman, Eastman Kodak Co., Flr 3, Bldg 65, RL, Roch., NY 14650-1805 "Knowledge is what's left when you throw the books away." - A. Einstein