# MCode()

作者: Laszlo 最近更新时间: 20080107

In AHK v1.0.46.08+, the 1st parameter of a DllCall can be an integer, the address of a function to call. If we copy the binary machine code of a function into an AHK variable, its addresses can be used in DllCalls, executing our machine code function.

MCode(ByRef code, hex)

关于函数的参数和返回值, 请参阅其源码.

#### 备注

Requires at least Ahk v1.0.46.08.

关于此函数(集)的更新细节和注意事项, 请参见 AutoHotkey 论坛: http://www.autohotkey.com/forum/viewtopic.php?t=21172

#### 许可

不存在

#### 示例

    ; #Include mcode.ahk
    #NoEnv
    SendMode Input
    SetWorkingDir %A_ScriptDir%

    ; For example, the following line stores the code of the function swapping
    ; the bytes of short (16-bit) value.
    MCode(BSwap16,"8AE18AC5C3")

    ; The result is 0x3412 in hex form. These do not involve any external dll's,
    ; so swapping bytes is almost as fast as if it was a built-in function.
    ; We can extend the list of built-in function arbitrarily.
    MsgBox % dllcall(&BSwap16, "short",0x1234, "cdecl ushort")