lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

majkinetor wrote:
I am using dllimport v0.0001 alpha lua library by Jas Latrix
The problem here is that TextOut doesn't draw on the Desktop for some
I don't see why.

This works for me:

local dllimport = require "dllimport"
local GetDC = assert(dllimport("USER32", "GetDC", "P=P"))
local TextOut = assert(dllimport("GDI32", "TextOut", "I=PiiPi"))
local ReleaseDC = assert(dllimport("USER32", "ReleaseDC", "i=PP"))

local w = 0
h = GetDC(w)
text = "some cool text"
res = TextOut(h, 0, 0, text, #text)
ReleaseDC(w, h)

The significant change is the call to ReleaseDC, of course.

Since there is no source release for dllimport (yet?) I had to modify the dllimport.dll binary to force it to use the LuaBinaries standard name lua5.1.dll instead of lua51.dll to get it to work for me.