NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

}
WinGet,cl,ControlList,ahk_id %MG_HWND%
Loop,Parse,cl,`n
{
if (A_Index=idx) {
return RegExReplace(A_LoopField,"^" . MG_CClass,"")*1
}
}
}

;-------------------------------------------------------------------------------
; Get the list of the target informations
; Implemented by lukewarm
;-------------------------------------------------------------------------------
MG_DumpWinInfo()
{
global MG_HWND, MG_HCTL, MG_Exe, MG_WClass, MG_Title, MG_CClass

WinGetPos,wx,wy,ww,wh,ahk_id %MG_HWND%
ControlGetPos,cx,cy,cw,ch,,ahk_id %MG_HCTL%

return "MG_Exe " . MG_Exe
. "`nMG_ExePath() " . MG_ExePath()
. "`nMG_CommandLine() " . MG_CommandLine()
. "`nMG_HitTest() " . MG_HitTest()
. "`nMG_LvHitTest() " . MG_LvHitTest()
. "`nMG_TvHitTest() " . MG_TvHitTest()
. "`nMG_DuiHitTest() " . MG_DuiHitTest()
. "`nMG_WClass " . MG_WClass
. "`nMG_Title " . MG_Title
. "`nMG_WinX() " . wx
. "`nMG_WinY() " . wy
. "`nMG_WinW() " . ww
. "`nMG_WinH() " . wh
. "`nMG_CClass " . MG_CClass
. "`nMG_CIndex() " . MG_CIndex()
. "`nMG_ControlX() " . cx
. "`nMG_ControlY() " . cy
. "`nMG_ControlW() " . cw
. "`nMG_ControlH() " . ch
}



;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
;
; Retrieving information related to the mouse cursor
;
;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
;-------------------------------------------------------------------------------
; Get Handle of Current Cursor
; Implemented by lukewarm
; Modified by Pyonkichi
;-------------------------------------------------------------------------------
MG_GetCursor()
{
VarSetCapacity(infCur, 16+A_PtrSize, 0)
NumPut(16+A_PtrSize, infCur, 0, "UInt")
DllCall("GetCursorInfo", "Ptr",&infCur)
hCursor := NumGet(infCur, 8, "Ptr")
return hCursor
}

;-------------------------------------------------------------------------------
; Check whether the cursor is specified one
; idCursor : Cursor ID to check
; fMode : 0 = Check cursor when Gesture is started
; : 1 = Check cursor when Gesture is recognized
; Implemented by Pyonkichi
;-------------------------------------------------------------------------------
MG_CheckCursor(idCursor=0, fMode=0)
{
global MG_Cursor
hCursor := DllCall("LoadCursor", "Ptr",0, "UInt",idCursor, "Ptr")
if (fMode==0) {
return (hCursor == MG_Cursor)
} else {
return (hCursor == MG_GetCursor())
}
}

