Created
July 20, 2013 15:30
-
-
Save budRich/6045462 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
About = | |
( | |
wpJunkie - The No.1 Wallpaper Selecta | |
Made by budRich | |
Last update: 2013-08-30 | |
) | |
Init() | |
+F12::Reload | |
#If FocusEdit() | |
Up::ControlSend,, {Up}, ahk_id %hlblList% | |
Down::ControlSend,, {Down}, ahk_id %hlblList% | |
#If | |
FocusEdit() { | |
ControlGetFocus, focCtrl, wpJunkie ahk_class AutoHotkeyGUI | |
r := ( (focCtrl="Edit1") ? (1) : (0) ) | |
return, %r% | |
} | |
#If ((guimode="thumbs") && ((WinActive("wpThumbs")) || (WinActive("wpJunkie")))) | |
Del::Gosub, WPDelete | |
Up::ThumbsNav("u") | |
Down::ThumbsNav("d") | |
Left::ThumbsNav("l") | |
Right::ThumbsNav("r") | |
Enter::WPUpdate(%oldsel%.path) | |
WheelUp::OnScroll(0, 0, 0x115, WinExist("wpThumbs ahk_class AutoHotkeyGUI")) | |
WheelDown::OnScroll(1, 0, 0x115, WinExist("wpThumbs ahk_class AutoHotkeyGUI")) | |
PgUp:: | |
Loop, 4 | |
{ | |
OnScroll(0, 0, 0x115, WinExist("wpThumbs ahk_class AutoHotkeyGUI")) | |
ThumbsNav("u") | |
} | |
return | |
PgDn:: | |
Loop, 4 | |
{ | |
OnScroll(1, 0, 0x115, WinExist("wpThumbs ahk_class AutoHotkeyGUI")) | |
ThumbsNav("d") | |
} | |
return | |
#If | |
ThumbsNav(dir) { | |
global | |
%oldsel%.selected := 0 | |
GuiControl, Thumbs:+hidden, %oldsel%prog | |
If (dir="r") | |
newsel := (oldsel+1>ncnt) ? (ncnt) : (oldsel+1) | |
If (dir="l") | |
newsel := (oldsel-1<1) ? (1) : (oldsel-1) | |
If (dir="d") | |
newsel := (oldsel+cols>ncnt) ? (ncnt) : (oldsel+cols) | |
if (dir="u") | |
newsel := (oldsel-cols<1) ? (1) : (oldsel-cols) | |
GuiControl, Thumbs:-hidden, %newsel%prog | |
%newsel%.selected := 1 | |
oldsel := newsel | |
GuiControlGet, selpos, Thumbs:pos, %newsel%prog | |
if (((dir = "r") || (dir = "d")) && (selPosY>360)) { | |
OnScroll(1, 0, 0x115, WinExist("wpThumbs ahk_class AutoHotkeyGUI")) | |
OnScroll(1, 0, 0x115, WinExist("wpThumbs ahk_class AutoHotkeyGUI")) | |
} | |
if (((dir = "l") || (dir = "u")) && (selPosY<5)) { | |
OnScroll(0, 0, 0x115, WinExist("wpThumbs ahk_class AutoHotkeyGUI")) | |
OnScroll(0, 0, 0x115, WinExist("wpThumbs ahk_class AutoHotkeyGUI")) | |
} | |
totxt := %newsel%.filename | |
SendMessage (LB_SELECTSTRING := 0x018C),0,&totxt,, ahk_id %hlblList% | |
} | |
Init() { | |
global | |
#SingleInstance force | |
#NoEnv | |
#Persistent | |
if (!A_IsCompiled) | |
#NoTrayIcon | |
SetBatchLines, -1 | |
SetWinDelay, -1 | |
SetWorkingDir, %A_ScriptDir% | |
SendMode, Input | |
Gui +LastFound | |
PID := DllCall( "GetCurrentProcessId" ) | |
bh := 542 | |
sh := 50 | |
guiW := 348 | |
OnExit, Avslut | |
lstHistory := Object() | |
guimode:="" | |
if !(FileExist("settings.ini")) { | |
gosub, Options | |
return | |
} | |
if ((!FileExist("tray.ico")) && (!A_IsCompiled)) | |
URLDownloadToFile, https://dl.dropboxusercontent.com/u/38817458/tray.ico, tray.ico | |
gosub, traymenu | |
IniRead, mambo, settings.ini , General | |
Loop, Parse, mambo, `n | |
{ | |
StringSplit, inivar, A_LoopField,=,%A_Space%%A_Tab% | |
%inivar1% := inivar2 | |
} | |
SplitPath, A_Scriptname, , , , OutNameNoExt | |
LinkFile=%A_Startup%\%OutNameNoExt%.lnk | |
if(autostart=1) { | |
IfNotExist, %LinkFile% | |
FileCreateShortcut, %A_ScriptFullPath%, %LinkFile% | |
} | |
else | |
FileDelete, %LinkFile% | |
if (randomize=1) { | |
SetTimer, WPNext,% 60000*interval | |
} | |
if(hottis) | |
Hotkey, %hottis%, GuiToggle | |
FreshList(wpFolder) | |
} | |
traymenu: | |
Menu, tray, NoStandard | |
if (!A_IsCompiled) { | |
Menu, tray, Icon, tray.ico | |
} | |
menu, tray, Icon | |
Menu, tray, Tip , wpJunkie | |
Menu, tray, add, Show | |
Menu, tray, add, Options | |
Menu, tray, add, About | |
Menu, tray, add, Quit | |
Menu, Tray, Default, Show | |
Menu, Tray, Click, 1 | |
return | |
Quit: | |
ExitApp | |
return | |
Show: | |
gosub, GuiToggle | |
return | |
About: | |
MsgBox,,About wpJunkie, %About% | |
return | |
Options: | |
OptionsGui() | |
return | |
GuiToggle: | |
if WinExist("wpJunkie") { | |
if (guimode="small") | |
Gosub, WPSort | |
else | |
Gosub, WPRandom | |
} else { | |
guimode:="" | |
Gosub, WPRandom | |
} | |
return | |
wpJunkieGui(_mode="small",_w=345) { | |
global wpFolder, imgW, imgH, guimode, ddlJunkie, file, saveto, brwsLst, oldFile, txtSearch,bh,sh, picken | |
global btnCopy, btnChoose, btnDelb, btnRandom, btnThumbsb, btnPrev, btnThumbss, btnDels, btnSort, btnNext | |
global lbH, bbtny, sbtny, lstDdl, btnSortt, btnRandomt, btnCopyt, btnDelt, btnChooset | |
guimode:=_mode | |
mrgn:=5 | |
ttl:="wpJunkie" | |
(_mode="small"?(bgh:="+")(sgh:="-")(tgh:="+")(_h:=sh):(bgh:="-")(sgh:="+")(tgh:="+")(_h:=bh)) | |
SM_CYCAPTION := 4 | |
SysGet, ch, %SM_CYCAPTION% | |
WinGetPos, tbX, tbY, tbw, tbh, ahk_class Shell_TrayWnd | |
ch -= 4 | |
ratio:=A_ScreenHeight/A_ScreenWidth | |
_x := iniX | |
_y := iniY-_h | |
btnH:=35, btnw:=63, ddlH:=50, imgW:=_w-((2*mrgn)+5) | |
, imgH:=imgW*ratio, lbH:=bh-(imgH+btnH+ddlH+20+ch), clsX:=_w-20, ttlW:=imgW-20 | |
sbtny:=sh-(btnH+ch) | |
bbtny:=bh-(btnH+ch) | |
Gui, Junkie:Default | |
Gui, Destroy | |
Gui, +Caption +ToolWindow +Border -AlwaysOnTop | |
Gui, margin, %mrgn% | |
Gui, Add, Text, %bgh%Hidden xm w%imgW% h%imgH% 0x20E vpicken hwndpic1 | |
Gui, Add, DropDownList, %bgh%Hidden wp Choose1 vddlJunkie gJunkieDdl, %lstDdl% | |
Gui, Add, Edit, %bgh%Hidden h20 wp vtxtSearch hwndhtxtsearch gtxtSearch_Event | |
Gui, Add, ListBox, %bgh%Hidden sort wp h%lbH% vlblList gPictureShowDelay hwndhlblList -HScroll +256 | |
Gui, Add, Button, %bgh%Hidden xm y%bbtny% w%btnw% section %sgh%Default gGoldRush vbtnCopy, &Copy | |
Gui, Add, Button, %bgh%Hidden wp ys gWPRandom vbtnRandom, &Random | |
Gui, Add, Button, %bgh%Hidden wp ys gWPDelete vbtnDelb, &Delete | |
Gui, Add, Button, %bgh%Hidden wp ys gWPThumbs vbtnThumbsb, &Thumbs | |
Gui, Add, Button, %bgh%Hidden wp ys gJunkieChoose vbtnChoose, Choose | |
;Random mode gui | |
Gui, Add, Button, %sgh%Hidden xm y%sbtny% w%btnw% section gWPPrev vbtnPrev, &Previous | |
Gui, Add, Button, %sgh%Hidden wp ys gWPThumbs vbtnThumbss, &Thumbs | |
Gui, Add, Button, %sgh%Hidden wp ys gWPDelete vbtnDels, &Delete | |
Gui, Add, Button, %sgh%Hidden wp ys gWPSort vbtnSort, &Sort | |
Gui, Add, Button, %sgh%Hidden wp ys %bgh%Default gWPNext vbtnNext, &Next | |
;Thumbs mode gui | |
Gui, Add, Button, %tgh%Hidden xm y%sbtny% w%btnw% section gGoldRush vbtnCopyt, &Copy | |
Gui, Add, Button, %tgh%Hidden wp ys gWPRandom vbtnRandomt, &Random | |
Gui, Add, Button, %tgh%Hidden wp ys gWPDelete vbtnDelt, &Delete | |
Gui, Add, Button, %tgh%Hidden wp ys gWPSort vbtnSortt, &Sort | |
Gui, Add, Button, %tgh%Hidden wp ys section -Default gEnter vbtnChooset, Choose | |
GuiControlGet, wpFolder,Junkie:, ddlJunkie | |
FreshList(wpFolder) | |
oldFile:="" | |
Gui, Show,w0 h0, wpJunkie | |
if(_mode!="small") { | |
DllCall( "LoadLibrary", Str,"gdiplus" ), VarSetCapacity( si,16,0 ), si:=Chr(1) | |
DllCall( "gdiplus\GdiplusStartup", UIntP,pToken, UInt,&si, UInt,0 ) | |
Gosub, ChangePic | |
ControlFocus,, ahk_id %htxtSearch% | |
} | |
} | |
JunkieGuiDropFiles: | |
if guimode="thumbs" | |
return | |
Loop, %A_GuiEvent% | |
if (A_LoopFileExt) | |
return | |
lstNew := "" | |
if(lstDdl = "Browse...") | |
lstNew := A_GuiEvent "||" | |
else | |
lstNew := DdlAdd(A_GuiEvent,lstDdl) | |
lstNew .= "Browse..." | |
lstDdl := lstNew | |
GuiControl,Junkie:, ddlJunkie,| | |
GuiControl,Junkie:, ddlJunkie,% lstDdl | |
GuiControlGet, ret,Junkie:, ddlJunkie | |
FreshList(ret) | |
if (guimoe!="small") { | |
Gosub, ChangePic | |
ControlFocus,Edit1, wpJunkie ahk_class AutoHotkeyGUI | |
} | |
return | |
OptionsGuiDropFiles: | |
Loop, %A_GuiEvent% | |
if (A_LoopFileExt) | |
return | |
lstNew := "" | |
;if(lstDdl = "Browse...") | |
; lstNew := A_GuiEvent "||" | |
;else | |
lstNew := DdlAdd(A_GuiEvent,lstDdl) | |
lstNew .= "Browse..." | |
lstDdl := lstNew | |
GuiControl,Options:, ddlOptions,| | |
GuiControl,Options:, ddlOptions,% lstDdl | |
;GuiControlGet, ret,Options:, ddlOptions | |
;IniWrite, %ret%, settings.ini, General, wpFolder | |
IniWrite, %lstDdl%, settings.ini, General, lstDdl | |
;wpFolder := ret | |
WinActivate, wpOptions | |
return | |
FreshList(folder){ | |
global aLst,lblList,wpFolder,aFow | |
aLst := Object() | |
aFow := Object() | |
lblList := "" | |
GuiControl,Junkie:, lblList,| | |
str := SubStr(folder, -1, 2) | |
if (str="\*") | |
StringReplace, folder, folder, %str% | |
chk := 0 | |
Loop, %folder%\*.*,,% ((str="\*")?1:0) | |
{ | |
;If A_LoopFileExt not in jpg,bmp,tif,png,wmf,emf,gif | |
If A_LoopFileExt not in jpg | |
Continue | |
fow := ObjectName(A_LoopFileName) | |
oWp%fow% := Object() | |
oWp%fow%.pth := A_LoopFileDir | |
oWp%fow%.name := A_LoopFileName | |
lblList .= "|" A_LoopFileName | |
aLst.Insert(A_LoopFileName) | |
aFow.Insert(fow,oWp%fow%) | |
} | |
GuiControl, Junkie:-Redraw, lblList | |
Guicontrol, Junkie:,lblList,% !lblList ? "|" : lblList | |
GuiControl, Junkie:+Redraw, lblList | |
;wpFolder := folder | |
} | |
GetListBoxItem(hLB, i) { | |
SendMessage (LB_GETTEXTLEN := 394), %i%, 0,, ahk_id %hLB% | |
If (ErrorLevel = 0xFFFFFFFF) | |
Return "" | |
VarSetCapacity(sText, ErrorLevel * (1 + !!A_IsUnicode), 0) | |
SendMessage (LB_GETTEXT := 393), %i%, &sText,, ahk_id %hLB% | |
If (ErrorLevel = 0xFFFFFFFF) | |
Return "" | |
Return sText | |
} | |
txtSearch_Event: | |
GuiControlGet, s,Junkie:, txtSearch | |
CreateList(s) | |
Return | |
CreateList(filter = "") { | |
Global hlblList, bShowing, aLst, activefileindex, lblList, wpFolder | |
Static sLastfilter := "`n" ;Initialize on an impossible filter | |
;Trim the right side | |
While (SubStr(filter, 0) = A_Space) | |
StringTrimRight, filter, filter, 1 | |
;Trim right side if it ends in " !" since it changes nothing | |
If (StrLen(filter) > 2) And (SubStr(filter, -1) = " !") And (SubStr(filter, -2, 1) <> A_Space) | |
StringTrimRight, filter, filter, 2 | |
;Check if the filter is different | |
If (filter = sLastfilter) ;And bShowing | |
Return | |
sLastfilter := filter | |
GuiControl, Junkie:-Redraw, lblList | |
GuiControl,Junkie:, lblList,| | |
lblList := "" | |
If (filter = "") { | |
FreshList(wpFolder) | |
Gosub, PictureShowDelay | |
} | |
Else { | |
bLst := Object() | |
bLst := aLst | |
aLst := Object() | |
For k, v in bLst | |
{ | |
StringTrimRight, s, v, 4 | |
If (InStr(s, filter)) { | |
lblList .= "|" v | |
aLst.Insert(v) | |
} | |
} | |
Guicontrol, Junkie:,lblList,% !lblList ? "|" : lblList | |
Gosub, PictureShowDelay | |
} | |
SendMessage (LB_GETCURSEL := 0x0188), 0, 0,, ahk_id %hlblList% | |
;Redraw | |
GuiControl, Junkie:+Redraw, lblList | |
} | |
WPThumbs: | |
SetTimer, ThumbCheck, 100 | |
ThumbsGui() | |
return | |
ThumbCheck: | |
if (WinExist("wpThumbs")) { | |
WinGetPos, tcX, tcY, tcW, tcH, wpThumbs | |
if ((tcX!=otcX) || (tcY!=otcY)) { | |
;303 795 , 492 | |
ntcY := tcY+492 | |
WinMove, wpJunkie,,%tcX%,%ntcY% | |
} | |
otcX:=tcX,otcY:=tcY | |
} | |
return | |
ThumbsGui() { | |
global | |
WinGetPos, smx,smy,smw,smh,wpJunkie | |
newX := smx | |
(guimode="sort") ? (thmbY:=smy) (junkieY:=smy+(bh-sh)) (junkieH:=sh) : (thmbY:=smy-(bh-sh)) (junkieY:=smy) (junkieH:=sh) | |
oldguimode := guimode | |
guimode := "thumbs" | |
GuiControl, Junkie:hide, btnPrev | |
GuiControl, Junkie:hide, btnThumbss | |
GuiControl, Junkie:hide, btnDels | |
GuiControl, Junkie:hide, btnSort | |
GuiControl, Junkie:hide, btnNext | |
GuiControl, Junkie:-Default, btnNext | |
GuiControl, Junkie:-Default, btnChoose | |
GuiControl, Junkie:hide, btnChoose | |
GuiControl, Junkie:hide, btnCopy | |
GuiControl, Junkie:hide, btnDelb | |
GuiControl, Junkie:hide, btnRandom | |
GuiControl, Junkie:hide, btnThumbsb | |
GuiControl, Junkie:hide, ddlJunkie | |
GuiControl, Junkie:hide, picken | |
GuiControl, Junkie:hide, txtSearch | |
GuiControl, Junkie:hide, lblList | |
GuiControl, Junkie:show, btnRandomt | |
GuiControl, Junkie:show, btnSortt | |
GuiControl, Junkie:show, btnDelt | |
GuiControl, Junkie:show, btnChooset | |
GuiControl, Junkie:show, btnCopyt | |
WinMove, wpJunkie,,%junkieX%,%junkieY%,,%junkieH% | |
DllCall( "LoadLibrary", Str,"gdiplus" ), VarSetCapacity( si,16,0 ), si:=Chr(1) | |
DllCall( "gdiplus\GdiplusStartup", UIntP,pToken, UInt,&si, UInt,0 ) | |
thmbGuiW := smw | |
thmbGuiH := 485 | |
thmbH := 100, thmbW:= 145 | |
thmbbH := thmbH+4, thmbbW:= thmbW+4 | |
cProg := "F30342" | |
Gui, Thumbs:Default | |
Gui, Destroy | |
Gui, +ToolWindow +0x200000 ; +resize ; WS_VSCROLL | |
Gui, +LastFound | |
aThmbs := Object() | |
cols:=2 | |
colcnt=0 | |
ncnt=0 | |
;GuiControlGet, fldThumbs,Junkie:, ddlJunkie | |
;Loop, %wpFolder%\*.* | |
For k, v in aLst | |
{ | |
colcnt++ | |
ncnt++ | |
vPic := ObjectName(v) | |
picpos := ( (colcnt=1) ? (" xm y+10") : (" x+10 yp") ) | |
colcnt := ( (colcnt=cols) ? (0) : (colcnt) ) | |
Gui, Add, Progress,% picpos " +Disabled " ((ncnt=1)?("-"):("+")) "hidden w" thmbbW " h" thmbbH " c" cProg " v" ncnt "prog", 100 | |
Gui, Add, Text,% "w" thmbW " h" thmbH " xp+2 yp+2" " 0x20E" " v" ncnt " hwndPic" vPic " gPicClick" | |
%ncnt% := Object() | |
%ncnt%.selected := 0 | |
%ncnt%.name := vPic | |
%ncnt%.filename := aFow[vPic].name | |
%ncnt%.path := aFow[vPic].pth "\" aFow[vPic].name | |
aThmbs.Insert(%ncnt%) | |
;MsgBox, % aFow[vPic].pth "`n" vPic | |
} | |
oldsel := 1 | |
1.selected:=1 | |
Gui, Show, w%thmbGuiW% h%thmbGuiH% x%smx% y%thmbY%, wpThumbs | |
WinMove, wpThumbs,,%smx%,%thmbY%,%thmbGuiW%,%thmbGuiH% | |
For key, value in aThmbs | |
{ | |
NewThumb(value.path, value.name) | |
UpdateScrollBars("Thumbs", guiW, guiH) | |
} | |
} | |
PicClick: | |
if (%A_GuiControl%.selected=1) { | |
WPUpdate(%A_GuiControl%.path) | |
return | |
} | |
if !(A_GuiControl=oldsel) { | |
%oldsel%.selected := 0 | |
GuiControl, Thumbs:+hidden, %oldsel%prog | |
%A_GuiControl%.selected := 1 | |
GuiControl, Thumbs:-hidden, %A_GuiControl%prog | |
oldsel := A_GuiControl | |
totxt := %A_GuiControl%.filename | |
SendMessage (LB_SELECTSTRING := 0x018C),0,&totxt,, ahk_id %hlblList% | |
} | |
return | |
NewThumb(file,n) { | |
global thmbW, thmbH | |
DllCall( "DeleteObject", UInt,hBitmapResized ), SetProcessWorkingSetSize( PID ) | |
hBitmap := GdiBitmap( file, WxH ) | |
tSize := thmbW "x" thmbH | |
;tSize := BestFitRect( WxH,tshlp ) | |
StringSplit, Sz, tSize, x | |
hBitmapResized := DllCall( "CopyImage", UInt,hBitmap, UInt,0, UInt,Sz1, UInt,Sz2, UInt,0) | |
DllCall( "DeleteObject", UInt,hBitmap ) | |
SendMessage, (STM_SETIMAGE:=0x172), (IMAGE_BITMAP:=0x0), hBitmapResized,,% "ahk_id " Pic%n% | |
} | |
ThumbsGuiEscape: | |
ThumbsGuiClose: | |
SetTimer, ThumbCheck, Off | |
DllCall( "gdiplus\GdiplusShutdown", UInt,pToken ) | |
DllCall( NumGet(NumGet(1*pStream)+8 ), UInt,pStream ) | |
Gui, Thumbs:Destroy | |
Gui, Junkie:Destroy | |
guimode := "" | |
return | |
OptionsGui() { | |
global rndCb, startCb, randomize, autostart, GuiHK, hottis, ddlOptions, minuter,lstDdl, interval | |
if(!hottis) | |
hottis:="^!W" | |
if(!lstDdl) | |
lstDdl:="Browse..." | |
_w:=260, mrgn:=5 | |
min:=( (randomize=1) ? ("+") : ("-") ) | |
miu:=( (randomize!=1) ? ("+") : ("-") ) | |
aut:=( (autostart=1) ? ("+") : ("-") ) | |
Gui, Options:Default | |
Gui, Destroy | |
Gui, +Caption +ToolWindow +Border | |
Gui, margin, %mrgn% | |
Gui, Font, s10, Segoe UI | |
Gui, Add, Text, , Wallpaper folder: | |
Gui, Add, DropDownList,w%_w% Choose1 vddlOptions gOptionsDdl,%lstDdl% | |
Gui, Add, Text,y+8, Hotkey: | |
Gui, Add, Hotkey, vGuiHK yp-3 x+%mrgn% w210, %hottis% | |
Gui, Add, Checkbox, vrndCb gCBrnd xm %min%Checked, Random wallpaper every | |
Gui, Add, Edit, yp-3 x+0 w30 Number vminuter %miu%Disabled, %interval% | |
Gui, Add, Text, yp+3 x+%mrgn%, minutes. | |
Gui, Add, Checkbox, y+3 vstartCb xm %aut%Checked, Start with windows. | |
Gui, Show,,wpOptions | |
Gui, Junkie:Default | |
} | |
OptionsGuiEscape: | |
OptionsGuiClose: | |
Gui, Options:Submit | |
Gui, Options:Destroy | |
IniWrite, %ddlOptions%, settings.ini, General, wpFolder | |
IniWrite, %GuiHK%, settings.ini, General, hottis | |
IniWrite, %rndCb%, settings.ini, General, randomize | |
IniWrite, %minuter%, settings.ini, General, interval | |
IniWrite, %startCb%, settings.ini, General, autostart | |
Reload | |
return | |
OptionsDdl: | |
lstNew := "" | |
GuiControlGet, ddlVar,Options:, ddlOptions | |
if(ddlVar="Browse...") { | |
FileSelectFolder, brws,%A_ComputerName%,% ( (gui="copy") ? (1) : (0) ) ,Choose folder | |
If(ErrorLevel=1) | |
return | |
if(lstDdl = "Browse...") | |
lstNew := lstDdl := brws "||" | |
else { | |
StringReplace, lstDdl, lstDdl, ||, | | |
Loop, Parse, lstDdl, | | |
{ | |
if (A_Index=1) { | |
lstNew .= brws "||" | |
if !(A_LoopField=brws || A_LoopField="Browse...") | |
lstNew .= A_LoopField "|" | |
continue | |
} else if !(A_LoopField=brws || A_LoopField="Browse...") | |
lstNew .= A_LoopField "|" | |
} | |
} | |
} else { | |
StringReplace, lstDdl, lstDdl, ||, | | |
Loop, Parse, lstDdl, | | |
{ | |
if (A_Index=1) { | |
lstNew .= ddlVar "||" | |
if !(A_LoopField=ddlVar || A_LoopField="Browse...") | |
lstNew .= A_LoopField "|" | |
continue | |
} else if !(A_LoopField=ddlVar || A_LoopField="Browse...") | |
lstNew .= A_LoopField "|" | |
} | |
} | |
lstNew .= "Browse..." | |
lstDdl := lstNew | |
GuiControl,Options:, ddlOptions,| | |
GuiControl,Options:, ddlOptions,% lstDdl | |
GuiControlGet, ret,Options:, ddlOptions | |
IniWrite, %ret%, settings.ini, General, wpFolder | |
IniWrite, %lstDdl%, settings.ini, General, lstDdl | |
wpFolder := ret | |
return | |
CBrnd: | |
GuiControlGet, rndchkd,Options:,rndCb | |
if(rndchkd=0) | |
GuiControl,Options:Disable, minuter | |
else | |
GuiControl,Options:Enable, minuter | |
return | |
JunkieChoose: | |
fow := ObjectName(file) | |
WPUpdate(aFow[fow].pth "\" file) | |
Return | |
WPUpdate(sFile) { | |
RegWrite, REG_SZ, HKCU, Control Panel\Desktop, WallpaperStyle, 2 | |
RegWrite, REG_SZ, HKCU, Control Panel\Desktop, TileWallpaper, 0 | |
RegWrite, REG_SZ, HKCU, Control Panel\Desktop, Wallpaper, % sFile | |
DllCall("SystemParametersInfo" | |
, "Uint", 0x0014 | |
, "Uint", 0 | |
, "str", sFile | |
, "Uint", 0 ) | |
} | |
WPNext: | |
if (cHist>=lstHistory.MaxIndex()) { | |
Random, Img, 1, aLst.MaxIndex() | |
fow := ObjectName(aLst[Img]) | |
currentWP := aFow[fow].pth "\" aLst[Img] | |
while !(FileExist(currentWP)) { | |
Random, Img, 1, aLst.MaxIndex() | |
fow := ObjectName(aLst[Img]) | |
currentWP := aFow[fow].pth "\" aLst[Img] | |
} | |
WPUpdate(currentWP) | |
lstHistory.Insert(Img) | |
totxt := aLst[Img] | |
cHist++ | |
} else { | |
cHist++ | |
totxt := aLst[lstHistory[cHist]] | |
fow := ObjectName(totxt) | |
WPUpdate(aFow[fow].pth "\" totxt) | |
} | |
SendMessage (LB_SELECTSTRING := 0x018C),0,&totxt,, ahk_id %hlblList% | |
return | |
WPPrev: | |
cHist-- | |
if(cHist<=0) { | |
cHist=1 | |
return | |
} | |
totxt := aLst[lstHistory[cHist]] | |
fow := ObjectName(totxt) | |
WPUpdate(aFow[fow].pth "\" totxt) | |
SendMessage (LB_SELECTSTRING := 0x018C),0,&totxt,, ahk_id %hlblList% ; This doesn't work | |
Gosub, ChangePic | |
return | |
WPRandom: | |
if (guimode="") { | |
IniRead, iniX, settings.ini, General, iniX, 200 | |
IniRead, iniY, settings.ini, General, iniY, 800 | |
swpX:=iniX, swpY:=iniY-sh | |
} | |
else { | |
WinGetPos, bgx,bgy,bgw,bgh,wpJunkie | |
swpX:=bgX | |
swpY:=(guimode="sort")?(bgy+(bh-sh)):(guimode="thumbs")?(bgy):(iniY) | |
} | |
swpW:=guiW, swpH:=sh | |
if (guimode="thumbs") | |
Gosub, ThumbsGuiClose | |
wpJunkieGui("small",guiW) | |
WinMove, wpJunkie,,%swpX%,%swpY%,%swpW%,%swpH% | |
ControlFocus,Button10, wpJunkie ahk_class AutoHotkeyGUI | |
return | |
WPSort: | |
if (guimode="thumbs") { | |
DllCall( "gdiplus\GdiplusShutdown", UInt,pToken ) | |
DllCall( NumGet(NumGet(1*pStream)+8 ), UInt,pStream ) | |
SetTimer, ThumbCheck, Off | |
Gui, Thumbs:Destroy | |
} | |
WinActivate, wpJunkie | |
WinGetActiveTitle, aw | |
if (WinExist("wpJunkie")) { | |
WinGetPos, smx,smy,smw,,wpJunkie | |
newX := smx | |
newY := smy-(bh-sh) | |
guimode := "sort" | |
GuiControl, Junkie:hide, btnPrev | |
GuiControl, Junkie:hide, btnThumbss | |
GuiControl, Junkie:hide, btnDels | |
GuiControl, Junkie:hide, btnSort | |
GuiControl, Junkie:hide, btnNext | |
GuiControl, Junkie:-Default, btnNext | |
GuiControl, Junkie:+Default, btnChoose | |
GuiControl, Junkie:show, btnChoose | |
GuiControl, Junkie:show, btnCopy | |
GuiControl, Junkie:show, btnDelb | |
GuiControl, Junkie:show, btnRandom | |
GuiControl, Junkie:show, btnThumbsb | |
GuiControl, Junkie:show, ddlJunkie | |
GuiControl, Junkie:show, picken | |
GuiControl, Junkie:show, txtSearch | |
GuiControl, Junkie:show, lblList | |
GuiControl, Junkie:hide, btnRandomt | |
GuiControl, Junkie:hide, btnSortt | |
GuiControl, Junkie:hide, btnDelt | |
GuiControl, Junkie:hide, btnChooset | |
GuiControl, Junkie:hide, btnCopyt | |
GuiControl, Junkie:Move, btnChoose, y%bbtny% | |
GuiControl, Junkie:Move, btnCopy, y%bbtny% | |
GuiControl, Junkie:Move, btnDelb, y%bbtny% | |
GuiControl, Junkie:Move, btnRandom, y%bbtny% | |
GuiControl, Junkie:Move, btnThumbsb, y%bbtny% | |
GuiControl, Junkie:+Redraw, lblList | |
WinMove, wpJunkie,,%newX%,%newY%,,%bh% | |
DllCall( "LoadLibrary", Str,"gdiplus" ), VarSetCapacity( si,16,0 ), si:=Chr(1) | |
DllCall( "gdiplus\GdiplusStartup", UIntP,pToken, UInt,&si, UInt,0 ) | |
Gosub, ChangePic | |
ControlFocus,, ahk_id %htxtSearch% | |
} else | |
wpJunkieGui("sort",guiW) | |
;GoSub, JunkieDdl | |
;ControlFocus,Edit1, wpJunkie ahk_class AutoHotkeyGUI | |
return | |
JunkieDdl: | |
lstNew := "" | |
GuiControlGet, ddlVar,Junkie:, ddlJunkie | |
if (ddlVar=wpFolder) | |
return | |
if(ddlVar="Browse...") { | |
FileSelectFolder, brws,%A_ComputerName%,% ( (gui="copy") ? (1) : (0) ) ,Choose folder | |
If(ErrorLevel=1) | |
return | |
if(lstDdl = "Browse...") | |
lstNew := brws "||" | |
else | |
lstNew := DdlAdd(brws,lstDdl) | |
} else { | |
StringReplace, lstDdl, lstDdl, ||, | | |
Loop, Parse, lstDdl, | | |
{ | |
if (A_Index=1) { | |
lstNew .= ddlVar "||" | |
if !(A_LoopField=ddlVar || A_LoopField="Browse...") | |
lstNew .= A_LoopField "|" | |
continue | |
} else if !(A_LoopField=ddlVar || A_LoopField="Browse...") | |
lstNew .= A_LoopField "|" | |
} | |
} | |
lstNew .= "Browse..." | |
lstDdl := lstNew | |
GuiControl,Junkie:, ddlJunkie,| | |
GuiControl,Junkie:, ddlJunkie,% lstDdl | |
GuiControlGet, ret,Junkie:, ddlJunkie | |
wpFolder := ret | |
IniWrite, %lstDdl%, settings.ini, General, lstDdl | |
IniWrite, %ret%, settings.ini, General, wpFolder | |
FreshList(ret) | |
Gosub, ChangePic | |
return | |
Avslut: | |
Gui, Junkie:Destroy | |
DllCall( "gdiplus\GdiplusShutdown", UInt,pToken ) | |
DllCall( NumGet(NumGet(1*pStream)+8 ), UInt,pStream ) | |
ExitApp | |
return | |
JunkieGuiClose: | |
JunkieGuiEscape: | |
WinGetPos, iniX, iniY, iniW, iniH, wpJunkie ahk_class AutoHotkeyGUI | |
iniY := iniY+iniH | |
IniWrite, %iniX%, settings.ini, General, iniX | |
IniWrite, %iniY%, settings.ini, General, iniY | |
Gui, Destroy | |
guimode := "" | |
DllCall( "gdiplus\GdiplusShutdown", UInt,pToken ) | |
DllCall( NumGet(NumGet(1*pStream)+8 ), UInt,pStream ) | |
return | |
GoldRush: | |
CopyTo() | |
return | |
CopyTo() { | |
global ddlCopy, NewFileName, lstDdl, file, cext, wpFolder, hlblList, lstDdlCopy | |
_w:=345, _h:=103, mrgn:=5, ttlH:=18, lblW:=50, imgW:=_w-((3*mrgn)+lblW), btnW:=50 | |
WinGetPos, px, py, pw, ph, wpJunkie | |
_x:=( (px-_w<0) ? (px+pw) : (px-_w) ) | |
_y:=py+(ph-(_h+2)) | |
SendMessage, (LB_GETCURSEL := 0x0188), 0, 0,, ahk_id %hlblList% | |
;Check for error. LB_ERR | |
ErrorLevel := (ErrorLevel = 0xFFFFFFFF) ? 0 : ErrorLevel | |
;Get the associated item data | |
i := GetListBoxItem(hlblList, ErrorLevel) | |
file := i | |
StringSplit, fl, file, . | |
cext:=fl2 | |
if !(lstDdlCopy) | |
lstDdlCopy := lstDdl | |
Gui, Copy:Default | |
Gui, Destroy | |
Gui, +Caption +ToolWindow +Border -AlwaysOnTop | |
Gui, margin, %mrgn% | |
Gui, Font, s10, Segoe UI | |
Gui, Add, Text, y8 w%lblW%, Copy to: | |
Gui, Add, DropDownList, yp-3 x+%mrgn% w%imgW% Choose1 gCopyDdl vddlCopy, %lstDdlCopy% | |
Gui, Add, Text, y+8 xm w%lblW%, Name: | |
Gui, Add, Edit, yp-3 w%imgW% x+%mrgn% vNewFileName -WantReturn, %fl1% | |
Gui, Add, Button, x120 w%btnW% Section gCopyOk Default, Ok | |
Gui, Add, Button, ys w%btnW% gCopyCancel, Cancel | |
Gui, Show, x%_x% y%_y% w%_w% h%_h%,wpCopy | |
ControlFocus,Edit1, wpCopy | |
Send, ^a | |
Gui, Junkie:Default | |
} | |
DdlAdd(fld,lst) { | |
MsgBox, 4,, Do you want to include subfolders? | |
IfMsgBox Yes | |
fld .= "\*" | |
StringReplace, lst, lst, ||, | | |
Loop, Parse, lst, | | |
{ | |
if (A_Index=1) { | |
lstNew .= fld "||" | |
if !(A_LoopField=fld || A_LoopField="Browse...") | |
lstNew .= A_LoopField "|" | |
continue | |
} else if !(A_LoopField=fld || A_LoopField="Browse...") | |
lstNew .= A_LoopField "|" | |
} | |
return, lstNew | |
} | |
CopyDdl: | |
lstNew := "" | |
GuiControlGet, ddlVar,Copy:, ddlCopy | |
if(ddlVar="Browse...") { | |
FileSelectFolder, brws,%A_ComputerName%,1,Choose folder | |
If(ErrorLevel=1) | |
return | |
if(lstDdl = "Browse...") | |
lstNew := lstDdl := brws "||" | |
else | |
lstNew := DdlAdd(brws,lstDdl) | |
fldCopy := brws | |
} else { | |
StringReplace, lstDdl, lstDdl, ||, | | |
Loop, Parse, lstDdl, | | |
{ | |
if (A_Index=1) { | |
lstNew .= ddlVar "||" | |
if !(A_LoopField=ddlVar || A_LoopField="Browse...") | |
lstNew .= A_LoopField "|" | |
continue | |
} else if !(A_LoopField=ddlVar || A_LoopField="Browse...") | |
lstNew .= A_LoopField "|" | |
} | |
fldCopy := ddlVar | |
} | |
StringReplace, lstDdl, lstDdl, ||, | | |
Loop, Parse, lstDdl, | | |
{ | |
if (A_Index=1) { | |
lstDdlJunkie .= wpFolder "||" | |
if !(A_LoopField=wpFolder || A_LoopField="Browse..." || A_LoopField=fldCopy) | |
lstDdlJunkie .= A_LoopField "|" | |
continue | |
} else if (A_Index=2) { | |
lstDdlJunkie .= fldCopy "|" | |
if !(A_LoopField=wpFolder || A_LoopField="Browse..." || A_LoopField=fldCopy) | |
lstDdlJunkie .= A_LoopField "|" | |
continue | |
} else if !(A_LoopField=wpFolder || A_LoopField="Browse..." || A_LoopField=fldCopy) | |
lstDdlJunkie .= A_LoopField "|" | |
} | |
lstDdlJunkie .= "Browse..." | |
GuiControl,Junkie:, ddlJunkie,| | |
GuiControl,Junkie:, ddlJunkie,% lstDdlJunkie | |
IniWrite, %lstDdlJunkie%, settings.ini, General, lstDdl | |
lstNew .= "Browse..." | |
lstDdlCopy := lstNew | |
GuiControl,Copy:, ddlCopy,| | |
GuiControl,Copy:, ddlCopy,% lstDdlCopy | |
GuiControlGet, ret,Copy:, ddlCopy | |
IniWrite, %ret%, settings.ini, General, fldCopy | |
IniWrite, %lstDdlCopy%, settings.ini, General, lstDdlCopy | |
fldCopy := ret | |
return | |
CopyCancel: | |
CopyGuiEscape: | |
CopyGuiClose: | |
Gui, Copy:Destroy | |
WinActivate, wpJunkie | |
ControlFocus,, ahk_id %htxtSearch% | |
return | |
CopyOk: | |
Gui, Copy:Submit | |
Gui, Copy:Destroy | |
wpFolder := ObjectName(file) | |
FileCopy, %wpFolder%\%file%, %fldCopy%\%NewFileName%.%cext% | |
WinActivate, wpJunkie | |
ControlFocus,Edit1, wpJunkie ahk_class AutoHotkeyGUI | |
return | |
ChangePic: | |
ControlFocus,Edit1, wpJunkie ahk_class AutoHotkeyGUI | |
SendMessage, (LB_GETCURSEL := 0x0188), 0, 0,, ahk_id %hlblList% | |
;Check for error. LB_ERR | |
ErrorLevel := (ErrorLevel = 0xFFFFFFFF) ? 0 : ErrorLevel | |
;Get the associated item data | |
i := GetListBoxItem(hlblList, ErrorLevel) | |
file := i | |
;GuiControlGet, dest,Junkie:, ddlJunkie | |
fow := ObjectName(file) | |
dest := aFow[fow].pth | |
if (dc="doubleclick") | |
WPUpdate(dest "\" file) | |
if (!(file) || (file=oldFile)) | |
return | |
DllCall( "DeleteObject", UInt,hBitmapResized ), SetProcessWorkingSetSize( PID ) | |
hBitmap := GdiBitmap( dest "\" file, WxH ) | |
tshlp := imgW "x" imgH | |
tSize := BestFitRect( WxH,tshlp ) | |
StringSplit, Sz, tSize, x | |
hBitmapResized := DllCall( "CopyImage", UInt,hBitmap, UInt,0, UInt,Sz1, UInt,Sz2, UInt,0) | |
DllCall( "DeleteObject", UInt,hBitmap ) | |
SendMessage, (STM_SETIMAGE:=0x172), (IMAGE_BITMAP:=0x0), hBitmapResized,, ahk_id %Pic1% | |
fullPath = %dest%\%file% | |
oldFile := file | |
Return | |
ObjectName(file) { | |
SplitPath, file, , , , fow | |
StringReplace, fow, fow, %A_Space%, _, All | |
StringReplace, fow, fow, -, _, All | |
StringReplace, fow, fow, ', _, All | |
StringReplace, fow, fow, (, _, All | |
StringReplace, fow, fow, ), _, All | |
return, fow | |
} | |
PictureShowDelay: | |
dc := A_GuiEvent | |
SetTimer, ChangePic, -100 | |
Return | |
WPDelete: | |
SendMessage, (LB_GETCURSEL := 0x0188), 0, 0,, ahk_id %hlblList% | |
;Check for error. LB_ERR | |
ndel := (ErrorLevel = 0xFFFFFFFF) ? 0 : ErrorLevel | |
;Get the associated item data | |
delFile := GetListBoxItem(hlblList, ndel) | |
wpFolder := aFow[ObjectName(delFile)].pth | |
MsgBox, 4, , Are you sure you want to delete `n %wpFolder%\%delFile% | |
IfMsgBox No | |
return | |
IfMsgBox Yes | |
FileDelete, %wpFolder%\%delFile% | |
SendMessage (LB_DELETESTRING := 0x0182),%ndel%,0,, ahk_id %hlblList% | |
SendMessage (LB_SETCURSEL := 0x0186),%ndel%,0,, ahk_id %hlblList% | |
if (guimode="small") { | |
Gosub, WPNext | |
ControlFocus,Button10, wpJunkie ahk_class AutoHotkeyGUI | |
} | |
Else if (guimode="junkie"){ | |
Gosub, ChangePic | |
ControlFocus,Edit1, wpJunkie ahk_class AutoHotkeyGUI | |
} | |
else if (guimode="thumbs") { | |
GuiControl, Thumbs:+hidden, %oldsel%prog | |
GuiControl, Thumbs:+hidden, %oldsel% | |
Gosub, Right | |
} | |
return | |
gdiBitmap( img,byref WxH ) { ; Sean www.autohotkey.com/forum/viewtopic.php?p=147029#147029 | |
FileGetSize, nSize, %img% | |
IfEqual,nsize,0, Return,0 | |
if (A_IsUnicode) | |
FileRead, Buffer, *c *p1200 %img% | |
else | |
FileRead, Buffer, %img% | |
hData := DllCall("GlobalAlloc", UInt,2, UInt, nSize ) | |
pData := DllCall("GlobalLock", UInt,hData ) | |
DllCall( "RtlMoveMemory", UInt,pData, UInt,&Buffer, UInt,nSize ) | |
DllCall( "GlobalUnlock", UInt,hData ) | |
DllCall( "ole32\CreateStreamOnHGlobal", UInt,hData, Int,True, UIntP,pStream ) | |
DllCall( "gdiplus\GdipCreateBitmapFromStream", UInt,pStream, UIntP,pBitmap ) | |
DllCall( "gdiplus\GdipCreateHBITMAPFromBitmap", UInt,pBitmap, UIntP,hBitmap, UInt,8 ) | |
DllCall( "gdiplus\GdipGetImageWidth" , "Uint", pBitmap, "UintP", nW) | |
DllCall( "gdiplus\GdipGetImageHeight", "Uint", pBitmap, "UintP", nH), WxH := nW "x" nH | |
DllCall( "gdiplus\GdipDisposeImage", UInt,pBitmap ) | |
Return hBitmap | |
} | |
BestFitRect(d1,d2,s="x") { ; Oberon www.autohotkey.com/forum/viewtopic.php?p=189202#189202 | |
Loop, 2 | |
StringSplit, d%A_Index%x, d%A_Index%, %s% | |
f := d1x1 - d2x1 > d1x2 - d2x2 ? d2x1 / d1x1 : d2x2 / d1x2 | |
Return, Floor(d1x1 * f) . s . Floor(d1x2 * f) | |
} | |
SetProcessWorkingSetSize(PID=0) { ; heresy www.autohotkey.com/forum/viewtopic.php?t=32876 | |
h := DllCall( "OpenProcess", UInt,0x001F0FFF, Int,0, Int,PID ) | |
DllCall( "SetProcessWorkingSetSize", UInt,h, Int,-1, Int,-1 ) | |
DllCall( "CloseHandle", UInt,h ) | |
} | |
UpdateScrollBars(GuiNum, GuiWidth, GuiHeight) ; Lexikos www.autohotkey.com/board/topic/26033-scrollable-gui-proof-of-concept/#entry168174 | |
{ | |
static SIF_RANGE=0x1, SIF_PAGE=0x2, SIF_DISABLENOSCROLL=0x8, SB_HORZ=0, SB_VERT=1 | |
Gui, %GuiNum%:Default | |
Gui, +LastFound | |
; Calculate scrolling area. | |
Left := Top := 9999 | |
Right := Bottom := 0 | |
WinGet, ControlList, ControlList | |
Loop, Parse, ControlList, `n | |
{ | |
GuiControlGet, c, Pos, %A_LoopField% | |
if (cX < Left) | |
Left := cX | |
if (cY < Top) | |
Top := cY | |
if (cX + cW > Right) | |
Right := cX + cW | |
if (cY + cH > Bottom) | |
Bottom := cY + cH | |
} | |
Left -= 8 | |
Top -= 8 | |
Right += 8 | |
Bottom += 8 | |
ScrollWidth := Right-Left | |
ScrollHeight := Bottom-Top | |
; Initialize SCROLLINFO. | |
VarSetCapacity(si, 28, 0) | |
NumPut(28, si) ; cbSize | |
NumPut(SIF_RANGE | SIF_PAGE, si, 4) ; fMask | |
; Update horizontal scroll bar. | |
NumPut(ScrollWidth, si, 12) ; nMax | |
NumPut(GuiWidth, si, 16) ; nPage | |
DllCall("SetScrollInfo", "uint", WinExist(), "uint", SB_HORZ, "uint", &si, "int", 1) | |
; Update vertical scroll bar. | |
; NumPut(SIF_RANGE | SIF_PAGE | SIF_DISABLENOSCROLL, si, 4) ; fMask | |
NumPut(ScrollHeight, si, 12) ; nMax | |
NumPut(GuiHeight, si, 16) ; nPage | |
DllCall("SetScrollInfo", "uint", WinExist(), "uint", SB_VERT, "uint", &si, "int", 1) | |
if (Left < 0 && Right < GuiWidth) | |
x := Abs(Left) > GuiWidth-Right ? GuiWidth-Right : Abs(Left) | |
if (Top < 0 && Bottom < GuiHeight) | |
y := Abs(Top) > GuiHeight-Bottom ? GuiHeight-Bottom : Abs(Top) | |
if (x || y) | |
DllCall("ScrollWindow", "uint", WinExist(), "int", x, "int", y, "uint", 0, "uint", 0) | |
} | |
OnScroll(wParam, lParam, msg, hwnd) | |
{ | |
static SIF_ALL=0x17, SCROLL_STEP=75 | |
bar := msg=0x115 ; SB_HORZ=0, SB_VERT=1 | |
VarSetCapacity(si, 28, 0) | |
NumPut(28, si) ; cbSize | |
NumPut(SIF_ALL, si, 4) ; fMask | |
if !DllCall("GetScrollInfo", "uint", hwnd, "int", bar, "uint", &si) | |
return | |
VarSetCapacity(rect, 16) | |
DllCall("GetClientRect", "uint", hwnd, "uint", &rect) | |
new_pos := NumGet(si, 20, "int") ; nPos | |
action := wParam & 0xFFFF | |
if action = 0 ; SB_LINEUP | |
new_pos -= SCROLL_STEP | |
else if action = 1 ; SB_LINEDOWN | |
new_pos += SCROLL_STEP | |
else if action = 2 ; SB_PAGEUP | |
new_pos -= NumGet(rect, 12, "int") - SCROLL_STEP | |
else if action = 3 ; SB_PAGEDOWN | |
new_pos += NumGet(rect, 12, "int") - SCROLL_STEP | |
else if (action = 5 || action = 4) ; SB_THUMBTRACK || SB_THUMBPOSITION | |
new_pos := wParam>>16 | |
else if action = 6 ; SB_TOP | |
new_pos := NumGet(si, 8, "int") ; nMin | |
else if action = 7 ; SB_BOTTOM | |
new_pos := NumGet(si, 12, "int") ; nMax | |
else | |
return | |
min := NumGet(si, 8, "int") ; nMin | |
max := NumGet(si, 12, "int") - NumGet(si, 16, "int") ; nMax-nPage | |
new_pos := new_pos > max ? max : new_pos | |
new_pos := new_pos < min ? min : new_pos | |
old_pos := NumGet(si, 20, "int") ; nPos | |
x := y := 0 | |
if bar = 0 ; SB_HORZ | |
x := old_pos-new_pos | |
else | |
y := old_pos-new_pos | |
; Scroll contents of window and invalidate uncovered area. | |
DllCall("ScrollWindow", "uint", hwnd, "int", x, "int", y, "uint", 0, "uint", 0) | |
; Update scroll bar. | |
NumPut(new_pos, si, 20, "int") ; nPos | |
DllCall("SetScrollInfo", "uint", hwnd, "int", bar, "uint", &si, "int", 1) | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment