lua-users home
lua-l archive

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

Hi Steve,

  Thanks for winapi module. I did already see your announcements before but never tried it before, and it will help me a lot for my current project. For example, now I can remove the ugly calls to io.popen('net use','r') to get the network drives jejeje

  However, I have some problems to make callbacks working with my program. I'm writting a GUI application that uses wxLua. I read that when using wxLua, to make your winapi module events working, we need to call winapi.use_gui(). My objective is to use watch_for_file_changes, but I made also some tries with make_timer to verify if it works. I then tried with:

  ud, err = winapi.watch_for_file_changes('E:\\', winapi.FILE_NOTIFY_CHANGE_LAST_WRITE+winapi.FILE_NOTIFY_CHANGE_FILE_NAME, true,
            function(what, who)


  ud, err = winapi.make_timer(500, function() print('tick') end)

  First I tried with use_gui, calling this function before to require the wx module, before to call the wx event loop and in the event loop (because I didn't know where I had to call it), but nothing worked. But when I removed the call to use_gui and called winapi.sleep(-1), the events worked.

  Do you have any idea about what I'm missing?

  Thanks a lot,


Alexandre Rion
Fuel and Fire Department (MEYGU)
EADS / Airbus Military

> Date: Mon, 25 Jun 2012 09:41:16 +0200
> From:
> To:
> Subject: [ANN] winapi 1.4
> Hi all,
> winapi [1] is a compact binding to a useful subset Windows API,
> including process spawning and management, finding windows, option to
> work in UTF-8, Registry manipulation, timers and so forth; the online
> documentation is here [2] and the downloads page has binaries for both
> mingw and Lua for Windows.
> Since the last release, some nasty concurrency issues have been sorted
> out - we _only_ dispatch calbacks on the main Lua thread; if you use
> winapi in a GUI program, then calling winapi.use_gui() will make it
> synchronize callbacks with the GUI thread.
> The registry functions are now documented, and Regkey:set_value()
> takes an optional type parameter, so you are no longer restricted to
> string data (it now uses the widechar version to be consistent with
> other functions dealing with text).
> The original impetus for this release is that wait_for_processes() did
> not properly return the index within the array of processes - I needed
> this for multitasking support in Lake. This function (which wraps
> WaitForMultipleObjects) also will now wait for events, threads and
> console events.
> Thanks to all my testers and contributors!
> steve d.
> [1]
> [2]