I have been messing around with different Window Styles and with setting the transparency of windows created with Win32::GUI.
The following code demonstrates a few of the things I have been able to pull together from my research. I had to use the Win32::API module to help with setting the transparency stuff.
Usage:
The first argument is the style index number. This defaults to 0.
The second argument (optional) is the percent of transparency you want the window to be.
Example:
c:\>windemo.pl 4 65
This would set the style to "borderless rounded" and make the window 65 percent opaque.

Feel free to play around with it and add to it. I look forward to seeing your permutations

#!perl #windemo.pl #Created by Steve Lloyd, http://www.basgetti.com #Feel free to modify and use this code as you wish. use strict; use Win32::GUI; use Win32::API; my $MainWidth=400; #Width of Window my $MainHeight=400; #Height of Window my @styleStrings=( "WS_SYSMENU WS_MINIMIZE WS_MINIMIZEBOX WS_MAXIMIZE WS_MAXIMIZEBOX" +, # Normal Window "WS_SYSMENU WS_MINIMIZE WS_MINIMIZEBOX WS_MAXIMIZE WS_MAXIMIZEBOX +WS_VSCROLL", # Normal Window with vertical scroll "WS_SYSMENU", # Only System Menu and Close "WS_SYSMENU WS_MINIMIZE WS_MINIMIZEBOX", #System Menu, Close, a +nd Minimize "borderless rounded", #Borderless Window (no Menu) with a round +ed edge "borderless WS_BORDER", #Borderless Window (no Menu) with a sma +ll sharp edge ); my $index=shift || 0; #pass first argument to set what style of win +dow to show my $alpha=shift; #pass second argument to set transparency perc +ent (0-100) if(!defined $styleStrings[$index]){$index=0;} my $styleString=$styleStrings[$index]; my $MainWindow = new Win32::GUI::Window( -name => "MainWindow", -text => 'WinDemo.pl', -width => $MainWidth, -height => $MainHeight, -pos => [300, 100 ], -style => &setWindowStyle($styleString), -topmost=> 1, ); $MainWindow->AddButton( -text => "Close", -name => "MyButton", -pos => [10, 10 ], -size => [100,20], -tip => "Close this window", ); $MainWindow->AddTextfield( -text => $styleString, -name => "MyStyle", -pos => [10, 110 ], -size => [360,30], -readonly => 1, ); if(length($alpha)){&makeTransparent($MainWindow,$alpha);} $MainWindow->Show(); my $dialog=Win32::GUI::Dialog(); sub MyButton_Click{ return -1; } sub setWindowStyle{ my $str=shift; my %Style=( WS_BORDER => 0x800000, WS_CAPTION => 0xC00000, WS_CHILD => 0x40000000, WS_CLIPCHILDREN => 0x2000000, WS_CLIPSIBLINGS => 0x4000000, WS_DISABLED => 0x8000000, WS_DLGFRAME => 0x400000, WS_GROUP => 0x20000, WS_HSCROLL => 0x100000, WS_MAXIMIZE => 0x1000000, WS_MAXIMIZEBOX => 0x10000, WS_MINIMIZE => 0x20000000, WS_MINIMIZEBOX => 0x20000, WS_OVERLAPPED => 0x0, WS_POPUP => 0x80000000, WS_SYSMENU => 0x80000, WS_TABSTOP => 0x10000, WS_THICKFRAME => 0x40000, WS_VISIBLE => 0x10000000, WS_VSCROLL => 0x200000, ); $Style{WS_CHILDWINDOW} = $Style{WS_CHILD}; $Style{WS_ICONIC} = $Style{WS_MINIMIZE}; $Style{WS_OVERLAPPEDWINDOW} = $Style{WS_OVERLAPPED} || $Style{WS_C +APTION} || $Style{WS_SYSMENU} || $Style{WS_THICKFRAME} || $Style{WS_M +INIMIZEBOX} || $Style{WS_MAXIMIZEBOX}; $Style{WS_POPUPWINDOW} = $Style{WS_POPUP} || $Style{WS_BORDER} || +$Style{WS_SYSMENU}; $Style{WS_SIZEBOX} = $Style{WS_THICKFRAME}; $Style{WS_TILED} = $Style{WS_OVERLAPPED}; $Style{WS_TILEDWINDOW} = $Style{WS_OVERLAPPEDWINDOW}; #uppercase the string coming in my $ustr=uc($str); #if the string matches a value in the hash, return the hash value if(defined $Style{$ustr}){return $Style{$ustr};} #split the string up and do a little fuzzy logic to determine what + they want my @parts=split(/[\ \t\;\:\,]+/,$str); my $rval; foreach my $part (@parts){ if($part=~/^borderless$/is){$part="WS_POPUP";} elsif($part=~/vscroll/is){$part="WS_VSCROLL";} elsif($part=~/hscroll/is){$part="WS_HSCROLL";} elsif($part=~/rounded/is){$part="WS_THICKFRAME";} my $upart=uc($part); if(defined $Style{$upart}){ $rval=($rval | $Style{$upart}); } } return $rval; } sub makeTransparent{ #usage my $ck=makeTransparent($MainWindow,35); my $Window=shift || return 0; my $pcnt=shift || return 0; #Get handle of object passed in my $topHwnd=$Window->{-handle}; #Convert percent value to alpha value my $alpha=int(($pcnt/100)*255); #Set some varialves my $WS_EX_LAYERED = hex(80000); my $GWL_STYLE = (-16); my $GWL_EXSTYLE = (-20); my $LWA_COLORKEY = 1; my $LWA_ALPHA = 2; my $GetWindowLong = new Win32::API("user32","GetWindowLong",['N',' +I'],'N') || return $^E; my $SetWindowLong = new Win32::API("user32","SetWindowLong",['N',' +I','N'],'N') || return $^E; my $SetLayeredWindowAttributes = new Win32::API("user32","SetLayer +edWindowAttributes",['N','N','C','N'],'N') || return $^E; my $ck = $SetWindowLong->Call($topHwnd, $GWL_EXSTYLE, ($GetWindowL +ong->Call($topHwnd, $GWL_EXSTYLE) | $WS_EX_LAYERED)); my $alphaValue=chr($alpha); #0 to 255, where 0=transparent an +d 255=opaque $ck = $SetLayeredWindowAttributes->Call($topHwnd, 0, $alphaValue, +$LWA_ALPHA); return $ck; } exit;

In reply to Win32::GUI Window Styles and Transparency by slloyd

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.