First off I must thank
Skrommel for the help he has given me thus far. I have taken what he has given me and I have twisted it a little more to provide the product I desire.
1. The functionality I am still lacking in this script is the ability to have functioning animated gif's.
2. There is an issue I am having with displaying the updated action. The code seams to generate a white background one time and a transparent background the next.
This is meant to be a draggable alwaysontop window (Ctrl + Left Mouse Click to Move) that displays the mouse actions being performed on the system.
Here is my code and I have played with aniGIF.dll and control to little success. (My mind is still to small for it I guess.) Any ideas or input would be greatly welcomed.
;ShowMouse.ahk
; Shows mouse actions
;Skrommel @ 2008
#NoEnv
#Persistent,On
#SingleInstance,Force
SetBatchLines,-1
SetWinDelay,0
DetectHiddenWindows,On
size:=16 ;font size
posx:=300 ;screen x
posy:=300 ;screen y
hide:=5000 ;seconds
trans:=255 ;0-255
SysGet,dragx,68
SysGet,dragy,69
doubleClick:=DllCall("GetDoubleClickTime")
time:=A_TickCount
Gui,+Owner +AlwaysOnTop +E0x20 +Disable +Resize -SysMenu -MinimizeBox -MaximizeBox -Disabled -Caption -Border -ToolWindow +Background
WinSet,Transparent,0,ShowMouse
Gui,Margin,5,5
Gui,Font,s%size% w800
Gui,Color, white
Gui,Add,Text,+Center w200 vtextid, Instructors Helper
Gui,Add,Picture, w200 h200 vpicid,mouse.gif
Gui,Show,x%posx% y%posy% NoActivate, ShowMouse
Gui,+LastFound
guiid:=WinExist()
WinSet,Transparent,%trans%,ShowMouse %guiid%
SetTimer,HIDE,%hide%
~*LButton::
MouseGetPos,ldx,ldy
SHOW("Left Click")
GetKeyState,state,RControl,U
If state=D
{MouseGetPos,mx1,my1,mid
WinGetTitle,stitle,ahk_id %mid%
If stitle=ShowMouse
{
Loop
{
MouseGetPos,mx2,my2
WinGetPos,sx,sy,,,ahk_id %mid%
sx:=sx-mx1+mx2
sy:=sy-my1+my2
WinMove,ahk_id %mid%,,%sx%,%sy%
mx1:=mx2
my1:=my2
GetKeyState,mstate,LButton,P
If mstate=U
Break
}
}
}
Return
~*RButton::
MouseGetPos,rdx,rdy
SHOW("Right Click")
Return
~*LButton Up::
oldtime:=time
time:=A_TickCount
If (time-oldtime<doubleclick)
{
SHOW("Double Click")
Return
}
MouseGetPos,lux,luy
If (lux>ldx+dragx Or lux<ldx-dragx Or luy>ldy+dragy Or luy<ldy-dragy)
SHOW("Left Drag")
;Else
; SHOW("")
Return
~*RButton Up::
MouseGetPos,rux,ruy
If (rux>rdx+dragx Or rux<rdx-dragx Or ruy>rdy+dragy Or ruy<rdy-dragy)
SHOW("Right Drag")
;Else
; SHOW("")
Return
~*WheelUp::
SHOW("Scroll Up")
Return
~*WheelDown::
SHOW("Scroll Down")
Return
SHOW(text)
{
Global guiid
Global textid
Global picid
GuiControl,,textid,%text%
GuiControl,,picid, %text%.gif
WinShow,ahk_id %guiid%
SetTimer,HIDE,%hide%
}
HIDE:
SetTimer,HIDE,Off
WinHide,ahk_id %guiid%
Return
The gifs are the animations that are to go with program to give a visual aid to those watching so they have an idea what is being performed with the mouse. A simple reminder that while Skrommel may have wrote the simple basic version I have played a fair bit and probably broke the entire set of coding rules in getting things to where I am close to realizing this project as finished.