by yama » 2006年6月22日(木) 11:26
MainWnd_Createに書いた以前のコードに追加して自宅の98で確認しました。
時間がたって読みかえしたときずいぶんまごつきそうです。たくさんコメントかいていますが、もっとすっきりした書き方があるのでしょうね。
動いて何ぼということでいつも自分をなぐさめています。
今回も希望の機能が実現できました、ありがとうございました。
[ここをクリックすると内容が表示されます] [ここをクリックすると非表示にします]コード: 全て選択
'透過設定
'Dim hModule As HINSTANCE
'架空の関数を宣言(SetLayeredWindowAttributesの宣言を参考にして作成)
TypeDef SetLWA = *Function(hwnd As HWND,crKey As Long,bAlpha As BYTE ,dwFlags As DWORD ) As Integer
Dim DamSetLayeredWindowAttributes As SetLWA
'DLLを動的にロード
hModule=LoadLibrary("user32.dll")
IF hModule<>0 Then 'hModule=0 のときDLLがないので終了
'関数のアドレスを取得
DamSetLayeredWindowAttributes=GetProcAddress(hModule,"SetLayeredWindowAttributes")
'ここから
If DamSetLayeredWindowAttributes=0 then
FreeLibrary(hModule)
exit sub
End If
'ここまでを追加
'透過設定 SPRITさんホームページより
SetWindowLong(hMainWnd, GWL_EXSTYLE, GetWindowLong(hMainWnd, GWL_EXSTYLE) or &H80000)
if Toukasuru =1 then
'ポインタを使って関数を実行します
DamSetLayeredWindowAttributes(hMainWnd,0,Int(Toukaritu*255/100),LWA_ALPHA)
SetLayeredWindowAttributes(hMainWnd,0,Int(Toukaritu*255/100),LWA_ALPHA)
'第3引数 0(薄い)~255(濃い)を変えると、透過度が変わります。
Else
DamSetLayeredWindowAttributes(hMainWnd,0,255,LWA_ALPHA)
End If
End If
'DLLを開放
FreeLibrary(hModule)
MainWnd_Createに書いた以前のコードに追加して自宅の98で確認しました。
時間がたって読みかえしたときずいぶんまごつきそうです。たくさんコメントかいていますが、もっとすっきりした書き方があるのでしょうね。
動いて何ぼということでいつも自分をなぐさめています。
今回も希望の機能が実現できました、ありがとうございました。
[hide][code]
'透過設定
'Dim hModule As HINSTANCE
'架空の関数を宣言(SetLayeredWindowAttributesの宣言を参考にして作成)
TypeDef SetLWA = *Function(hwnd As HWND,crKey As Long,bAlpha As BYTE ,dwFlags As DWORD ) As Integer
Dim DamSetLayeredWindowAttributes As SetLWA
'DLLを動的にロード
hModule=LoadLibrary("user32.dll")
IF hModule<>0 Then 'hModule=0 のときDLLがないので終了
'関数のアドレスを取得
DamSetLayeredWindowAttributes=GetProcAddress(hModule,"SetLayeredWindowAttributes")
'ここから
If DamSetLayeredWindowAttributes=0 then
FreeLibrary(hModule)
exit sub
End If
'ここまでを追加
'透過設定 SPRITさんホームページより
SetWindowLong(hMainWnd, GWL_EXSTYLE, GetWindowLong(hMainWnd, GWL_EXSTYLE) or &H80000)
if Toukasuru =1 then
'ポインタを使って関数を実行します
DamSetLayeredWindowAttributes(hMainWnd,0,Int(Toukaritu*255/100),LWA_ALPHA)
SetLayeredWindowAttributes(hMainWnd,0,Int(Toukaritu*255/100),LWA_ALPHA)
'第3引数 0(薄い)~255(濃い)を変えると、透過度が変わります。
Else
DamSetLayeredWindowAttributes(hMainWnd,0,255,LWA_ALPHA)
End If
End If
'DLLを開放
FreeLibrary(hModule) [/code][/hide]