Indigo Rose Software
  #1  
Old 11-11-2007
Islander Islander is offline
Forum Member
 
Join Date: Jun 2004
Posts: 2
Running/embedding portable programs?

I am wondering if it is possible, or if anyone has played around with something like this yet, but I was wondering, now that there are quite a few portable versions of programs floating around, would it be possible to, for example, include a portable version of Firefox for example to be the display browser within AMS?
You could then have it pre-loaded with what ever plug-ins are needed, ie.; Flash, and what ever else one might like. That way you dont have to wonder if the clients has what is needed, or the necessity for them to install additional plug-ins.
Reply With Quote
  #2  
Old 11-11-2007
FoxLeader's Avatar
FoxLeader FoxLeader is offline
Forum Member
 
Join Date: Nov 2006
Location: Quebec, Canada.
Posts: 432
Hello,

I started working on this sometime ago with Firefox (and AMS 6). I'll try to remeber to upload it on monday, so you'll be able to have a look at it.

Regards,
FoxLeader
Reply With Quote
  #3  
Old 11-11-2007
Derek's Avatar
Derek Derek is offline
Indigo Rose Customer
 
Join Date: May 2001
Location: 51.501296|-2.700963
Posts: 1,206
There should be no reason why 'portable firefox' wouldn't work using File.Run

It works well enough in BartsPE, so it should be much the same in AMS, tho you wouldn't be able to embed in Browser object because AMS uses IE ActiveX for that.
__________________
-
- Derek
- ["All glory comes from daring to begin" - fortune cookie]

IR WebHelp: AMS6 SUF7 VP2 TU2

Last edited by Derek; 11-11-2007 at 05:41 PM.
Reply With Quote
  #4  
Old 11-11-2007
FoxLeader's Avatar
FoxLeader FoxLeader is offline
Forum Member
 
Join Date: Nov 2006
Location: Quebec, Canada.
Posts: 432
That IS possible. I've done it. I'll upload tomorrow, since it's a relativly heavy file. (more than 20MB, so impossible to upload directly on those forums).

