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

Sample code
plus

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

Semi-Visible (Ghost) Windows

Keywords:   semi-transparent ghost windows  semi-visible windows

Here is some really cool code to make a semi-transparent (ghost) window. It only works on Windows XP/W2K.
#DefineFunction Transparent(title,visibility)
   Terminate("2-5-0" > WinVersion(5),"Error","Need Windows 2000/XP/++ for this code")
   WS_EX_LAYERED = 524288    ;&H80000 
   GWL_EXSTYLE = -20
   LWA_ALPHA = 2
    
   hwnd=DllHwnd(title)
   dllnameGDI=strcat(DirWindows(1),"GDI32.DLL")
   dllnameUSER=strcat(DirWindows(1),"USER32.DLL")
   dllnameKRNL=strcat(DirWindows(1),"KERNEL32.DLL")
   x=DllCall(dllnameUSER,long:"GetWindowLongA",long:hWnd,long:GWL_EXSTYLE)
   x=x ^ WS_EX_LAYERED
   DllCall(dllnameUSER,long:"SetWindowLongA",long:hWnd,long:GWL_EXSTYLE,long:x)
   DllCall(dllnameUSER,long:"SetLayeredWindowAttributes",long:hwnd,long:0,long:visibility,long:LWA_ALPHA)
#EndFunction


Run("notepad.exe","")
visibility=64   ; 0 = invisible  128=50 percent visible  255=100 percent visible
Transparent("~Notepad",visibility)


Article ID:   W15279
File Created: 2002:09:05:13:51:00
Last Updated: 2002:09:05:13:51:00