Author Topic: A window with a TRANSPARENT client area  (Read 17327 times)

hfheatherfox07

  • Member
  • ***
  • Posts: 464
A window with a TRANSPARENT client area
« on: May 29, 2012, 05:37:16 AM »
Hi I have found this thread
http://www.asmcommunity.net/board/index.php?topic=5215.0
and It says:

Code: [Select]
(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

  • Member
  • *****
  • Posts: 8829
  • Still using Abacus 2.0
    • DednDave
Re: A window with a TRANSPARENT client area
« Reply #1 on: May 29, 2012, 07:08:18 AM »
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

  • Member
  • ***
  • Posts: 464
Re: A window with a TRANSPARENT client area
« Reply #2 on: May 31, 2012, 08:31:43 AM »
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

  • Member
  • *****
  • Posts: 1476
  • The base type of a type is the type itself
    • SmplMath macros
Re: A window with a TRANSPARENT client area
« Reply #3 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).
MREAL macros - when you need floating point arithmetic while assembling!

hfheatherfox07

  • Member
  • ***
  • Posts: 464
Re: A window with a TRANSPARENT client area
« Reply #4 on: June 02, 2012, 11:21:33 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

  • Member
  • ***
  • Posts: 464
Re: A window with a TRANSPARENT client area
« Reply #5 on: June 02, 2012, 11:22:39 AM »
I don't think I am doing this right


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

  • Member
  • *****
  • Posts: 8829
  • Still using Abacus 2.0
    • DednDave
Re: A window with a TRANSPARENT client area
« Reply #6 on: June 02, 2012, 11:33:28 AM »
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
Code: [Select]
mov   wc.hbrBackground,COLOR_BTNFACE+0  ; COLOR_WINDOW + 9i.e., if you want it to be COLOR_BTNFACE, use COLOR_BTNFACE+1
that method is only valid for the first 19 system colors
Code: [Select]
;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
Code: [Select]
;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

  • Member
  • ***
  • Posts: 464
Re: A window with a TRANSPARENT client area
« Reply #7 on: June 02, 2012, 12:07:02 PM »
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

  • Member
  • *****
  • Posts: 8829
  • Still using Abacus 2.0
    • DednDave
Re: A window with a TRANSPARENT client area
« Reply #8 on: June 02, 2012, 12:10:36 PM »
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

  • Member
  • ***
  • Posts: 464
Re: A window with a TRANSPARENT client area
« Reply #9 on: June 02, 2012, 12:13:47 PM »
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

  • Member
  • *****
  • Posts: 8829
  • Still using Abacus 2.0
    • DednDave
Re: A window with a TRANSPARENT client area
« Reply #10 on: June 02, 2012, 12:16:49 PM »
check the profile setting - check your forum e-mail addy

dedndave

  • Member
  • *****
  • Posts: 8829
  • Still using Abacus 2.0
    • DednDave
Re: A window with a TRANSPARENT client area
« Reply #11 on: June 02, 2012, 12:35:39 PM »
here we go...



notice where the WS_EX style flag goes   :biggrin:

hfheatherfox07

  • Member
  • ***
  • Posts: 464
Re: A window with a TRANSPARENT client area
« Reply #12 on: June 02, 2012, 12:49:28 PM »
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
Code: [Select]
.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

  • Member
  • ***
  • Posts: 464
Re: A window with a TRANSPARENT client area
« Reply #13 on: June 02, 2012, 12:51:29 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

  • Member
  • *****
  • Posts: 8829
  • Still using Abacus 2.0
    • DednDave
Re: A window with a TRANSPARENT client area
« Reply #14 on: June 02, 2012, 01:21:23 PM »
Code: [Select]
.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