However, I have a problem: I need it to maximize within the AMS app, however on my 1680*1050 screen, there's like 10 or 20 px that can't maximizes. Here's my code to embed FireFox:
(as you probably undestood, FireFox is in "AutoPlay\\ffEngine", so you must unzip FF Portable in this folder.

On Show:
Code:
display = System.GetDisplayInfo();
Window.SetPos(Application.GetWndHandle(), 0, 0);
Window.SetSize(Application.GetWndHandle(), display.Width, display.Height-34);
--##################################################################
File.Run("AutoPlay\\ffEngine\\FirefoxPortable.exe", "www.startforce.com", "AutoPlay\\ffEngine\\", SW_MINIMIZE, false);
blnEmbedded=false;
while (blnEmbedded==false) do 
	windows = Window.EnumerateTitles();
	window_name = "WebOSBrowser";

	-- Loop through the table of windows.
	for handle, title in windows do
	
	    -- Check if the window title has the target text.
	    result = String.Find(title, window_name, 1, false);
	
	    -- if the string was found in the title, send the window a close message.
	    if (result ~= -1) then
	    	blnEmbedded=true;
	    	--Dialog.Message("","IN")
			result = DLL.CallFunction(_SystemFolder .. "\\User32.dll", "SetParent",  handle..","..Application.GetWndHandle(), DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL)
			
			Window.SetSize(handle, display.Width+20, display.Height+165)
			Window.SetPos(handle,-10,-52)
			Page.Redraw()
			Window.Show(handle)
	    end
	end
end
Page.Redraw()
Web.SetSize("Navigator", display.Width, display.Height);
On Size:
Code:
			curSize = Window.GetSize(Application.GetWndHandle());
			Window.SetSize(handle, curSize.Width+40, curSize.Height+40)
			Window.SetPos(handle,-10,-30)
			Page.Redraw()
			Window.Show(handle)
On Key:
Code:
if e_Key == 27 then
     Application.Minimize()
end
On Mouse Move:
Code:
if e_X >= display.Width-50 and e_Y >= 0 then
	Application.Minimize();
end
So that was the whole code.

Last edited by FoxLeader; 11-11-2007 at 05:59 PM.
Reply With Quote
  #5  
Old 11-11-2007
Derek's Avatar
Derek Derek is offline
Indigo Rose Customer
 
Join Date: May 2001
Location: 51.501296|-2.700963
Posts: 1,206
lol ... thats not embedded. You're doing precisely what i said - File.Run
__________________
-
- Derek
- ["All glory comes from daring to begin" - fortune cookie]

IR WebHelp: AMS6 SUF7 VP2 TU2
Reply With Quote
  #6  
Old 11-11-2007
FoxLeader's Avatar
FoxLeader FoxLeader is offline
Forum Member
 
Join Date: Nov 2006
Location: Quebec, Canada.
Posts: 432
Well... yeah, but have you tried it? It runs inside the AMS app. Sure, that's not like a webobject but that's as near as possible.
Reply With Quote
  #7  
Old 11-12-2007
Islander Islander is offline
Forum Member
 
Join Date: Jun 2004
Posts: 2
Hello FoxLeader & Derek,

Thanks for the replies, I didnt know if anyone else had thought about something like this or not.

@FoxLeader, if its not running as a webobject or embeded, do you see all of the control panels and menus? or is this opening outside of AMS?

Or is it loading it as a program, but showing it inside of an AMS window?
Reply With Quote
  #8  
Old 11-12-2007
FoxLeader's Avatar
FoxLeader FoxLeader is offline
Forum Member
 
Join Date: Nov 2006
Location: Quebec, Canada.
Posts: 432
You can show them, or you can hide them. But the window is all there, it just depends how you configure it.

Anyway, you can try it here: http://www.box.net/shared/lq15vhveej

Note that it've only been tested on my Vista x64 with a 1680*1050 display, so if there's anything, just say and I'll take a look at it.
Another thing is that I've made it to be fullscreen, except the windows taskbar and the Firefox status bar. The purpose, as I've made it, is simply to be used as a "Web OS" client; it just opens the Web OS, but with a fast look at the code you should understand how to adapt it.
Reply With Quote
  #9  
Old 11-18-2007
usernameCasper's Avatar
usernameCasper usernameCasper is offline
Forum Member
 
Join Date: Nov 2006
Posts: 306
Yes, it is possible.
You have to invoke a dll for it or write one your own using the header/lib.
You need the 'SetParent' function in the user32.dll.

Code snippet:
Quote:
local strDlg_1 = Dialog.Input("requested hwnd","requested hwnd child:","",MB_ICONQUESTION);
local strDlg_2 = Dialog.Input("requested hwnd","requested hwnd newParent:","",MB_ICONQUESTION);
DLL.CallFunction(_SystemFolder.."\\User32.dll", "SetParent",String.ToNumber(strDlg_1)..","..String .ToNumber(strDlg_2), DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL);
Note: 'String.ToNumber()' is redundant.
The DLL would return an int 64 bit value, indicating the status, wheter
the call was succesful implementat or not. 0 for faillure, 1 for succes.
FYI, I didn't use a variable to store the result.

NOTE: There are different hwnd's in the builded executable when runned, on
a particular page. It's important you know the precious hwnd of the page
you want to embed the portable application. Otherwhise the embbeded app
will flicker or not be drawing well. That's why you need to get the child hwnd
of this page. When you got this, embed the app on this childhwnd, this wont
cause flickering/redrawing problems.
The flickering/drawing problems happens cause the form is redrawing itself
continue. That's why the embedded app suffer from this.
In detail: Pages are divided in classes, the page you want embed your app
does have multiple hwnd's, the form where the app will be embedded does
have multiple childwindows, where 2 hwnds are in the same class, where
only 1 can be used for the parentwindow.

Important: close the childhwnd before you close the parenthwnd, otherwise
child will crash and maybe memory allocations could be compromised.

I hope I informed you well, it's hard to explain this.
This should work.

Kind regards,
Casper
Reply With Quote
  #10  
Old 11-18-2007
usernameCasper's Avatar
usernameCasper usernameCasper is offline
Forum Member
 
Join Date: Nov 2006
Posts: 306
Now it makes me wonder why the page got 2 childwindows for the same class?
Could someone explain this little further ?
It looks like 1 is used to repaint/update the page, as the other is used to have
childwindows attach to this hwnd, maybe a ref to make it 1, where the WM message
is send when an event has occoured? E.g. timers/user interaction -> Call method/function RedrawWindow, this also improves page loading speed imo.
If so, than I would like to make that ref for considerating (just a suggestion).

Kind regards,
Casper
Reply With Quote
  #11  
Old 11-19-2007
KARLOSTHG KARLOSTHG is offline
Forum Member
 
Join Date: Jul 2007
Posts: 15
Lightbulb

see this (is in spanish, and visual basic code)
http://www.elguille.info/colabora/20...r_Programa.htm

and this in english
http://msdn2.microsoft.com/en-us/library/ms633541.aspx

i found the first code searching about embedding objects

sorry for my english bye
Reply With Quote
  #12  
Old 11-19-2007
usernameCasper's Avatar
usernameCasper usernameCasper is offline
Forum Member
 
Join Date: Nov 2006
Posts: 306
I've played today on my free day with the pinvoke (api call).
Enum the child of the Application.GetWndHandle() will give you imo the FormClass without RedrawClass (I called them so, cause the one is redrawing while the other is the parent for all objects with hwnd's).
I embedded my own console onto a page (ofc on the "FormClass").
It works great, although, the funniest thing is... The hwnd isn't visible anymore in a hwnd enum, but it's still accessible).
I founded out that there is no way to disable the console for being moved,
you can remove the menu, this is for the win32 console, thus not using
the system.windows.forms !! For the forms, it's easy to disable this, by
overriding window messages). So I needed a workaround.
I embedded my console into the webobject and repositioned my console
so user cant move it out of the parent window, this worked great).
Cause the menuitems are removed, there is no way this console can be closed without terminating it (unless its a system proc ofc).

