BBC BASIC for Windows
Programming >> User Interface >> Maximised window
http://bb4w.conforums.com/index.cgi?board=ui&action=display&num=1413113079

Maximised window
Post by Matt on Oct 12th, 2014, 11:24am

Hi,

I'm trying to permanently and immovably fix the window to its maximum size. The code,

SYS "ShowWindow", @hwnd%, SW_MAXIMIZE
SYS "GetWindowLong", @hwnd%, GWL_STYLE TO ws%
SYS "SetWindowLong", @hwnd%, GWL_STYLE, ws% AND NOT WS_MAXIMIZEBOX

sets up the size and removes the maximise button, but I can still reduce it by double-clicking on the title bar. Is there a way to stop this ability, but still be able to minimise if necessary? I've searched all the window styles, but none of them seem to be applicable.

Matt
Re: Maximised window
Post by rtr2 on Oct 12th, 2014, 1:01pm

on Oct 12th, 2014, 11:24am, Matt wrote:
Is there a way to stop this ability, but still be able to minimise if necessary?

Did you try Google? A quick search gave several hits stating that the only way is to suppress the WM_NCLBUTTONDBLCLK message:

Code:
      INSTALL @lib$+"SUBCLASS"
      PROC_subclass(WM_NCLBUTTONDBLCLK, FNdummy())
      DEF FNdummy(M%,W%,L%) = FALSE

      SYS "ShowWindow", @hwnd%, SW_MAXIMIZE
      SYS "GetWindowLong", @hwnd%, GWL_STYLE TO ws%
      SYS "SetWindowLong", @hwnd%, GWL_STYLE, ws% AND NOT WS_MAXIMIZEBOX

      REPEAT
        WAIT 1
      UNTIL FALSE 

You could probably argue that being able to double-click on the title bar even when the maximize box is disabled is a bug in Windows, but of course they can't change the behaviour now.

Richard.

Re: Maximised window
Post by Matt on Oct 12th, 2014, 2:27pm

on Oct 12th, 2014, 1:01pm, g4bau wrote:
Did you try Google?

I didn't. However, even now looking it up specifically, I'm afraid the understanding is a little beyond me at the moment. Hopefully, the more I learn...

The code you supplied works fine in my program, thank you. Until I get time to examine the principals within it more closely, I will use the appropriate lines 'as is'.

Thanks again.

Matt