Hi,
Mateusz Czaplinski wrote:
> Hello!
> I'm creating a small application using wxLua (2.8) from the DLL
> distribution, with a homemade DLL of lua-sqlite3 added. Everything is
> nice and I love it.
>
> There's only one small problem I noticed just recently which makes it
> a bit ugly: when I'm running my script by means of the "lua.exe"
> included in the package, a console window opens in the background and
> stays there for the whole time the app is running. Is it possible to
> change things to disable it?
>
> I see there's a distibution of wxLua in an .exe package, but I don't
> want future users to have to use it; or can I just get some wxlua.exe
> or something out of it and distribute with my script?
>
> Thanks in advance for any help.
> Greetz
> Mateusz CzapliĆski
I'm using a small exe to start my wxLua program; you may use something
like that..
--
Regards,
Hakki Dogusan
#include <windows.h>
extern "C"
{
#include <lua.h>
#include <lauxlib.h>
#include <lualib.h>
}
// taken from lua.c
static int report (lua_State *L, int status) {
if (status && !lua_isnil(L, -1)) {
const char *msg = lua_tostring(L, -1);
if (msg == NULL) msg = "(error object is not a string)";
MessageBox(NULL, msg, NULL, 0); //l_message(progname, msg);
lua_pop(L, 1);
}
return status;
}
int WINAPI WinMain (HINSTANCE hThisInstance,
HINSTANCE hPrevInstance,
LPSTR lpszArgument,
int nCmdShow)
{
lua_State* L = lua_open();
if (!L)
{
MessageBox(NULL, "Could not open Lua", NULL, 0);
return 0;
}
luaL_openlibs(L); // open std libraries
int rc = luaL_loadfile(L, "./dsbw.lua") || // parse ok?
lua_pcall(L, 0, LUA_MULTRET, 0); // call main
report(L, rc);
lua_close(L);
return rc;
}
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
wxlua-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wxlua-users