AutoHotkey Community

It is currently May 27th, 2012, 4:05 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: June 10th, 2011, 12:03 pm 
Offline

Joined: March 10th, 2011, 7:17 pm
Posts: 374
code says it all

Code:

Gui, -Caption
Gui, Show, w100 h100, helloworld
Gui, +lastfound
hwnd := WinExist()

   WinGet, Transparency, Transparent, ahk_id %hwnd%
   MsgBox, transparency start with no caption: %Transparency%

   WinSet, Transparent, 255, ahk_id %hwnd%
 
   WinGet, Transparency, Transparent, ahk_id %hwnd%
   MsgBox, transparency after WinSet with no caption: %Transparency%

Gui, Destroy

Gui, +Caption
Gui, Show, w100 h100, helloworld
Gui, +lastfound
hwnd := WinExist()

   WinGet, Transparency, Transparent, ahk_id %hwnd%
   MsgBox, transparency start with caption: %Transparency%

   WinSet, Transparent, 255, ahk_id %hwnd%
 
   WinGet, Transparency, Transparent, ahk_id %hwnd%
   MsgBox, transparency after WinSet with caption: %Transparency%

ExitApp




but the DllCalls that WinSet, Transparent wraps do work:

Code:

Gui, -Caption
Gui, Show, w100 h100, helloworld
Gui, +lastfound
hwnd := WinExist()

   WinGet, Transparency, Transparent, ahk_id %hwnd%
   MsgBox, transparency start with no caption: %Transparency%
 
   winlong := DllCall("GetWindowLong", "Uint", hwnd, "Int", -20) ;// GWL_EXSTYLE := -20
   DllCall("SetWindowLong", "UInt", hwnd, "Int", -20, "UInt", winlong|0x00080000) ;// WS_EX_LAYERED := 0x00080000
   DllCall("SetLayeredWindowAttributes", "UInt", hwnd, "UInt", 0, "UInt", 255, "UInt", 0x00000002) ;// LWA_ALPHA := 0x00000002

   WinGet, Transparency, Transparent, ahk_id %hwnd%
   MsgBox, transparency after DllCalls with no caption: %Transparency%

ExitApp




o_O

[Moved from Bug Reports. ~jaco0646]


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 10th, 2011, 2:26 pm 
Offline

Joined: May 3rd, 2009, 7:16 pm
Posts: 345
Location: OH, USA
It's documented:

AHK Help wrote:
Known Limitations for Transparent and TransColor:
  • They have no effect on a window that lacks a caption (title bar) and lacks the always-on-top property. For GUI windows, this can be solved by removing the caption only after making the window transparent. Alternatively, the following properties allow transparency to take effect: Gui -Caption +ToolWindow.

Working:

Code:
Gui, -Caption +ToolWindow +LastFound
hwnd := WinExist()
Gui, Show, w100 h100, helloworld

WinGet, Transparency, Transparent, ahk_id %hwnd%
MsgBox, transparency start with no caption: %Transparency%

WinSet, Transparent, 100, ahk_id %hwnd%

WinGet, Transparency, Transparent, ahk_id %hwnd%
MsgBox, transparency after WinSet with no caption: %Transparency%
return

GuiEscape:
   ExitApp


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 10th, 2011, 6:27 pm 
Offline

Joined: March 10th, 2011, 7:17 pm
Posts: 374
doh, missed that, thanks

still curious why the DllCalls work though, when WinSet doesnt


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 10th, 2011, 6:46 pm 
Offline

Joined: May 3rd, 2009, 7:16 pm
Posts: 345
Location: OH, USA
guest3456 wrote:
still curious why the DllCalls work though, when WinSet doesnt

It's simply because the WS_EX_LAYERED ExStyle isn't set. Try this:

Code:
Gui, -Caption +e0x80000 +LastFound
hwnd := WinExist()
Gui, Show, w100 h100, helloworld

WinGet, Transparency, Transparent, ahk_id %hwnd%
MsgBox, transparency start with no caption: %Transparency%

WinSet, Transparent, 100, ahk_id %hwnd%

WinGet, Transparency, Transparent, ahk_id %hwnd%
MsgBox, transparency after WinSet with no caption: %Transparency%
return

GuiEscape:
   ExitApp


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 10th, 2011, 8:01 pm 
Offline

Joined: March 10th, 2011, 7:17 pm
Posts: 374
i see, but based on Chris's post, the window is supposed to first be set to layered anyway when calling WinSet Trans, so that shouldnt be necessary

as you can see, a GUI with a caption starts off unlayered as well, yet WinSet trans will still work:

Code:
Gui, +Caption  +LastFound ; +e0x80000
hwnd := WinExist()
Gui, Show, w100 h100, helloworld

WinGet, Style, ExStyle, ahk_id %hwnd%
if (Style & (WS_EX_LAYERED:=0x80000))
   MsgBox, already layered
else
{
   MsgBox, not layered
   ;WinSet, ExStyle, +0x80000, ahk_id %hwnd%
}

WinGet, Transparency, Transparent, ahk_id %hwnd%
MsgBox, transparency start with no caption: %Transparency%

WinSet, Transparent, 100, ahk_id %hwnd%

WinGet, Transparency, Transparent, ahk_id %hwnd%
MsgBox, transparency after WinSet with no caption: %Transparency%
return

GuiEscape:
   ExitApp


Report this post
Top
 Profile  
Reply with quote  
PostPosted: January 20th, 2012, 3:26 am 
Offline

Joined: December 3rd, 2011, 9:07 pm
Posts: 176
Winset always on top does not work for my firefox window that lacks of titlebar.
Do you have a solution for that?


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], Leef_me, rbrtryn and 59 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group