| I schreib here time simply impudent some of my Lieblingshelferfunktionen there. Each this functions is me personally very important and has in the XProfanalltag bewährt. which of it objectively How übernommen becomes (if at all) game for me only a supporting role. Have too a couple Rems angefügt: CompileMarkSeparationdulcoiF{settimer 1;waitinput;killtimer}// hierfür eine andere Lösung wäre angebracht
stri(float f){;return substr$(str$(f),1,.);}//ohne decimals verstellen zu müssen ohne .
valsubstr(string s,long p,string d){;return val(substr$(s,p,d));}
setsubstr(string s,long n,string d,ns){return ins$(ns,del$(s,n,1,d),n,d)}
lastsubstr(string s,d){return (substr$(s,len(s,d),d))}
notlastsubstr(string s,d){return del$(s,len(s,d),1,d)}
getfnamefromcmdstring(string s){return lastsubstr(s,\)}
getfpathfromcmdstring(string s){return notlastsubstr(s,\)+\}
getfileext(string fle){
casenot instr(.,fle):return
return lastsubstr(fle,.)
}
getTextWidth(string text,long xx){
if pcount==1 {
mem mem:=8
GetTextExtentPoint32(hdc,Addr(text),len(text),mem)
long result:=long(mem,0)
dispose mem
return result
} else {
long l:=getTextWidth(text)
case l<=xx : return text
text:=text+...
whilenot l<=xx {
case len(text)==4 : break
text:=del$(text,len(text)-3,1)
l:=getTextWidth(text)
}
return text
}
}
tsnd(long v){//setzt Tausenderpunkte
string s:=stri(v)
long l:=len(s)
long t:=(l-1)3
whileloop t {s:=ins$(.,s,l-loop*3+1)}
return s
}
stringescape(string s){//oft gebraucht wenn man z.B. mehrzeilige Texte in nur einer Zeile abspeichern möchte
s:=translate$(s,\,\\)
s:=translate$(s,chr$(10),\n)
s:=translate$(s,chr$(7),\t)
s:=translate$(s,chr$(9),\t)
s:=translate$(s,chr$(32),\s)
s:=translate$(s,chr$(34),\q)
whileloop 31 {s:=translate$(s,chr$(loop),)}
return s
}
stringunescape(string s){
s:=translate$(s,\\,chr$(1))
s:=translate$(s,\n,
)
s:=translate$(s,\t, )
s:=translate$(s,\s, )
s:=translate$(s,\q,q)
s:=translate$(s,chr$(1),\)
return s
}
__secure_filename_(string fle) {//allowedchars sollte aus einem frei definierbaren String bezogen werden können.
string allowedchars:= abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZÖÄÜöäüß0123456789
string n,nc
long c:=len(fle)
whileloop c {
nc:=mid$(fle,loop,1)
if instr(nc,allowedchars) {n:=n+nc}else{n:=n+ }
;}
;return trim$(while_replace(n, , ))
}
while_replace(s$,from$,to$) {//wichtig! könnte ein weiterer bool param sein für translate!
while instr(from$,s$) {s$:=translate$(s$,from$,to$)}
return s$
}
gettext2g(long h){//sollte XProfan eh können!
long l:=sendmessage(h,wm_gettextlength,0,0)
casenot l:return
inc l
mem mem=l
sendmessage(h,wm_gettext,l,mem)
string s:=string$(mem,0)
dispose mem
return s
}
settext2g(long h,string txt){sendmessage(h,wm_settext,0,addr(txt))}
hexlisttostring(string s){
long l:=len(s)
string h,ns
whileloop 1,l,2{
h:=mid$(s,loop,2)
case h==00 : break
ns:=ns+chr$(val($+h))
}
return ns
}
stringtohexlist(string s){
long l:=len(s)
string ns,ts
whileloop l{
ts:=hex$(ord(mid$(s,loop,1)))
case len(ts)==1 : ts:=0+ts
ns:=ns+ts
}
return ns
}
lb.create(bool mode) {;return Control(LISTBOX,, $100+if(mode,2,),,,,,hwnd,,);}
lb.sortinternallist{//interne Liste sortieren! Wichtig!
long h:=lb.create(true)//create sorted list
movelisttohandle(h)
clearlist
movehandletolist(h)
destroywindow(h)
}
what unfortunately really missing:
+ The Possibility a single User Message Remove to, what yet only with my usermessages-Unit possible is - what incidentally The only right to exist the Unit darstellt, + The Possibility without API mousex,mousey and Mouse buttons ausserhalb hwnd To detect, by which one forced is a manner MausInclude To use: z.B.: CompileMarkSeparation//Version:0.0.1
#include inc/helpers.inc
long mouse.x,mouse.y
mem mouse.mem=point
mouse.doLeftKlick {
mouse_event(2, 0,0 ,0,0)
mouse_event(4, 0,0 ,0,0)
dulcoiF
}
lm_{;return if(getasynckeystate(1)==0,false,true);}
rm_{;return if(getasynckeystate(2)==0,false,true);}
whilem_{while (lm_() | rm_()){sleep 1}}
getmousepos{
GetCursorPos(mouse.mem)
mouse.x:=mouse.mem::x&
mouse.y:=mouse.mem::y&
}
setmousepos(long x,y){;setcursorpos(x,y);}
clipmouse(long x,y,xx,yy){
mem mem=rect
mem::left&:=x
mem::top&:=y
mem::right&:=xx
mem::bottom&:=yy
clipcursor(mem)
dispose mem
}
mouse.close{
dispose mouse.mem
}
an native Implementierung of filegetcontents and fileputcontents could so umgesetzt his: CompileMarkSeparation
ffgc(string fle){
long b:=filesize(fle)
case b<1 : return
mem mem=b
long r:=blockread(fle,mem,0,b)
string s:=char$(mem,0,r)
dispose mem
return s
}
ffpc(string fle,s){
long l:=len(s)
if l=0 {
long fh:=assign(fle)
rewrite fh
close fh
assign #fh,
return
}
mem mem=l+1
string mem#,0=s
blockwrite fle,mem,0,l
dispose mem
}
And then falls me over ands over again the print not really the complete hwnd uses - particularly then if the hwnd as an afterthought maximiert watts.
Nachtrag: with the Programming of play place I often solid the not really simply is whom wm_close of hwnd abzufragen if one no WaitInput and GetMessage uses. |
|