* How to Run Application in LUA IUP Frame

For users to report plugin bugs and request plugin enhancements; and for authors to test new/new versions of plugins, and to discuss plugin development (in the Programming Technicalities sub-forum). If you want advice on choosing or using a plugin, please ask in General Usage or an appropriate sub-forum.
Post Reply
User avatar
tatewise
Megastar
Posts: 27087
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

How to Run Application in LUA IUP Frame

Post by tatewise » 09 Nov 2011 11:15

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
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

User avatar
Jane
Site Admin
Posts: 8442
Joined: 01 Nov 2002 15:00
Family Historian: V7
Location: Somerset, England
Contact:

How to Run Application in LUA IUP Frame

Post by Jane » 09 Nov 2011 20:08

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?
Jane
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."

User avatar
NickWalker
Megastar
Posts: 2401
Joined: 02 Jan 2004 17:39
Family Historian: V7
Location: Lancashire, UK
Contact:

How to Run Application in LUA IUP Frame

Post by NickWalker » 09 Nov 2011 20:38

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.
Nick Walker
Ancestral Sources Developer

https://fhug.org.uk/kb/kb-article/ancestral-sources/

User avatar
tatewise
Megastar
Posts: 27087
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

How to Run Application in LUA IUP Frame

Post by tatewise » 09 Nov 2011 20:59

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.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

User avatar
NickWalker
Megastar
Posts: 2401
Joined: 02 Jan 2004 17:39
Family Historian: V7
Location: Lancashire, UK
Contact:

How to Run Application in LUA IUP Frame

Post by NickWalker » 09 Nov 2011 22:53

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.
Nick Walker
Ancestral Sources Developer

https://fhug.org.uk/kb/kb-article/ancestral-sources/

User avatar
Jane
Site Admin
Posts: 8442
Joined: 01 Nov 2002 15:00
Family Historian: V7
Location: Somerset, England
Contact:

How to Run Application in LUA IUP Frame

Post by Jane » 10 Nov 2011 14:41

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
Jane
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."

User avatar
tatewise
Megastar
Posts: 27087
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

How to Run Application in LUA IUP Frame

Post by tatewise » 10 Nov 2011 20:39

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.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

User avatar
Jane
Site Admin
Posts: 8442
Joined: 01 Nov 2002 15:00
Family Historian: V7
Location: Somerset, England
Contact:

How to Run Application in LUA IUP Frame

Post by Jane » 10 Nov 2011 21:15

Ah sorry, it worked on my PC, but I might have copied over the extra dll's from the Lua for Windows install.
Jane
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."

User avatar
tatewise
Megastar
Posts: 27087
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

How to Run Application in LUA IUP Frame

Post by tatewise » 11 Nov 2011 10:23

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.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

User avatar
NickWalker
Megastar
Posts: 2401
Joined: 02 Jan 2004 17:39
Family Historian: V7
Location: Lancashire, UK
Contact:

How to Run Application in LUA IUP Frame

Post by NickWalker » 11 Nov 2011 10:39

Have you tried registering the dll?

regsvr32 path-to-dll
Nick Walker
Ancestral Sources Developer

https://fhug.org.uk/kb/kb-article/ancestral-sources/

User avatar
Jane
Site Admin
Posts: 8442
Joined: 01 Nov 2002 15:00
Family Historian: V7
Location: Somerset, England
Contact:

How to Run Application in LUA IUP Frame

Post by Jane » 11 Nov 2011 10:53

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.
Jane
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."

Post Reply