;-------------------------------------------------------------------------------
; Check whether the cursor is defined by Windows
; fMatch : 1 = Check whether the cursor is defined by Windows
; : 0 = Check whether the cursor is NOT defined by Windows
; fMode : 0 = Check cursor when Gesture is started
; : 1 = Check cursor when Gesture is recognized
; Implemented by Pyonkichi
;-------------------------------------------------------------------------------
MG_CheckAllCursor(fMatch=0, fMode=0)
{
static tblCursorID := "32512,32513,32649,32514,32515,32648,32650,32651,32646,32645,32644,32642,32643,32516"

Loop, Parse, tblCursorID, `,
{
if (MG_CheckCursor(A_LoopField, fMode)) {
return fMatch ? 1 : 0
}
}
return (fMatch ? 0 : 1)
}

;-------------------------------------------------------------------------------
; Check whether the cursor is in specified rectangular region
; x, y : X-Y coordinates of upper left corner
; width : Width of rectangular region (0=Use Window Width)
; height : Height of rectangular region (0=Use Window Height)
; target : 0 = X-Y position is relative coordinates of Target Window
; 1 = X-Y position is relative coordinates of Target Control
; 2 = X-Y position is absolute coordinates of Screen
; origin : Origin corner of target window (0=Upper-Left 1=Upper-Right
; 2=Lower-Left 3=Lower-Right)
; fMode : 0 = Check cursor coordinates when Gesture is started
; : 1 = Check cursor coordinates when Gesture is recognized
; Implemented by Pyonkichi
;-------------------------------------------------------------------------------
MG_CursorInRect(x, y, width, height, target=0, origin=0, fMode=0)
{
global MG_X, MG_Y, MG_HWND, MG_HCTL
if (fMode==0)
{
mx:=MG_X, my:=MG_Y
}
else
{
CoordMode, Mouse, Screen
MouseGetPos, mx, my
}
;...........................................................................
; Get target rectangle
if (target==0) {
WinGetPos, winX, winY, winW, winH, ahk_id %MG_HWND%
}
else if (target==1) {
WinGetPos, winX, winY, winW, winH, ahk_id %MG_HCTL%
}
else {
SysGet, winX, 76
SysGet, winY, 77
SysGet, winW, 78
SysGet, winH, 79
}
;...........................................................................
; Convert parameters
if (x>0 && x<1) {
x := winW * x
}
if (y>0 && y<1) {
y := winH * y
}
if (width <= 0) {
width := winW + width
}
else if (width<1) {
width := winW * width
}
if (height <= 0) {
height := winH + height
}
else if (height<1) {
height := winH * height
}
;...........................................................................
; Convert coordinates
if (origin==1) {
x1 := winX + winW - 1 + x
y1 := winY + y
}
else if (origin==2) {
x1 := winX + x
y1 := winY + winH - 1 + y
}
else if (origin==3) {
x1 := winX + winW - 1 + x
y1 := winY + winH - 1 + y
}
else {
x1 := winX + x
y1 := winY + y
}
x2 := x1 + width - 1
y2 := y1 + height - 1
;...........................................................................
; Check coordinates
if (x1<=mx && mx<=x2
&& y1<=my && my<=y2)
{
return 1
}
return 0
}



;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
;
; Target control functions
;
;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
;-------------------------------------------------------------------------------
; Emulate Mouse Button
; Implemented by lukewarm
; Modified by Pyonkichi
;-------------------------------------------------------------------------------
MG_Click(btn, mode="", cnt=1)
{
local back

if (mode!="" || cnt<1) {
cnt := 1
}
if (IsLabel("MG_" . btn . "_Press"))
{
Gosub, MG_%btn%_Press
}
else if (IsLabel("MG_" . btn . "_Down"))
{
back := MG_DisableDef%btn%
MG_DisableDef%btn% := 0
Loop, %cnt%
{
if (mode="" || mode="D") {
GoSub, MG_%btn%_Down
}
if (mode="" || mode="U") {
GoSub, MG_%btn%_Up
}
}
MG_DisableDef%btn% := back
}
else
{
if (btn = "LB") {
szButton := "LEFT"
} else if (btn = "RB") {
szButton := "RIGHT"
} else if (btn = "MB") {
szButton := "MIDDLE"
} else if (btn = "X1B") {
szButton := "X1"
} else if (btn = "X2B") {
szButton := "X2"
}
if (mode="") {
MouseClick, %szButton%,,, %cnt%
} else {
MouseClick, %szButton%,,,,, %mode%
}
}
}

;-------------------------------------------------------------------------------
; Move Mouse Cursor
; x, y : X-Y coordinates of the cursor
; origin : 0 = Origin point is gesture start position
; 1 = Origin point is action start position
; 2 = Origin point is current cursor position
; abs : 0 = x and y are relative coordinates from the origin point
; : 1 = x and y are absolute coordinates
; Implemented by lukewarm
; Modified by Pyonkichi
;-------------------------------------------------------------------------------
MG_Move(x=0, y=0, origin=0, abs=0)
{
global
CoordMode,Mouse,Screen
SetMouseDelay,-1
local relative:=""
if (abs==0)
{
if (origin==0) {
x+=MG_X, y+=MG_Y
} else if (origin==1) {
x+=MG_NowX, y+=MG_NowY
} else {
relative:="R"
}
}
BlockInput, On
MouseMove, %x%, %y%, 0, %relative%
BlockInput, Off
}

;-------------------------------------------------------------------------------
; Scroll
; Implemented by lukewarm
;-------------------------------------------------------------------------------
MG_Scroll(x=0,y=0,hctl=0)
{
global
if (!hctl) {
hctl:=MG_HCTL
}
Loop,% Abs(x)
PostMessage,0x114,% x>=0,0,,ahk_id %hctl%
Loop,% Abs(y)
PostMessage,0x115,% y>=0,0,,ahk_id %hctl%
}

;-------------------------------------------------------------------------------
; Instant Scroll
; Implemented by lukewarm
;-------------------------------------------------------------------------------
MG_InstantScroll(stay=1,ppc_x=8,ppc_y=12,hctl=0)
{
global
local mx,my,cx,cy
if (!hctl) {
hctl:=MG_HCTL
}
CoordMode,Mouse,Screen
MouseGetPos,mx,my
Loop,% Abs(cx:=((mx-MG_X)//ppc_x))
PostMessage,0x114,% cx>=0,0,,ahk_id %hctl%
Loop,% Abs(cy:=((my-MG_Y)//ppc_y))
PostMessage,0x115,% cy>=0,0,,ahk_id %hctl%
if (stay) {
mx:=mx-cx*ppc_x
my:=my-cy*ppc_y
MouseMove,%mx%,%my%,0
}
}

;-------------------------------------------------------------------------------
; Drag Scroll
; Implemented by lukewarm
;-------------------------------------------------------------------------------
MG_DragScroll(ppc_x=8,ppc_y=12,hctl=0)
{
global
static lx:=0,ly:=0,lmx:=0,lmy:=0,lctl:=0
if (!hctl) {
hctl:=MG_HCTL
}
if (lmx!=MG_X || lmy!=MG_Y || lctl!=hctl) {
lmx:=lx:=MG_X
lmy:=ly:=MG_Y
lctl:=hctl
}
CoordMode,Mouse,Screen
MouseGetPos,mx,my
Loop,% Abs(cx:=(mx-lx)//ppc_x)
PostMessage,0x114,% cx<0,0,,ahk_id %hctl%
Loop,% Abs(cy:=(my-ly)//ppc_y)
PostMessage,0x115,% cy<0,0,,ahk_id %hctl%
lx:=lx+cx*ppc_x
ly:=ly+cy*ppc_y
}

;-------------------------------------------------------------------------------
; Scroll Completely
; dir : "V":Vertical Scroll "H":Horizontal Scroll
; cnt : Scroll Lines or Pages (Negative Value : Scroll Up or Left)
; fPage : 1=Page Scroll 0=Line Scroll
; Implemented by Pyonkichi
;-------------------------------------------------------------------------------
MG_Scroll2(dir, cnt, fPage=0)
{
global MG_HCTL, MG_X, MG_Y, MG_CtlL, MG_CtlT, MG_CtlW, MG_CtlH, MG_hSB
static pEnumChildProc := 0
if (!pEnumChildProc) {
pEnumChildProc := RegisterCallback("MG_EnumChildProc", "Fast")
}
WinGetPos, MG_CtlL, MG_CtlT, MG_CtlW, MG_CtlH, ahk_id %MG_HCTL%
hWnd := MG_HCTL
lParam := 0
MG_hSB := 0
Loop, 2
{
DllCall("EnumChildWindows", "Ptr",hWnd, "Ptr",pEnumChildProc, "Ptr",(dir="V"))
if (MG_hSB) {
lParam := MG_hSB
hWnd := DllCall("GetParent", "Ptr",MG_hSB)
break
}
if (A_Index==1) {
hWnd := DllCall("GetParent", "Ptr",MG_HCTL)
}
}
if (!lParam) {
hWnd := MG_HCTL
}
uMsg := (dir="V") ? 0x115 : 0x114
wParam := (cnt>=0) ? 1 : 0
if (fPage) {
wParam += 2
}
Loop, % Abs(cnt) {
PostMessage, %uMsg%, %wParam%, %lParam%,, ahk_id %hWnd%
Sleep, 1
}
}

;-------------------------------------------------------------------------------
; Enumerate Child Windows Callback Function
; hWnd : Handle to Child Window
; lParam : 1=Vertical Scroll 0=Horizontal Scroll
; Implemented by Pyonkichi
;-------------------------------------------------------------------------------
MG_EnumChildProc(hWnd, lParam)
{
global MG_HCTL, MG_X, MG_Y, MG_CtlL, MG_CtlT, MG_CtlW, MG_CtlH, MG_hSB
WinGetClass, szClass, ahk_id %hWnd%
if (!InStr(szClass, "ScrollBar")) {
return true
}
WinGet, dwStyle, Style, ahk_id %hWnd%
if (!(dwStyle & 0x10000000)) {
return true
}
static prevL, prevT
WinGetPos, sbL, sbT, sbW, sbH, ahk_id %hWnd%
if (lParam)
{
if (sbW > sbH) {
return true
}
if ((sbL+sbW)<MG_CtlL || sbL>(MG_CtlL+MG_CtlW) || (sbT+sbH)<=MG_CtlT || sbT>=(MG_CtlT+MG_CtlH))
{
return true
}
if ((MG_Y >= sbT) && (MG_Y < sbT+sbH))
{
MG_hSB := hWnd
return false
}
if (MG_hSB && (abs(MG_Y-sbT) > abs(MG_Y-prevT)))
{
return true
}
}
else
{
if (sbW < sbH) {
return true
}
if ((sbT+sbH)<MG_CtlT || sbT>(MG_CtlT+MG_CtlH) || (sbL+sbW)<=MG_CtlL || sbL>=(MG_CtlL+MG_CtlW))
{
return true
}
if ((MG_X >= sbL) && (MG_X < sbL+sbW))
{
MG_hSB := hWnd
return false
}
if (MG_hSB && (abs(MG_X-sbL) > abs(MG_X-prevL)))
{
return true
}
}
MG_hSB:=hWnd, prevL:=sbL, prevT:=sbT
return true
}

;-------------------------------------------------------------------------------
; Drag Scroll Completely
; invert : 0=Scroll against the cursor 1=Follow the cursor
; auto : 0=Scroll one by one 1=Auto-scrolling
; resV : Vertical Resolution
; resH : Horizontal Resolution
; Implemented by Pyonkichi
;-------------------------------------------------------------------------------
MG_DragScroll2(invert=1, auto=0, resV=15, resH=30)
{
global MG_HCTL, MG_X, MG_Y, MG_hSB
static lx:=0, ly:=0, lmx:=0, lmy:=0, lctl:=0
if (lmx!=MG_X || lmy!=MG_Y || lctl!=MG_HCTL)
{
lmx:=lx:=MG_X
lmy:=ly:=MG_Y
lctl:=MG_HCTL
}
CoordMode,Mouse,Screen
MouseGetPos,mx,my
if (auto)
{
dX := (mx-MG_X) // resH
dY := (my-MG_Y) // resV
}
else
{
dX := (mx-lx) // resH
dY := (my-ly) // resV
lx += dX*resH
ly += dY*resV
}
dirV := (dY<0 ? -1 : 1) * (invert ? -1 : 1)
dirH := (dX<0 ? -1 : 1) * (invert ? -1 : 1)
dY := abs(dY)
dX := abs(dX)
while (dX>0 || dY>0)
{
if (dY>0) {
MG_Scroll2("V", dirV)
dY--
}
if (dX>0) {
MG_Scroll2("H", dirH)
dX--
}
}
}

;-------------------------------------------------------------------------------
; Send Wheel Rotation Message
; dir : "U":Rotation Up "D":Rotation Down
; counts : Rotation Distance
; Implemented by Pyonkichi
;-------------------------------------------------------------------------------
MG_SendWheel(dir, counts=1)
{
local szClass
WinGetClass, szClass
if (szClass="ApplicationFrameWindow" || szClass="Windows.UI.Core.CoreWindow") {
Send, % "{" (dir="U" ? "WheelUp" : "WheelDown") (counts>1 ? " " counts : "") "}"
return
}
if (szClass="tooltips_class32") {
SendMessage, 0x041C
CoordMode, Mouse, Screen
MouseGetPos, MG_X, MG_Y, MG_HWND, MG_HCTL, 3
}
hWnd := MG_HCTL ? MG_HCTL : MG_HWND
wParam := (dir="U" ? 0x00780000*counts : 0xFF880000*counts)
| GetKeyState("LButton")
| GetKeyState("RButton") << 1
| GetKeyState("Shift") << 2
| GetKeyState("Ctrl") << 3
| GetKeyState("MButton") << 4
| GetKeyState("XButton1") << 5
| GetKeyState("XButton2") << 6
lParam := MG_Y<<16 | MG_X
PostMessage, 0x020A, %wParam%, %lParam%,, ahk_id %hWnd%
}

;-------------------------------------------------------------------------------
; Move and Resize the Window
; x : Left coordinates of the window
; y : Upper coordinates of the window
; w : Width of the window
; h : Height of the window
; fRel : Position and Size are (0=Absolute or 1=Relative) Value
; hWnd : Handle of the target window
; ExAreas : Edge areas to exclude from the screen for window arrangement
; bAdjust : Adjusts window size with extended border widths of Aero window
;
; Implemented by Pyonkichi
;-------------------------------------------------------------------------------
MG_WinMove(x="", y="", w="", h="", fRel=0, hWnd="", ExAreas=0, bAdjust=0)
{
global MG_X, MG_Y, MG_HWND

if (x="" && y="" && w="" && h="") {
return
}
if (!hWnd) {
hWnd := MG_HWND
}
;...........................................................................
; Relative
if (fRel)
{
WinGetPos, winX, winY, winW, winH, ahk_id %hWnd%
; Left Position
if (RegExMatch(x, "([0-9]+)/([0-9]+)", $)) {
winX := winX * $1 // $2
} else if (x<=0 || 1<=x) {
winX += x
} else {
winX *= x
}
; Top Position
if (RegExMatch(y, "([0-9]+)/([0-9]+)", $)) {
winY := winY * $1 // $2
} else if (y<=0 || 1<=y) {
winY += y
} else {
winY *= y
}
; Width
if (RegExMatch(w, "([0-9]+)/([0-9]+)", $)) {
winW := winW * $1 // $2
} else if (w<=0 || 1<=w) {
winW += w
} else {
winW *= w
}
; Height
if (RegExMatch(h, "([0-9]+)/([0-9]+)", $)) {
winH := winH * $1 // $2
} else if (h<=0 || 1<=h) {
winH += h
} else {
winH *= h
}
}
;...........................................................................
; Absolute
else
{
MG_GetMonitorRect(MG_X, MG_Y, dtL, dtT, dtR, dtB, true)
dtL := ExAreas[1] ? dtL+ExAreas[1] : dtL
dtT := ExAreas[2] ? dtT+ExAreas[2] : dtT
dtR := ExAreas[3] ? dtR-ExAreas[3] : dtR
dtB := ExAreas[4] ? dtB-ExAreas[4] : dtB
dtW := dtR - dtL
dtH := dtB - dtT
; Left Position
if (RegExMatch(x, "([0-9]+)/([0-9]+)", $)) {
winX := dtW * $1 // $2
} else if (x<=0 || 1<=x) {
winX := x
} else {
winX := dtW * x
}
winX += dtL
; Top Position
if (RegExMatch(y, "([0-9]+)/([0-9]+)", $)) {
winY := dtH * $1 // $2
} else if (y<=0 || 1<=y) {
winY := y
} else {
winY := dtH * y
}
winY += dtT
; Width
if (RegExMatch(w, "([0-9]+)/([0-9]+)", $)) {
winW := dtW * $1 // $2
} else if (w<0 || 1<=w) {
winW := w
} else {
winW := dtW * (w!=0 ? w : 1)
}
; Height
if (RegExMatch(h, "([0-9]+)/([0-9]+)", $)) {
winH := dtH * $1 // $2
} else if (h<0 || 1<=h) {
winH := h
} else {
winH := dtH * (h!=0 ? h : 1)
}
}
bdL:=0, bdT:=0, bdR:=0, bdB:=0
if (bAdjust) {
MG_GetExtendedBorders(hWnd, bdL, bdT, bdR, bdB)
}
winX := (x!="") ? winX-bdL : ""
winY := (y!="") ? winY-bdT : ""
winW := (w!="") ? winW+bdL+bdR : ""
winH := (h!="") ? winH+bdT+bdB : ""
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.