topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Monday June 3, 2024, 5:33 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Kraqule [ switch to compact view ]

Pages: [1]
1
Developer's Corner / Can somebody help me wrap my head around this?
« on: February 08, 2008, 07:23 PM »
Ok I am trying to get into my little head with very little braincells left how to use the Control_AniGif.ahk ( with the demo part of the code deleted) and the aniGIF.dll file to display animated gifs that my program needs to operate effectively. Now below is the most basic code I could think of to give me a handle without a person having to put too much effort into it. Thank you for any help in advance.

;animatedGIF.ahk

#NoEnv
#Persistent,On
#SingleInstance,Force
SetBatchLines,-1
SetWinDelay,0
DetectHiddenWindows,On



posx:=0        ;screen x
posy:=0        ;screen y
trans:=255     ;0-255


Gui,+Owner +AlwaysOnTop +E0x20 +Disable +Resize -SysMenu -MinimizeBox -MaximizeBox -Disabled -Caption -Border -ToolWindow +Background
WinSet,Transparent,0,ShowMouse
Gui,Margin,5,5
Gui,Color, white
Gui,Add,Picture, w200 h200 vpicid,XYZ.gif
Gui,Show,x%posx% y%posy% NoActivate,
Gui,+LastFound
guiid:=WinExist()
WinSet,Transparent,,

2
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.

Pages: [1]