WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Samples

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Transparent Progress Dialog


;==============================================================================
#DefineSubroutine PimpyDialog(DialogTitle,Text,TitleBar,Visibility)
;==============================================================================

			; PimpyDialog: Like Dialog box but script continues processing. Box can be updated with new text / title
			;
			; Usage:
			; PimpyDialog(Title of Box, Text for box, TitleBar on or off (0 or 1), transparency (0-255))
			; 
			; RETURNS:  nothing
			;
			; Note: Title bar can not be turned on or off once it's initiated.
			; Note: Transparency can not be changed once it's initiated
			;
			; Thanks to the Author of Tech Article W14830 (unknown) for the DLL call to remove title bar
			; Thanks to the Author of Tech Article W15279 (unknown) for the DLL call to make it transparent
			; Thanks to NVadnais for the core UDF
			;
			; -= KK (Crypt) 2004 =-
			;

			If IsDefined(BeenThereDoneThat)==0
				WinTitle("", "Hidden...")
				WS_CAPTION=12582912  ; Hex 00C00000  (Search MSDN for Q111011 for more parameter values)
				GWL_STYLE=-16
				WS_EX_LAYERED = 524288    ;&H80000 
			   GWL_EXSTYLE = -20
			   LWA_ALPHA = 2
				MyWin=DllHwnd("Hidden...")
				User32=StrCat(DirWindows(1),"USER32.DLL")

				;Removes the TitleBar
				If TitleBar==0
					OldStyle=DllCall(User32, long:"GetWindowLongA", long:MyWin, long:GWL_STYLE)
					NewStyle=OldStyle ^ WS_CAPTION
					DllCall(User32, long:"SetWindowLongA", long:MyWin, long:GWL_STYLE, long:NewStyle)    ;creIf
				Endif

				;Sets the Transparency if OS is win2k or above
				If WinVersion(1) > 4
					x=DllCall(USER32,long:"GetWindowLongA",long:MyWin,long:GWL_EXSTYLE)
				   x=x ^ WS_EX_LAYERED
					DllCall(USER32,long:"SetWindowLongA",long:MyWin,long:GWL_EXSTYLE,long:x)
				 	DllCall(USER32,long:"SetLayeredWindowAttributes",long:MyWin,long:0,long:visibility,long:LWA_ALPHA)
				EndIF

				BoxColor(1, "212,208,200", 0) ; box color is default windows gray
				BoxDrawRect(1, "0,0,1000,1000", 2)
				
				; text color can be set below
				;BoxTextColor( 1, "15,15,150" ) ;A nice blue
				;BoxTextColor( 1, "25,150,60" ) ;A nice green
				;BoxTextColor( 1, "255,0,0" ) ;Red
				BoxTextColor( 1, "0,0,0" ) ;Black
				
				;Attempt to keep box and font the same size whether the titlebar is on or not
				If TitleBar==1
					BoxTextFont(1, "Tahoma", 220, 40, 0 )
					BoxesUp("350,450,650,550", @NORMAL )
				Else
					BoxTextFont(1, "Tahoma", 200, 40, 0) 
					BoxesUp("350,460,650,540", @NORMAL )
				EndIf
				
				BoxDataTag(1, "FreshScreen" )
				BeenThereDoneThat = @TRUE
			EndIf

			BoxDataClear(1, "FreshScreen" )
			BoxDrawRect(1, "10,10,1000,1000", 2 )
			BoxDrawText(1, "50,0,950,1000", Text, @FALSE, 1 | 4 | 16 )
			BoxCaption(1,DialogTitle )
			
			Return
			
;==============================================================================
#EndSubroutine
;==============================================================================

PimpyDialog("Testing Title","Testing",0,175)
TimeDelay(1)
PimpyDialog("Changing Title....","Testing Some More.. Can fit a bit of text in here as you can see. Not sure on the character count",0,175)
TimeDelay(1)

Article ID:   W16429
File Created: 2005:02:18:12:20:28
Last Updated: 2005:02:18:12:20:28