タスクバーを透明化するVBScript

先日Windowsの方のOSを入れ替えた訳ですが、
いつもテーマを変更してVista風にしてるんです。
それでタスクバーも透明化したいのでそういう事が出来るフリーソフトを使ってたんですが、
一応VBScriptでも出来る訳で、VBSファイルの方がお手軽だしタスクバー用に作成しました。
ただ、Win32APIを利用しますので、標準のVBSじゃ動きません。
僕はSFC miniというライブラリを使用していますので、
もしこのスクリプトを使いたい方はそちらをインストールして下さい。


http://kandk.cafe.coocan.jp/sfcmini/catid-19.html


下記のコードをコピペし、テキストに貼り付け保存し、拡張子を.vbsにします。
スタートアップフォルダにこのファイルを入れておけば、
いつもWindows起動時にタスクバーが透明になります。
設定としては、定数PENETRATE_DEGREEで透過度が調節出来ます。

Option Explicit

Const PENETRATE_DEGREE = 180'透過度を設定(上限255)

Const GWL_EXSTYLE = (-20)
Const LWA_COLORKEY = 1
Const LWA_ALPHA = 2
Const WS_EX_LAYERED = &H80000
Dim oSfc
Dim hWnd,dwStyle
Dim FindWindow,GetWindowLong,SetWindowLong,SetLayeredWindowAttributes

set FindWindow=CreateObject("SfcMini.DynaCall")
FindWindow.Declare "user32","FindWindowA"
set GetWindowLong=CreateObject("SfcMini.DynaCall")
GetWindowLong.Declare "user32","GetWindowLongA"
set SetWindowLong=CreateObject("SfcMini.DynaCall")
SetWindowLong.Declare "user32","SetWindowLongA"
set SetLayeredWindowAttributes=CreateObject("SfcMini.DynaCall")
SetLayeredWindowAttributes.Declare "user32","SetLayeredWindowAttributes"

Do Until hWnd <> 0
    hWnd = FindWindow("Shell_TrayWnd", vbNullString)
Loop
dwStyle = GetWindowLong(hWnd, GWL_EXSTYLE)
dwStyle = dwStyle Or WS_EX_LAYERED
Call SetWindowLong(hWnd, GWL_EXSTYLE, dwStyle)
Call SetLayeredWindowAttributes(hWnd, 0, PENETRATE_DEGREE, 2)



Windows自動処理のためのWSHプログラミングガイド

Windows自動処理のためのWSHプログラミングガイド