Hi Guest,
If you would have read the Forum,
it would have come to your Attention, that i am not the only
one with that problem. I would not open up a Thread for no reason,
and since the problem is known, i thought Chris might know
where so search...
Anyway,
Here is a little example where i got that problem, too.
The "Min Application to tray Menu" i have refered to earlier,
is not included. The Hotkeys stop working after a few Minutes.
My assumption is, that there is a problem to keep hook of the MouseWheel, if something like this exists.
HotKeys included:
Shift-Wheelup / Shift-WheelDown -> Control Volume
Shift-MButton -> Mute / Unmute Sound
Thanks,
Deep-Silence
Code:
/*
------------------------------------------------------------------------------------------------------------------------------
_ _ _____ _ ___ ____ ____ __ __ _
/ \ _ _| |_ ___ | ____|_ _____ ___ _ _| |_ ___ / _ \/ ___|| _ \ \ \ / /__ | |_ _ _ __ ___ ___ _
/ _ \| | | | __/ _ \| _| \ \/ / _ \/ __| | | | __/ _ \ _____ | | | \___ \| | | | \ \ / / _ \| | | | | '_ ` _ \ / _ \ (_)
/ ___ \ |_| | |_ (_) | |___ > < __/ (__| |_| | |_ __/ |_____| | |_| |___) | |_| | \ V / (_) | | |_| | | | | | | __/ _
/_/ \_\__,_|\__\___/|_____/_/\_\___|\___|\__,_|\__\___| \___/|____/|____/ \_/ \___/|_|\__,_|_| |_| |_|\___| (_)
------------------------------------------------------------------------------------------------------------------------------
*/
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Disclaimer:
I do not foresee any risk in running this script but
you may run this file "ONLY" at your own risk.
* * * * * * * * * * * * * * * * * * * * * * * * * * * *
http://www.autohotkey.com/forum/post-61081.html#61081
File Name : OSD_VOL_Gradient.ahk
Download : http://file.autohotkey.net/goyyah/Tips-N-Tricks/Gradients/OSD_VOL_Gradient.ahk
SnapShot : http://file.autohotkey.net/goyyah/Tips-N-Tricks/Gradients/osd_vol_green.png
Post : http://www.autohotkey.com/forum/viewtopic.php?p=61081#61081
Main Title : Multimedia Utility
Sub Title : OSD Volume Control - Gradient
Description : Just an another OSD Volume Control Display for Windows!
Written as an demonstration for BITMAP Gradients.
Requires the following file for proper On Screen Display:
http://file.autohotkey.net/goyyah/Tips-N-Tricks/Gradients/OSD_Green.bmp
Author : A.N.Suresh Kumar aka "Goyyah"
Email : arian.suresh@gmail.com
Created : 2006-03-24
Modified : 2006-03-24
Version : 0.50
Scripted in : AutoHotkey Version 1.0.44.00 , www.autohotkey.com
*/
#SingleInstance, Force
#InstallMouseHook
#InstallKeybdHook
#NoTrayIcon
Label_Create_OSD_Vulume_GUI:
IfNotExist, OSD_Green.bmp
URlDownloadToFile, http://file.autohotkey.net/goyyah/Tips-N-Tricks/Gradients/OSD_Green.bmp, OSD_Green.bmp
Gui, Color, EEAA99
Gui, +Lastfound
WinSet, TransColor, EEAA99 250
Gui, -Caption
Gui, Font, s36 Bold, Verdana
Gui, Add, Text, x0 y10,+
X=25
Loop,25
{
Var=Pic%A_Index%
X+=20
Gui, Add, Picture, x%X% y10 w12 h50 Hidden Border v%var% , OSD_Green.bmp
}
Gui, Add, Text, x+10 y10,-
/*
------------------------------------------------------------------------------------------------------------------------------
_ _ _____ _ __ ___ _____ __ __ _
/ \ _ _| |_ ___ | ____|_ _____ ___ _ _| |_ ___ \ \ / (_)_ ___ _| __ __ _ _ _| \/ (_)_ __ _
/ _ \| | | | __/ _ \| _| \ \/ / _ \/ __| | | | __/ _ \ _____ \ \ /\ / /| | '_ \| || '__/ _` | | | | |\/| | | '_ \ (_)
/ ___ \ |_| | |_ (_) | |___ > < __/ (__| |_| | |_ __/ |_____| \ V V / | | | | | || | | (_| | |_| | | | | | | | | _
/_/ \_\__,_|\__\___/|_____/_/\_\___|\___|\__,_|\__\___| \_/\_/ |_|_| |_|_||_| \__,_|\__, |_| |_|_|_| |_| (_)
|___/
------------------------------------------------------------------------------------------------------------------------------
*/
;----------------------------------------------------------
;----------------------------------------------------------
; WinTraymin.ahk
; by Sean
;----------------------------------------------------------
;----------------------------------------------------------
; Adding a trayminned trayicon of hWnd: WinTraymin(hWnd,0), where 0 can be omitted.
; Removing all trayminned trayicons: WinTraymin(0,-1).
; Other values than 0 & -1 are reserved for internal use.
;----------------------------------------------------------
;#NoTrayIcon
TrayminOpen:
SetWinDelay, 0
SetFormat, Integer, D
CoordMode, Mouse, Screen
DetectHiddenWindows On
hAHK:=WinExist("ahk_class AutoHotkey ahk_pid " . DllCall("GetCurrentProcessId"))
ShellHook:=DllCall("RegisterWindowMessage","str","SHELLHOOK")
DllCall("RegisterShellHookWindow","Uint",hAHK)
OnExit, TrayminClose
Return
; Shift + Mbutton, to mute / unmute Mastervolume
+MButton::
Send {Volume_Mute}
Return
+WheelUp::
SetVolume(+7)
Return
+WheelDown::
SetVolume(-7)
Return
UpdateOSD:
Gui, Show
SoundGet,Volume,MASTER, VOLUME
Volume:=Round((Volume/4),0)
Loop,25
{
Var=Pic%A_Index%
If A_Index <= %Volume%
GuiControl Show, %Var%
else
GuiControl Hide, %Var%
}
SetTimer, OSD_Volume_Gui_Hide, 1000
Return
SetVolume(Val) {
SoundGet,Volume,MASTER, VOLUME
Volume+=%Val%
If Volume < 4
Volume = 0
SoundSet, %Volume%, MASTER, VOLUME
GoSub, UpdateOSD
Return
}
OSD_Volume_Gui_Hide:
SetTimer, OSD_Volume_Gui_Hide, OFF
Gui, Hide
Return
/*
------------------------------------------------------------------------------------------------------------------------------
____ __ ___ _____ __ __ _
| _ \ _ _ _ __ \ \ / (_)_ ___ _| __ __ _ _ _| \/ (_)_ __ _
| |_) | | | | '_ \ _____ \ \ /\ / /| | '_ \| || '__/ _` | | | | |\/| | | '_ \ (_)
| _ <| |_| | | | | |_____| \ V V / | | | | | || | | (_| | |_| | | | | | | | | _
|_| \_\\__,_|_| |_| \_/\_/ |_|_| |_|_||_| \__,_|\__, |_| |_|_|_| |_| (_)
|___/
------------------------------------------------------------------------------------------------------------------------------
*/
TrayminClose:
DllCall("DeregisterShellHookWindow","Uint",hAHK)
WinTraymin(0,-1)
OnExit
ExitApp
RButton Up::
If h:=WM_NCHITTEST()
WinTraymin(h)
Else Click, % SubStr(A_ThisHotkey,1,1) ; for hotkey: LButton/MButton/RButton
Return
WM_NCHITTEST()
{
MouseGetPos, x, y, z
SendMessage, 0x84, 0, (x&0xFFFF)|(y&0xFFFF)<<16,, ahk_id %z%
Return ErrorLevel=8 ? z : ""
}
WM_SHELLHOOKMESSAGE(wParam, lParam, nMsg)
{
Critical
If nMsg=1028
{
If wParam=1028
Return
Else If (lParam=0x201||lParam=0x205||lParam=0x207)
WinTraymin(wParam,3)
}
Else If (wParam=1||wParam=2)
WinTraymin(lParam,wParam)
Return 0
}
WinTraymin(hWnd = "", nFlags = "")
{
Local h, ni, fi, uid, pid, hProc, sClass
Static nMsg, nIcons:=0
nMsg ? "" : OnMessage(nMsg:=1028,"WM_SHELLHOOKMESSAGE")
NumPut(hAHK,NumPut(VarSetCapacity(ni,444,0),ni))
If Not nFlags
{
If Not ((hWnd+=0)||hWnd:=DllCall("GetForegroundWindow"))||((h:=DllCall("GetWindow","Uint",hWnd,"Uint",4))&&DllCall("IsWindowVisible","Uint",h)&&!hWnd:=h)||!(VarSetCapacity(sClass,15),DllCall("GetClassNameA","Uint",hWnd,"str",sClass,"Uint",VarSetCapacity(sClass)+1))||sClass=="Shell_TrayWnd"||sClass=="Progman"
Return
OnMessage(ShellHook,"")
WinMinimize, ahk_id %hWnd%
WinHide, ahk_id %hWnd%
Sleep, 100
OnMessage(ShellHook,"WM_SHELLHOOKMESSAGE")
uID:=uID_%hWnd%,uID ? "" : (uID_%hWnd%:=uID:=++nIcons=nMsg ? ++nIcons : nIcons)
hIcon_%uID% ? "" : (VarSetCapacity(fi,352,0),DllCall("GetWindowThreadProcessId","Uint",hWnd,"UintP",pid),DllCall("psapi\GetModuleFileNameExA","Uint",hProc:=DllCall("kernel32\OpenProcess","Uint",0x410,"int",0,"Uint",pid),"Uint",0,"Uint",&fi+12,"Uint",260),DllCall("kernel32\CloseHandle","Uint",hProc),DllCall("shell32\SHGetFileInfoA","Uint",&fi+12,"Uint",0,"Uint",&fi,"Uint",352,"Uint",0x101),hIcon_%uID%:=NumGet(fi)),DllCall("GetWindowTextA","Uint",hWnd,"Uint",NumPut(hIcon_%uID%,NumPut(nMsg,NumPut(1|2|4,NumPut(uID,ni,8)))),"int",64)
Return hWnd_%uID%:=DllCall("shell32\Shell_NotifyIconA","Uint",hWnd_%uID% ? 1 : 0,"Uint",&ni) ? hWnd : DllCall("ShowWindow","Uint",hWnd,"int",5)*0
}
Else If nFlags > 0
{
If (nFlags=3&&uID:=hWnd)
If WinExist("ahk_id " . hWnd:=hWnd_%uID%)
{
WinShow, ahk_id %hWnd%
WinRestore, ahk_id %hWnd%
}
Else nFlags:=2
Else uID:=uID_%hWnd%
Return uID ? (hWnd_%uID% ? (DllCall("shell32\Shell_NotifyIconA","Uint",2,"Uint",NumPut(uID,ni,8)-12),hWnd_%uID%:="") : "",nFlags==2&&hIcon_%uID% ? (DllCall("DestroyIcon","Uint",hIcon_%uID%),hIcon_%uID%:="") : "") : ""
}
Else
Loop, % nIcons
hWnd_%A_Index% ? (DllCall("shell32\Shell_NotifyIconA","Uint",2,"Uint",NumPut(A_Index,ni,8)-12),DllCall("ShowWindow","Uint",hWnd_%A_Index%,"int",5),hWnd_%A_Index%:="") : "",hIcon_%A_Index% ? (DllCall("DestroyIcon","Uint",hIcon_%A_Index%),hIcon_%A_Index%:="") : ""
}