Created
September 23, 2012 20:57
-
-
Save maestrith/3773023 to your computer and use it in GitHub Desktop.
My Wrapper.
This file contains 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
#SingleInstance, Force | |
class sci{ | |
__New(hwnd,x=0,y=0,w=500,h=500){ | |
Static ScintillaIndex:=0 | |
if !DllCall("GetModuleHandle","str","SciLexer.dll") | |
this.hwnd:=DllCall("LoadLibrary","str","SciLexer.dll") | |
this.hwnd:=DllCall("CreateWindowEx" ,"int",0x200 ,"str","Scintilla" | |
,"str","Scintilla" . ++ScintillaIndex ,"int", 0x52310000 | |
,"int",X ,"int",Y ,"int",W ,"int",H ,"uint",hwnd | |
,"uint",0 ,"uint",0 ,"uint",0) | |
sci.hk({this:this,hwnd:this.hwnd}) | |
this.fn:=DllCall("SendMessageA","UInt",this.hwnd,"int",2184,int,0,int,0) | |
this.ptr:=DllCall("SendMessageA","UInt",this.hwnd,"int",2185,int,0,int,0) | |
} | |
hk(hwnd=""){ | |
static keep:=[] | |
if IsObject(hwnd) | |
return keep[hwnd.hwnd]:=hwnd.this | |
if hwnd | |
return keep[hwnd] | |
return keep | |
} | |
gettext(a*){ | |
f:=sci.hk(a.1) | |
VarSetCapacity(text,f.2182),f.2182(f.2182,&text) | |
return strget(&text,length,utf-16) | |
} | |
__Call(a="",b="",c="",d=""){ | |
f:=sci.hk(this.hwnd) | |
if (a="textrange"){ | |
VarSetCapacity(text,abs(b-c)),VarSetCapacity(textrange,12,0),NumPut(b,textrange,0,"UInt"),NumPut(c,textrange,4,"UInt"),NumPut(&text,textrange,8,"UInt"),f.2162(0,&textrange) | |
return strget(&text,abs(min-max),"cp0") | |
} | |
if (a="gettext"){ | |
VarSetCapacity(text,f.2182),f.2182(f.2182,&text) | |
return strget(&text,length,utf-16) | |
} | |
if (a="loop"){ | |
lp:=(c+1)!=""?"Int":"AStr",wp:=(d+1)!=""?"Int":"AStr" | |
return DllCall(this.fn,"Ptr",this.ptr,"UInt",b,lp,c,wp,d,"Cdecl") | |
} | |
lp:=(b+1)!=""?"Int":"AStr",wp:=(c+1)!=""?"Int":"AStr" | |
return DllCall(this.fn,"Ptr",this.ptr,"UInt",a,lp,b,wp,c,"Cdecl") | |
} | |
__Get(a*){ | |
return DllCall(this.fn,"Ptr",this.ptr,"UInt",a.1,"Int",0,"Int",0,"Cdecl") | |
} | |
} | |
Gui,+hwndhwnd +Resize | |
Gui,Show,w800 h1000,GUI Creator 2.0 | |
Gui,Add,Text,x510 w300 h300,text | |
sc:=new sci(hwnd,0,0,500,500) | |
sc1:=new sci(hwnd,0,500,500,500) | |
sc.2181(0,"Press F1 and then type some information in each control and watch the text update.`nF2 displays what is in each window") | |
OnMessage(0x4E, "notify") | |
f1:: | |
for a,b in sci.hk(){ | |
f:=sci.hk(a) | |
for a,b in {1:[2242,0,40],2:[2181,0,"Hello and testing :)"],3:[2242,0,20],4:[2160,5,3]} | |
f.loop(b.1,b.2,b.3) | |
} | |
return | |
f2:: | |
m(sc.gettext(),sc1.gettext()) | |
return | |
notify(wparam,lparam,msg,hwnd){ | |
Critical | |
control:=numget(lparam+0) | |
sc:=sci.hk(control) | |
if !sc | |
return | |
range:=sc.textrange(sc.2266(sc.2008,1),sc.2267(sc.2008,1)) | |
text:=sc.gettext() | |
ControlSetText,Static1,Range=%range%`nText=%text% | |
} | |
m(x*){ | |
for a,b in x | |
list.=b "`n" | |
MsgBox,% list | |
} | |
t(f*){ | |
for a,b in f | |
list.=b "`n" | |
tooltip,% list | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment