Here are a couple of examples. The first one requires version 10 or greater because the color that is made transparent is colored text. The second one opens notepad then makes the notepad typing field transparent. This will require version 7 or greater since Libfunc> was introduced in version 7.
This first example will turn a green box transparent. Drag the window around a bit to prove that the area is truly transparent.
Code: Select all
Dialog>Dialog1
Caption=Transparent Color Demo
Width=570
Height=165
Top=0
Left=0
Label=g,4,4
Label=Press the button%CRLF%to make the green box transparent.,16,48,true
Button=Make%CRLF%Transparent,320,4,137,80,3
EndDialog>Dialog1
//Set Text Color (color number 234567 is a shade of green)
//The letter "g" in webdings is a filled box. Nice for doing
//background colors in dialogs.
SetDialogObjectFont>Dialog1,msLabel1,WebDings,100,1,234567
//Set Text Color (color number 0 is black)
SetDialogObjectFont>Dialog1,msLabel2,Ariel,24,1,0
//Open the dialog (normal appearance)
Show>Dialog1,res1
//If the "Make Transparent" button is pressed... Do It!
If>res1=3,Process
SRT>Process
//constants
Let>GWL_EXSTYLE=-20
Let>WS_EX_LAYERED=524288
Let>LWA_COLORKEY=1
//get style attributes of dialog1 window
LibFunc>user32,GetWindowLongA,attribs,dialog1.handle,GWL_EXSTYLE
Let>attribs={%attribs% OR %WS_EX_LAYERED%}
//make selected color transparent (color number 234567)
LibFunc>user32,SetWindowLongA,swl,dialog1.handle,GWL_EXSTYLE,attribs
LibFunc>user32,SetLayeredWindowAttributes,res,dialog1.handle,234567,0,LWA_COLORKEY
//Make the button disappear
LibFunc>User32,ShowWindow,SWres,dialog1.msbutton1.handle,0
//Show the dialog without text for a couple of seconds
Let>dialog1.mslabel2=%TAB% Look!!!
ResetDialogAction>dialog1
Show>dialog1
Wait>2
Closedialog>dialog1
//Put text on the dialog and open it one last time
Let>dialog1.mslabel2=There's a hole in this window%CRLF%%TAB%where a color used to be!
ResetDialogAction>dialog1
Show>dialog1,res1
END>Process
Code: Select all
Run>Notepad.Exe
WaitWindowOpen>Notepad*
Wait>0.2
GoSub>Process
SetFocus>Notepad*
Send>You've got to be willing to read other people's code, and then write your own, then have other people review your code. You've got to want to be in this incredible feedback loop where you get the world-class people to tell you what you're doing wrong...%CRLF%%TAB%-- Bill Gates
SRT>Process
//constants
Let>GWL_EXSTYLE=-20
Let>WS_EX_LAYERED=524288
Let>LWA_COLORKEY=1
//get style attributes of Notepad
GetWindowHandle>Notepad*,NPhdl
LibFunc>user32,GetWindowLongA,attribs,NPhdl,GWL_EXSTYLE
Let>attribs={%attribs% OR %WS_EX_LAYERED%}
//make selected color transparent (color number 16777215)
LibFunc>user32,SetWindowLongA,swl,NPhdl,GWL_EXSTYLE,attribs
LibFunc>user32,SetLayeredWindowAttributes,res,NPhdl,16777215,0,LWA_COLORKEY
END>Process