News:

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

Little test

Started by donkey, April 09, 2011, 09:52:15 AM

Previous topic - Next topic

donkey

I was bouncing around the idea of putting more "wow" into my current project and thought dialogs without title bars and gradient backgrounds would be cool. Here's the test piece I wrote to figure it out if someone wants it for their project. Can't guarantee that it will run on every system, certainly not 9x systems, but some might find it usable. Think I'll round the corners for the final version though...

"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

Vortex

Hi donkey,

Your project works fine on my Win XP SP3 :U

dedndave

very cool, Edgar - XP MCE2005 SP2

FORTRANS

Hi,

   Seems to work as intended with Win 2000.  It does look odd,
though I guess that is what was wanted.

Cheers,

Steve N.

hutch--

Works fine here, XP SP3.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Neil

Works O.K. Win 7 64 Bit SP1. Looks very odd.

RuiLoureiro

works fine on my XP SP3

donkey

#7
Well, I tried the rounded corners and it looked good so I'll post the rounded one here. To do rounded corners I had to use a Dialog As Main type approach instead of the straight dialog since I needed to use a NULL brush for the dialog and don't want to make it an application global thing. I also cleaned up the interface a bit, put an edge below the "new title bar" and no longer allow the window to be moved except from that area, also shamelessly stole a close button image from Windows 7. Finally, I changed it to use a back-buffer to paint the window, always a good practice in case of slower machines. The limiting of the drag area is so that if you require it you can add a custom size grip or frame to the window, its not a big deal to write one if you need it. Its looking pretty good though...



The "new title bar" is of course not a title bar at all and is entirely within the client area of the window. This means you can put graphics, menus or anything else in there.

Not sure what's up with Win2K and generally I don't support that OS but it should look fine. I don't have a copy of 2K anymore that I can test on. I am writing it on Win7 64 bit and it looks fine here.
"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

dedndave

it behaves very strangely when i move it around, Edgar
there are remnants, especially on the right side
and, when i move it to the lower part of the screen (partly not visible), it does not want to move back
see if you can see the same thing
if not, i will try to do a better job of describing it   :P

donkey

Hi Dave,

I'm not having the same problem here on Win7 Ult. 64 bit. I've noticed that in XP mode the mouse tends to outrun it, I haven't figured out a solution for that yet. If you move the mouse back over the title bar it should move without pressing the button, that is the indication that its been outrun. The same thing happens to Windows stuff but somehow they make it snap to the mouse afterward, I have to figure out how they do that.
"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

donkey

#10
Try this one Dave,

I think that what Windows does is to capture the mouse during the move. It has solved the problem on my machine

"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

jj2007

Works perfectly now (XP SP2).

donkey

Thanks Jochen.

Dave,

I've noticed the artifacts your taking about. In some cases the rounded corners are filled and in others the drawing at the edges is incomplete. The problem doesn't show up on either Win7 or Vista, however its a bit severe in XP mode under some circumstances, specifically if there is high disk access or running processor intensive tasks while moving the window. I am trying to track it down but frankly I don't even know where to start. Even after the window has been invalidated the problem persists and it is not redrawn properly. I suspect an issue with regions under XP but can't find any reference to a known bug or KB article so this could take a while to track down. Perhaps I have to force an erase background after the button is released, I'll get back to you.

EDIT: Reading through the docs I found this:

QuoteIf hbrBackground is NULL, the application should process the WM_ERASEBKGND message and erase the background.

It appears to be the source of the problem. Not sure how to erase a background that is transparent though...

EDIT:

A little further along, it seems that the width and height of the region have to be increased by 1 beyond the client rectangle. This gets rid of the edge artifacts. For the corners I still have not found out how to erase them with a NULL brush. Windows had to make allowances for this somehow, I can't find any help on it though and it only is an issue in XP mode as far as I can tell, at least it doesn't happen in either Vista or Win7 so there must have been a GDI change at some point to correct a problem but no KB article for it.
"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

jj2007

Quote from: donkey on April 09, 2011, 11:16:56 PMNot sure how to erase a background that is transparent though...

Perhaps you need to keep a copy of what's under the dialog, and restore it to "erase" the background.

By the way: no strange effects on my system, the second version runs very smoothly :U

donkey

Hi Jochen,

Could you try to move the dialog partially  off screen then slowly move it back on, are the corners still round ?
"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