lua-users home
lua-l archive

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


Use LuaInterface, by far the easiest method to making gui apps.

Habib wrote:
Anyone can give me an idea how I can call win32 API from within LUA?

I searched the archive, wiki and sites, founding only a dead link.

I tough it's time to ask help to the community.

Plus, what might be the best method to build a Win32 GUI framework for busingess applications?

Some back history on how I got here:

Basically what we needed for the application framework were:
- Smaller in size, because every release of the app will be distributed to clients over the net. (Which is one reason why I am going for Lua.) - Doesn't need to be very fast like games, but needs to be very flexible for being changed. Business logic changes rapidly. (Therefore more code should go into lua and less in C.)

Traditionaly it's done by XML-Java styled, untill the XMLs grow in size and complexity and turns out to be a mini programming language by itself. This is where probably Lua with it's flixible table data comes handy.

Thefore first I tried: wxWidgets. Dropped it when I couldn't find any easy way to display a JPEG on the screen. Hacking it will be more troublesome than it's worth. Add with it the requirement that we need to capture webcam image and shoot pictures, and things get out of hand fast.

Next tried: Lua Visual Controls: looked very promissing, untill figured out it was written in pascal, therefore I can't extend it.

There are other programs like AfxLua, "Win32 API wrappers" etc. None of those are much useful because those are very limited, doesn't cover the GUI, specially none of the GDI.

Later tried to write a C-bound-Lua styled GUI application framework myself, but found binding the API calls with Lua too time consuming, and very redundent.

Lastly tried to use CInvoke to connect with kernal32.dll user32.dll dynamically. But as soon as I started parsing those windows header files (*.h) to create the declarations; I figured out that some Lua-C binding tools actually do it that way and probably I was re-inventing the wheel. Anyway I am able to create a full blown window with controls using Cinvoke only. Starting from CreateWindow, through call back handling with WinProc, upto the message loop all written in Lua. Might not be a good idea, but it's proven that it can be done.

I guess now I can ask for some direction.

My task would have been very easy, if I could find a Lua-Win32 API binding package already done by someone. But I am not finding that very basic task done, anywhere.

Any help will be welcome.

With thanks.

-habib.