Search found 647 matches
- 15 Feb 2020, 06:53
- Forum: AutoHotkey_H
- Topic: function return Multiple values
- Replies: 4
- Views: 2340
function return Multiple values
If you need the function to return multiple values. There are several ways: ByRef - t(ByRef a, ByRef b) Its disadvantage is that it cannot be nested t(ByRef a, ByRef b){ ;... if test t(i,n) } obj - t()=>[1,2] Its disadvantage is that it is too tedious, and value needs to be written multiple times. m...
- 14 Feb 2020, 04:26
- Forum: AutoHotkey_H
- Topic: Memory leak
- Replies: 6
- Views: 2655
Re: Memory leak
Thank you. It seems that I mistakenly and stubbornly think that it is a local variable.
- 13 Feb 2020, 02:06
- Forum: AutoHotkey_H
- Topic: Memory leak
- Replies: 6
- Views: 2655
Re: Memory leak
RegExMatch(fileread(A_LineFile),"s);\!(.*)",r) t:=ahkload() t.new("#Persistent`n#NoTrayIcon`nr:=object(" (&t) "),r.hwnd:=A_ScriptHwnd`ntt:=[1,2,3,4]`n`nreturn`n" r.1) t.DefineMethod('__Call', func("pin_call")) sleep 1000 loop 100000 { t2:=t.ahkgetvar("tt") } MsgBox type(t2) ahkload(){ UnZipRawMemor...
- 11 Feb 2020, 18:23
- Forum: Ask For Help
- Topic: func err
- Replies: 2
- Views: 313
Re: func err
Thank you. It seems that good naming conventions are very important.
- 11 Feb 2020, 18:06
- Forum: AutoHotkey_H
- Topic: Memory leak
- Replies: 6
- Views: 2655
Re: Memory leak
The only possibility is that the dll thread did not load, or it did not load within 100 milliseconds. You can try changing it to "sleep 1000" ahkdll({code:"#Persistent`ntt:=[1,2,3,4]`nreturn`nMsgBox a_type ahktime(" ahktime() ")`nToolTip 1,1,1`nreturn"}) ------>sleep 100 th:=a_pin.1 or: ahkdll({code...
- 11 Feb 2020, 17:43
- Forum: AutoHotkey_H
- Topic: macro issues
- Replies: 0
- Views: 1732
macro issues
In this example, scrolling the wheel multiple times in the GUI will cause an error. Removing "macro" will become normal. Exception was caused in thread id: 13616 Line: 20 Specifically: MouseGetPos(,,,hwnd,2) new_class("test") hwnd:=CreateWindowEx(,"test",,0X80000000|0X10000000,222,222,222,222) sleep...
- 11 Feb 2020, 12:58
- Forum: Ask For Help
- Topic: func err
- Replies: 2
- Views: 313
func err
Code: Select all
MsgBox % a()
f:=flux()
Code: Select all
Error: Call to nonexistent function.
Specifically: a())
Line#
---> 001: MsgBox(a())
003: f := flux()
Code: Select all
flux(){ ;to lib file
}
a(){
}
- 11 Feb 2020, 09:51
- Forum: AutoHotkey v2 Help
- Topic: How to copy Method in v2?
- Replies: 2
- Views: 1352
Re: How to copy Method in v2?
thank you. 

- 11 Feb 2020, 07:51
- Forum: AutoHotkey v2 Help
- Topic: How to copy Method in v2?
- Replies: 2
- Views: 1352
How to copy Method in v2?
v1 Very simple:
v2 How implemented?
Code: Select all
t:={a:func(x)}
t.b:=t.a
Code: Select all
class t {
__new(opt){
;...
if type='pic'
this.DefineMethod("init",this.pic) ;???????
}
pic(){
}
str(){
}
}
- 11 Feb 2020, 07:09
- Forum: AutoHotkey_H
- Topic: Struct not InitObject
- Replies: 1
- Views: 1733
Struct not InitObject
Code: Select all
pt:=Struct("x,y",{x:100,y:200})
MsgBox pt.x
- 11 Feb 2020, 01:09
- Forum: AutoHotkey_H
- Topic: Memory leak
- Replies: 6
- Views: 2655
Memory leak
This example has two issues. 1. WM_COPYDATA memory leak. loop 100000, uses 37M of memory 2. '=>' function memory leak. In the example, using pin_call() => () uses 37M of memory, which is modified to pin_call() {} , which will use 23M of memory. I cannot understand the reason for this difference. It ...
- 10 Feb 2020, 10:24
- Forum: AutoHotkey_H
- Topic: macro Object conflict
- Replies: 1
- Views: 1743
macro Object conflict
Code: Select all
a()
a(){
t:={a:1,b:2,c:[1,2,3]}
b(t)
}
macro b(t){
for i,n in t.OwnProps()
MsgBox i "=" n
}
- 09 Feb 2020, 09:12
- Forum: AutoHotkey_H
- Topic: ObjRawGet/ObjRawSet abnormal
- Replies: 5
- Views: 2369
Re: ObjRawGet/ObjRawSet abnormal
Most of the time, I care more about its simplicity and performance. For example
if t:=ObjRawGet(o,"t") is much better than if t:=o.has("t")?o["t"]:"" ,simpler and more efficient, although it is not standardized.
if t:=ObjRawGet(o,"t") is much better than if t:=o.has("t")?o["t"]:"" ,simpler and more efficient, although it is not standardized.
- 09 Feb 2020, 09:05
- Forum: AutoHotkey_H
- Topic: Ahkdll load time
- Replies: 27
- Views: 5384
Re: Ahkdll load time
I retract the negation of this example. It is at least three times faster than WM_COPYDATA. ;) The only advantage of WM_COPYDATA is that it can transfer data across processes. fun(ahk,name,param*) => (sz:=ObjDump(param,v),ObjLoad(HexToBin(bin,ahk.ahkFunction("fun",name,BinToHex(&v,sz))))[1]) ahk:=Ah...
- 09 Feb 2020, 08:56
- Forum: Ask For Help
- Topic: How to execute a new thread immediately after ending the current thread?
- Replies: 9
- Views: 585
- 09 Feb 2020, 08:52
- Forum: Ask For Help
- Topic: How to execute a new thread immediately after ending the current thread?
- Replies: 9
- Views: 585
Re: How to execute a new thread immediately after ending the current thread?
I am more accustomed to using the H2 WINAPI function PostMessage_, which can ignore whether the window is hidden.
- 09 Feb 2020, 08:50
- Forum: Ask For Help
- Topic: How to execute a new thread immediately after ending the current thread?
- Replies: 9
- Views: 585
Re: How to execute a new thread immediately after ending the current thread?
I think the original process should be completed first, "critical" will interfere with the original process.
Code: Select all
go(t,p*){
static _:=onmessage(0x12340,A_ScriptHwnd,(w,l,m,h) => (%object(w)%(), objrelease(w)),250)
critical
ObjAddRef(t:=&func(t).bind(p*)),PostMessage_(A_ScriptHwnd,0x12340,t)
}
- 09 Feb 2020, 08:40
- Forum: Ask For Help
- Topic: How to execute a new thread immediately after ending the current thread?
- Replies: 9
- Views: 585
Re: How to execute a new thread immediately after ending the current thread?
Thank you very much, this is exactly what I need.
I almost forgot that the "=>" function can still be used like this
It seems that this can be modified as follows:
I almost forgot that the "=>" function can still be used like this

It seems that this can be modified as follows:
Code: Select all
objrelease(wParam)
- 09 Feb 2020, 06:54
- Forum: Ask For Help
- Topic: How to execute a new thread immediately after ending the current thread?
- Replies: 9
- Views: 585
How to execute a new thread immediately after ending the current thread?
I call a function between processes through a window message. In the following example, I need to immediately return the "receive" function and then immediately execute the specified function. SetTimer seems to be the only option, but it always has a 15-30MS delay. In fact, the current thread has en...
- 08 Feb 2020, 22:22
- Forum: AutoHotkey_H
- Topic: ObjDump does not release memory
- Replies: 4
- Views: 2109
Re: ObjDump does not release memory
A very strange bug

Code: Select all
UnZipRawMemory(LockResource(hr:=LoadResource(0,s:=FindResource(0,"F903E44B8A904483A1732BA84EA6191F",10))),SizeofResource(0,s),a_dllRes),FreeResource(hr)
MsgBox ov([])
ov(f){
arr()
arr(){
MsgBox type(f) ;str
}
}