programming tools for Windows applications development
  Home  |   SwiftForth Archive  |   SwiftX Archive  |

Re: Growing Windows

From: Bret Latshaw <bret_at_bedford.net>
Date: Thu, 24 Oct 2002 06:25:27 -0400

Bob Nash writes:
> I am having trouble saving and restoring the current window size to/from
the
> Registry. The restored window grows.

You might want to use AdjustWindowRect and/or
AdjustWindowRectEx. These functions take client-rects and
return the corresponding window-rects. Check the API
documentation for details.

As an example of how it is used, this is cut and pasted
from one of my programs:

\ ------------------------------------------------
Function: AdjustWindowRectEx ( *rect style bmenu exstyle -- f )

: adjust-size ( style exstyle l t r b -- l t x y )
   PAD !RECT >R PAD SWAP TRUE R> AdjustWindowRectEx DROP
   CW_USEDEFAULT DUP ( l t )
   PAD RECT-EDGE ( l t x )
   PAD CELL+ RECT-EDGE ( l t x y ) ;

\ -------------------------------------------------------------
: /APP-WINDOW ( cmdshow -- hwnd ) >R
      WS_EX_OVERLAPPEDWINDOW DUP>R \ extended style
      APP-CLASS \ window class name
      APP-TITLE \ window caption
      WS_OVERLAPPEDWINDOW \ window style
      DUP R> 0 0 548 384 adjust-size \ position & size
      0 \ parent window handle
      0 \ window menu handle
      HINST \ program instance handle
      0 \ creation parameter
   CreateWindowEx ?DUP IF
      DUP TO hAPP
      DUP R> ShowWindow DROP
      DUP UpdateWindow DROP
   ELSE
      R> DROP
   THEN ;

----------------------------------------------------------------------
sftalk_at_forth.com The SwiftForth programming discussion email list
To unsubscribe, send subject "unsubscribe sftalk" to listar_at_forth.com
For help with listar commands, send subject "help" to listar_at_forth.com
Archives are located at http://www.forth.com/sftalk -- check them out!
Search the archives! Visit http://www.forth.com/search for details.
Received on Thu Oct 24 2002 - 03:25:57 PDT

This archive was generated by hypermail 2.2.0 : Fri Nov 21 2008 - 03:04:25 PST