News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Window help

Started by RuiLoureiro, November 16, 2007, 12:38:51 PM

Previous topic - Next topic

RuiLoureiro

#30
How to change the window background color after creating a window ? I didnt find out yet.

InvalidateRect - UpdateWindow doesnt work. It doesnt clean the previous screen.
Rui

hutch--

Rui,

Its done by changing the background brush in the window class.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

donkey

invoke SetClassLong, [hwnd], GCL_HBRBACKGROUND, [hNewBrush]
// If the class is using a brush you created use DeleteObject here to destroy the returned hBrush
invoke InvalidateRect, NULL, TRUE
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

Tedd

You can set the 'default' background colour by setting a colour value as the background brush for your window - in the window-class structure, given to registerclass (e.g. "00000ffh" instead of "COLOR_WINDOW+1")
To dynamically change it, you can either modify the class brush (donkey's method) if you don't need to change often, or simply use FillRect (or Rectangle) if you need to change the colour many times.
No snowflake in an avalanche feels responsible.

RuiLoureiro

Hutch, Donkey and Tedd,
                                    Thank you !

I used IvalidateRect, hWnd, NULL, TRUE ... and doenst work ... yet.

I have only one main window, style CS_OWNDC;
The client area is divided in 3 areas: header, workspace and bottom;

I have    Table1: values and pointers     ( set 1 )
             Table2: values and pointers    ( set 2 )
             pActiveTable = offset Table1  (points to Table1 at the beginning )

The proc under WM_PAINT uses pActiveTable to print data on the screen;
Pressing one given key pActiveTable = offset Tabel2
and before calling the commom control dialog box i put

                     IvalidateRect, hWnd, NULL, TRUE
                     UpdateWindow, hWnd

What happens ? When i press the key the header and bottom change but the previous workspace content stay on the screen when the dialog box opens. It doenst print anything on the worksapce because it should not print anything and it is correct.
In the menu i have a proc that shows all values and pointers in the ActiveTable and all things are correct.
Is there any reason to not clean the screen ? How to clean it ?

note: dont worry, it's a high tech proggy !

Rui


RuiLoureiro

Hi all
       The problem is solved.
        Thanks