我用lua调用windows API发生故障!我不明白,救命啊!平台:Win7,lua5.1for win7
<i>require "alien"
--alien.load("Dll.dll")
--print(alien.defalt)
--[[
def = alien.load("msvcrt.dll")
def.puts:types("int", "string")
def.puts("foo")
scanf = def.scanf
scanf:types("int", "string", "ref int", "ref double")
_, x, y = scanf("%i%lf", 0, 0)
print(x, y)
--]]
local Kernel32 = alien.load('kernel32.dll')
GetTickCount = Kernel32.GetTickCount
GetTickCount:types{ret = "ulong", "void", abi = "stdcall"}
local c = GetTickCount(nil)</i>发布于 2013-03-12 01:28:00
你的代码过于复杂了。此代码段打印当前的节拍计数:
require "alien"
local kernel = alien.load("kernel32.dll")
local ticks = kernel.GetTickCount
ticks:types({ret="ulong"})
print(ticks())https://stackoverflow.com/questions/15342167
复制相似问题