Page 1 of 1

How to Run Application in LUA IUP Frame

Posted: 09 Nov 2011 11:15
by tatewise
Does anyone know how to execute a Windows application program within a LUA IUP GUI Window Frame?

Currently I use the FH API fhShellExecute(strExecutable) but this runs the executable program in a separate Windows window.
I've looked at LUA os.execute(strExecutable) but that does not seem to help.

I want to run a Windows executable program so that what normally appears in its own Windows GUI appears in a LUA IUP Window Frame instead.

ID:5543

How to Run Application in LUA IUP Frame

Posted: 09 Nov 2011 20:08
by Jane
I have never seen a way to do that in any language I have used which ones have you seen which can do that?

I suppose you might have seen OLE embedding, but that's a low levels windows interface.

What are you trying to achieve?

How to Run Application in LUA IUP Frame

Posted: 09 Nov 2011 20:38
by NickWalker
That was my thought too, I've never come across a way to do this in Windows.

I seem to remember years ago it used to be possible in Windows to run an application as an MDI child of another window (and this may still be possible), but that doesn't appear to be what Mike is asking about.

How to Run Application in LUA IUP Frame

Posted: 09 Nov 2011 20:59
by tatewise
I have nearly finished combining Jane's Map Life Events and Map Geo Code Maintenance with several added features:
1) Mapping either Place or Address fields.
2) Filtering on Private &/or Living flags.
3) Sticky option settings, including multi-PC users.
4) Support for standalone GEDCOM  projects.
5) If the output folder is FH Family Tree CD/Website then integrate the Webpage Maps with the featured Web Pages.

The plugin now runs the Google Maps Geocoder to map locations into latitude/longitude by using HTML Application (HTA) and crude XML file communication.
It would be nice to embed the Google Maps Geocoder HTA window within the main LUA IUP GUI window.
The IUP talks about OLE and Web Browser embedding controls, but no great detail and no worked examples.

How to Run Application in LUA IUP Frame

Posted: 09 Nov 2011 22:53
by NickWalker
Ah OK, web applications or OLE may well be possible, you mentioned Windows applications which are not quite the same. Sorry but can't help with that as I've not used Lua. Sounds like you're making some excellent progress though, well done.

How to Run Application in LUA IUP Frame

Posted: 10 Nov 2011 14:41
by Jane
HTA are just web pages in disguise, so if you can make it an HTML page you can embed a web page into LUA fairly easily.

using something like:

Code: Select all

-- iupole-browser.lua
--
-- Duplicate the iupole_browser.cpp sample in pure lua

require 'iuplua'
require 'iupluaole'
require 'luacom'

-- create the WebBrowser based on its ProgID
local control = iup.olecontrol{'Shell.Explorer.2'}

-- connect it to LuaCOM
control:CreateLuaCOM()

-- Sets production mode
control.designmode= 'NO'

-- Create a dialog containing the OLE control

local dlg = iup.dialog{
    title='Display HTML in IUP Dialogue',
    size='HALFxHALF',
    iup.vbox{
   control,
    }
}

-- Show the dialog and run the main loop
dlg:show()
control.com:Navigate('D:\temp\testmap.html')
if (not iup.MainLoopLevel or iup.MainLoopLevel()==0) then
  iup.MainLoop()
end

How to Run Application in LUA IUP Frame

Posted: 10 Nov 2011 20:39
by tatewise
Thanks Jane, that looks promising, and I believe I tried something like that, but it comes up with following error:

Line 7: module 'luacom' not found:
     no field package.preload['luacom']
     no file 'C:ProgramDataCalico PieFamily Historian 5.0 BetaPluginsluacom.fh_lua'
     no file 'C:Program Files (x86)Family Historian 5.0 BetaProgramluacom51.dll'
     no file 'C:Program Files (x86)Family Historian 5.0 BetaProgramluacom.dll'
     no file 'C:ProgramDataCalico PieFamily Historian 5.0 BetaPluginsluacom.dll'
No changes have been made to data records.

How to Run Application in LUA IUP Frame

Posted: 10 Nov 2011 21:15
by Jane
Ah sorry, it worked on my PC, but I might have copied over the extra dll's from the Lua for Windows install.

How to Run Application in LUA IUP Frame

Posted: 11 Nov 2011 10:23
by tatewise
I tried simply copying the luacom.dll download from SourceForge to the C:Program Files (x86)Family Historian 5.0 BetaProgram folder, but still got an error like Procedure missing.

Is there any way I could install luacom to see if iup.olecontrol will run my HTA script within an IUP Dialogue?

Alternatively, after your Course tomorrow, perhaps I could send you my HTA script to see if it will run within an IUP Dialogue.

If that is successful, then we need to persuade Simon to include it in the FH LUA.

How to Run Application in LUA IUP Frame

Posted: 11 Nov 2011 10:39
by NickWalker
Have you tried registering the dll?

regsvr32 path-to-dll

How to Run Application in LUA IUP Frame

Posted: 11 Nov 2011 10:53
by Jane
I have asked Simon to include the dll in the next beta.

I have just rebuilt my Laptop ready for the course, so once the course is over, I will double check which dlls are needed.