News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

A window with a TRANSPARENT client area

Started by hfheatherfox07, May 29, 2012, 05:37:16 AM

Previous topic - Next topic

hfheatherfox07

Hi I have found this thread
http://www.asmcommunity.net/board/index.php?topic=5215.0
and It says:

(a) WS_EX_TRANSPARENT
Quote

    Specifies that a window created with this style should not be painted until siblings beneath the window (that were created by the same thread) have been painted. The window appears transparent because the bits of underlying sibling windows have already been painted



Combined with (b): CS_PARENTDC
Quote

    Sets the clipping rectangle of the child window to that of the parent window so that the child can draw on the parent. A window with the CS_PARENTDC style bit receives a regular device context from the system's cache of device contexts. It does not give the child the parent's device context or device context settings. Specifying CS_PARENTDC enhances an application's performance




Were do I put the CS_PARENTDC and also do I have to use WM_PAINT ?
see attachment
Your code and your skills will be assimilated. Your programming language is irrelevant.
We are the ASM Borg and you will become part of us. Compile and be assembled.

dedndave

CS_ is the prefix for class styles
when you register the window class, it goes in the WNDCLASSEX.style member

if you want to have some fun, set the WNDCLASSEX.hbrBackground member to 0   :P

hfheatherfox07

weird I did not get email notification for this replay ...how do I change that .....?
I have my notification on .....it says that I do get them ....but I don't  :(

@dedndave I will try this tonight
Your code and your skills will be assimilated. Your programming language is irrelevant.
We are the ASM Borg and you will become part of us. Compile and be assembled.

qWord

For windows Vista and newer, DwmEnableBlurBehindWindow() is an easy way to add an alpha cannel to a window (see attachment).
MREAL macros - when you need floating point arithmetic while assembling!

hfheatherfox07

Quote from: qWord on May 31, 2012, 09:14:34 AM
For windows Vista and newer, DwmEnableBlurBehindWindow() is an easy way to add an alpha cannel to a window (see attachment).

Windows XP here LOL  ::)
Your code and your skills will be assimilated. Your programming language is irrelevant.
We are the ASM Borg and you will become part of us. Compile and be assembled.

hfheatherfox07

Your code and your skills will be assimilated. Your programming language is irrelevant.
We are the ASM Borg and you will become part of us. Compile and be assembled.

dedndave

you certainly are not - lol

you do not want to create a window inside the WM_PAINT handler   :icon_eek:

also - when you set the class backgorund to a system color, use XXXXX+1
mov   wc.hbrBackground,COLOR_BTNFACE+0  ; COLOR_WINDOW + 9
i.e., if you want it to be COLOR_BTNFACE, use COLOR_BTNFACE+1
that method is only valid for the first 19 system colors
;COLOR_SCROLLBAR               EQU 0
;COLOR_BACKGROUND              EQU 1
;COLOR_ACTIVECAPTION           EQU 2
;COLOR_INACTIVECAPTION         EQU 3
;COLOR_MENU                    EQU 4
;COLOR_WINDOW                  EQU 5
;COLOR_WINDOWFRAME             EQU 6
;COLOR_MENUTEXT                EQU 7
;COLOR_WINDOWTEXT              EQU 8
;COLOR_CAPTIONTEXT             EQU 9
;COLOR_ACTIVEBORDER            EQU 10
;COLOR_INACTIVEBORDER          EQU 11
;COLOR_APPWORKSPACE            EQU 12
;COLOR_HIGHLIGHT               EQU 13
;COLOR_HIGHLIGHTTEXT           EQU 14
;COLOR_BTNFACE                 EQU 15
;COLOR_BTNSHADOW               EQU 16
;COLOR_GRAYTEXT                EQU 17
;COLOR_BTNTEXT                 EQU 18


if you set it to 0 or NULL, then you are responsible for handling WM_ERASEBKGND
if you want to use some other system color, use GetSysColor and CreateSolidBrush
if you use the later method, DeleteObject is required when done
;COLOR_INACTIVECAPTIONTEXT     EQU 19
;COLOR_BTNHIGHLIGHT            EQU 20
;COLOR_3DDKSHADOW              EQU 21
;COLOR_3DLIGHT                 EQU 22
;COLOR_INFOTEXT                EQU 23
;COLOR_INFOBK                  EQU 24
;                                                     ;wonder what happened to 25 ;)
;COLOR_HOTLIGHT                EQU 26
;COLOR_GRADIENTACTIVECAPTION   EQU 27
;COLOR_GRADIENTINACTIVECAPTION EQU 28
;COLOR_MENUHILIGHT             EQU 29                 ;not supported under Win 2000
;COLOR_MENUBAR                 EQU 30                 ;not supported under Win 2000
;
;Additional System Color Aliases
;
;COLOR_3DHIGHLIGHT             EQU COLOR_BTNHIGHLIGHT ;20
;COLOR_3DHILIGHT               EQU COLOR_BTNHIGHLIGHT ;20
;COLOR_BTNHILIGHT              EQU COLOR_BTNHIGHLIGHT ;20

hfheatherfox07

Well OK .... I am more concerned with creating a transparent client area :(
Your code and your skills will be assimilated. Your programming language is irrelevant.
We are the ASM Borg and you will become part of us. Compile and be assembled.

dedndave

well - i tried what that guy suggested - and it didn't work out too well, for me - lol

the whole window is transparent - i can see it come up, minimize, etc
but, once it gets where it's going, it is like watching the invisible man

msdn gives some code, too
http://msdn.microsoft.com/en-us/library/ms997507.aspx
i had about as much luck, there
but - i didn't really spend a lot of time on it
i am sure i could make it work if i fiddled with it a bit

hfheatherfox07

I ran into the same problem ......
I have seen it done with masm so I know it is possible ....

by the way still no email notifications of reply
Your code and your skills will be assimilated. Your programming language is irrelevant.
We are the ASM Borg and you will become part of us. Compile and be assembled.

dedndave

check the profile setting - check your forum e-mail addy

dedndave

here we go...



notice where the WS_EX style flag goes   :biggrin:

hfheatherfox07

I am confused by that .... I don't want to make the whole window transparent just the client area or a static ....there is so much easier ways to do just that .... don't need
.ELSEIF uMsg == WM_PAINT
invoke BeginPaint,hWnd,addr ps




invoke EndPaint,hWnd,addr ps
xor eax,eax

.ELSEIF uMsg==WM_ERASEBKGND
mov eax,TRUE


I was only using that to try to do only the client area or a static transparent
Your code and your skills will be assimilated. Your programming language is irrelevant.
We are the ASM Borg and you will become part of us. Compile and be assembled.

hfheatherfox07

Quote from: dedndave on June 02, 2012, 12:16:49 PM
check the profile setting - check your forum e-mail addy

that is ...but still no notifications  :(
Your code and your skills will be assimilated. Your programming language is irrelevant.
We are the ASM Borg and you will become part of us. Compile and be assembled.

dedndave

.ELSEIF uMsg == WM_PAINT
invoke BeginPaint,hWnd,addr ps




invoke EndPaint,hWnd,addr ps
xor eax,eax

.ELSEIF uMsg==WM_ERASEBKGND
mov eax,TRUE


yah - i was messing around, there
if you erase the background, you are supposed to return TRUE
as for paint - BeginPaint/EndPaint validates the rectangle
if you answer WM_PAINT, you have to validate one way or another

as for the transparency - you have to play with the rectangles
read that document i linked at msdn
they had some info
you can set the opacity of the non-client area to "showing"
then set a rectangle for the client area to transparent
it might work   :P