Maybe a suggestion to make child-windows as well for AMS ?
It's very powerful, ofc this is also a workaround.
If someone needs an example, I'll be happy to post it (AMS 6).
Maybe the wrong section to post this, but maybe not when a workaround is provided

Have fun coding,
Casper
Reply With Quote
  #13  
Old 11-21-2007
FoxLeader's Avatar
FoxLeader FoxLeader is offline
Forum Member
 
Join Date: Nov 2006
Location: Quebec, Canada.
Posts: 432
Ouch. I think those last things are too complicated for my understandings

If anybody has the time to make an exemple, I would be pleased to test and report bugs

Regards,
FoxLeader

Edit: So usernameCasper, I'd be pleased to see this
Reply With Quote
  #14  
Old 11-22-2007
usernameCasper's Avatar
usernameCasper usernameCasper is offline
Forum Member
 
Join Date: Nov 2006
Posts: 306
Hey FoxLeader,

I just posted it in the AMS 6 example section, I hope you will see it soon as
possible, cause it must be checked by IR before it will be visible to public.

I hope you find it usefull !

-Casper
Reply With Quote
  #15  
Old 11-22-2007
FoxLeader's Avatar
FoxLeader FoxLeader is offline
Forum Member
 
Join Date: Nov 2006
Location: Quebec, Canada.
Posts: 432
Thanks! I'll take a look at this

Regards,
FoxLeader
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
AMS Quiz As Portable Flash Drive App plugcatcher AutoPlay Media Studio 6.0 9 11-14-2006 09:30 PM
Multiple Programs compiled into one EXE. voidgere Setup Factory 7.0 Discussion 1 02-09-2005 04:31 PM
Portable Thunderbird email Roboblue General Chat 2 12-04-2004 04:32 PM
Install programs. cassini AutoPlay Media Studio 5.0 2 02-05-2004 04:21 PM
Restarting programs longe TrueUpdate 1.0 0 09-03-2003 10:10 PM


All times are GMT -6. The time now is 07:32 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Copyright © 2000 - 2009 Indigo Rose Corporation. All rights reserved.
Indigo Rose Software