AutoHotkey Community

It is currently May 27th, 2012, 10:36 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 173 posts ]  Go to page Previous  1 ... 8, 9, 10, 11, 12
Author Message
 Post subject:
PostPosted: March 19th, 2011, 12:30 am 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
Like this :?: (requires AHK_H)
Code:
#Persistent
Script:=AhkExported()
somefunction(param){
   MsgBox % param
}

Address := Object(1,1,2,2)
labelname := &Address . "_Timer"
script_to_add .= labelname . ":`n"
               . "x=" . 1+1+1+1 . "`n"
               . "somefunction(x)`n"
               . "return`n"
Script.addScript(script_to_add)
SetTimer, % labelname, -1
Return

Escape::ExitApp

_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun :wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 19th, 2011, 12:58 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7503
Location: Australia
Code:
myfunc(otherfunc, params*) {
    return %otherfunc%(params*)
}

However, ByRef is not supported.
Quote:
;some code here to turn params into p1 etc
It's already an array. There's no need to turn it into a pseudo-array. Just use params[1], params[2], etc.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 19th, 2011, 3:27 pm 
Offline

Joined: June 26th, 2006, 6:14 pm
Posts: 1379
Location: USA
Lexikos wrote:
Code:
myfunc(otherfunc, params*) {
    return %otherfunc%(params*)
}

However, ByRef is not supported.
Quote:
;some code here to turn params into p1 etc
It's already an array. There's no need to turn it into a pseudo-array. Just use params[1], params[2], etc.


That....well...is exactly what im looking for,for function calls. Thanks!!
I guess Guest was pointing me in right direction, but im too dense
Code:
Gui(params*){
   Gui,  % params[1] , % params[2] , % params[3]
}

Gui("Show","h300 w300","Blah")
Sleep, 1000
Gui("Show","x50 y50")

works for the commands....i thought i had an issue before where if third parameter was not passed, it would make title blank...maybe that has been fixed, or it was in my code (or it wasnt this command i had issue with before i dont remember)...

Either way this is some great stuffs

_________________
Image
ʞɔпɟ əɥʇ ʇɐɥʍ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 14th, 2011, 1:35 pm 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
LowLevel does not work in v 1.1.00.00 anymore :cry:

Seems like in v.1.1 it is also not possible to override user functions anymore.
Is there any other way to do that?
Code:
__mcode("__getVar","8B4C24088B0933C08379080375028B018B4C2404998901895104C3")
v:=1
MsgBox % __getvar(v)

__mcode(FuncName, Hex)
{
    if !(pFunc := NumGet((pcb:=RegisterCallback(FuncName))+28)) or !(pbin := DllCall("GlobalAlloc","uint",0,"uint",StrLen(Hex)//2))
        return 0
    Loop % StrLen(Hex)//2
        NumPut("0x" . SubStr(Hex,2*A_Index-1,2), pbin-1, A_Index, "char")
    NumPut(pbin,pFunc+4), NumPut(1,pFunc+45,0,"char")
    DllCall("GlobalFree","UPTR",pcb)
    return pbin
}
__getVar(var) {
   MsgBox is displayed when
}

_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun :wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 15th, 2011, 12:23 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7503
Location: Australia
The Func structure has changed. See commit 5947782 and commit fef44ef.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 15th, 2011, 1:48 am 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
Therefore I have changed pFunc+49 to 45 but still user defined function is called :?:

_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun :wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 16th, 2011, 3:45 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7503
Location: Australia
See the second commit linked in my previous post. You need to account for the hidden v-table pointer at the beginning of the structure, as the Func class now has virtual methods.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 16th, 2011, 3:49 am 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
I see, thank you very much :)

_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun :wink:


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 173 posts ]  Go to page Previous  1 ... 8, 9, 10, 11, 12

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 8 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group