home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
MediaPortal 1
MediaPortal 1 Plugins
New My Programs Plugin
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="RoyN" data-source="post: 65345" data-attributes="member: 19028"><p>Well, it wouldnt be very difficult if you just resize/move the window to take the area that one has defined....</p><p></p><p>It can be made more complex (say if you want to remove window-titles, menu bar, etc...)</p><p></p><p>I am amember at mp3car.com, and there we discuss in-car pcs... there are some appplications which do exactly this, embed applications in themselves (basically, the same thing I suggest here)... from what I gather, they are either parenting the original window (which requires you find the window by giving either/or the window name or class name), or they merely "hide" the areas we dont want to see...</p><p></p><p>There is some delphi code that is really simple that embeds the slignplayer I mentioned above...I'll paste it here so you can see, it isnt really very complicated, and I guess I'll have to make something like this if no one else does, but I just dont have any programming tools on my machine at the mo... gotta go get the cds in the office <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite1" alt=":)" title="Smile :)" loading="lazy" data-shortname=":)" /></p><p></p><p>Anyways, the code is pretty straight forwafrd, as it uses mainly windows methods...</p><p>(ps, not written by me)</p><p>[code]{ Application Name : SlingView</p><p> Version : 1.2</p><p> Author : Andrew Butkus</p><p> Website : [url]www.lommage.co.uk/slingbox[/url]</p><p></p><p> ==============================================================</p><p></p><p> Bugfix History</p><p> --------------</p><p> 3/1/2006</p><p> - Recoded version 1.2</p><p></p><p> ==============================================================</p><p>}</p><p></p><p>unit MainForm1;</p><p></p><p>interface</p><p></p><p>uses</p><p> Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,</p><p> Dialogs, Buttons, ExtCtrls;</p><p></p><p>type</p><p> TForm1 = class(TForm)</p><p> procedure FormShow(Sender: TObject);</p><p> procedure FormResize(Sender: TObject);</p><p> procedure FormClose(Sender: TObject; var Action: TCloseAction);</p><p> private</p><p> { Private declarations }</p><p> public</p><p> { Public declarations }</p><p> procedure DoResize;</p><p> end;</p><p></p><p> procedure InitialiseSlingWindow;</p><p></p><p>var</p><p> Form1: TForm1;</p><p> </p><p> Window: Cardinal = 0; // Slingplayer Window (make sure starts with 0)</p><p> WindowRect, DefaultWindowRect: TRect; // Settings for windows position</p><p></p><p> UserResizing: Boolean = False; //Boolean check to see if application is</p><p> //resizing, or if its the user (this avoids</p><p> //the code to be re-called everytime the</p><p> //application resizes)</p><p></p><p>implementation</p><p></p><p>{$R *.dfm}</p><p></p><p>//-----------------------------</p><p>{ Find Window to modify }</p><p>function EnumViewWindowsProc(WHandle: HWND; lParam: LPARAM): BOOL; export; stdcall;</p><p>var</p><p> WindowName : array[0..MAX_PATH] of char;</p><p>begin</p><p> Result := True;</p><p> GetWindowText(WHandle, WindowName, MAX_PATH);</p><p></p><p> If (String(WindowName) = 'SlingPlayer') then</p><p> begin</p><p> //Store original size of window in a temp rect</p><p> GetWindowRect(WHandle, WindowRect);</p><p> //Set the mask to hide the window - for user testing of main window</p><p> SetWindowRgn(WHandle, CreateRectRgn(0, 0, 0, 0), True);</p><p></p><p> If MessageDlg('Did the main Sling Player Main Video window Disappear?', mtConfirmation, [mbYes, mbNo], 0) = mrYes then</p><p> begin</p><p> Window := WHandle; //If it is slingplayer window then assign to a global variable</p><p> Result := False; //Discontinuing checking for window</p><p> end</p><p> else</p><p> //If window doesnt hide, then set the mask back to the original dimensions</p><p> SetWindowRgn(WHandle, CreateRectRgn(0, 0, WindowRect.Right, WindowRect.Bottom), True);</p><p> end;</p><p>end;</p><p></p><p>{ This is called when application starts }</p><p>procedure InitialiseSlingWindow;</p><p>begin</p><p> { Start of by getting the slingplayer window }</p><p> EnumWindows(@EnumViewWindowsProc, 0);</p><p></p><p> { If doesnt exist then exit, as its not running }</p><p> If Window = 0 then</p><p> begin</p><p> Showmessage('SlingPlayer not running, Exiting ...');</p><p> Application.Terminate;</p><p> end;</p><p></p><p> { Store current Slingplayer window position }</p><p> DefaultWindowRect.Top := WindowRect.Top;</p><p> DefaultWindowRect.Left := WindowRect.Left;</p><p> DefaultWindowRect.Bottom := WindowRect.Bottom;</p><p> DefaultWindowRect.Right := WindowRect.Right;</p><p>end;</p><p>//-----------------------------</p><p></p><p>{ Do the resize procedure (for resizing form and slingplayer window) }</p><p>procedure TForm1.DoResize;</p><p>begin</p><p> UserResizing := False; //Switch into application resizing mode</p><p></p><p> Form1.Left := WindowRect.Left;</p><p> Form1.Top := WindowRect.Top;</p><p></p><p> Form1.Width := WindowRect.Right - 40;</p><p> Form1.Height := WindowRect.Bottom - 173;</p><p></p><p> UserResizing := True; //Switch back to user resizing mode</p><p></p><p> MoveWindow(Window, 0 - 24, 0 - 62, WindowRect.Right, WindowRect.Bottom, True);</p><p> SetWindowRgn(Window, CreateRectRgn(0, 0, WindowRect.Right - 24, WindowRect.Bottom - 140), True);</p><p>end;</p><p></p><p>{ Make our application the parent window of Slingplayer }</p><p>procedure TForm1.FormShow(Sender: TObject);</p><p>begin</p><p> //Set constraints of the window (this is more due to slingplayer not being able to maxed sized)</p><p> Form1.Constraints.MaxHeight := Screen.Height - 165;</p><p> Form1.Constraints.MaxWidth := Screen.Width - 48;</p><p> Form1.Constraints.MinHeight := 235;</p><p> Form1.Constraints.MinWidth := 320;</p><p></p><p> Windows.SetParent(Window, Form1.Handle); //Make sling player a part of our form</p><p> DoResize; //and now resize slingplayer to the size of our form</p><p>end;</p><p></p><p>{ When form is resized make sure the slingplayer window is updated }</p><p>procedure TForm1.FormResize(Sender: TObject);</p><p>begin</p><p> If UserResizing then //here we check to see if the user is resizing or if the application is</p><p> begin</p><p> WindowRect.Left := Form1.Left;</p><p> WindowRect.Top := Form1.Top;</p><p></p><p> WindowRect.Right := Form1.Width + 40;</p><p> WindowRect.Bottom := Form1.Height + 173;</p><p></p><p> DoResize;</p><p> end;</p><p>end;</p><p></p><p>{ Put Slingplayer back the way it was before } </p><p>procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);</p><p>begin</p><p> //Move the window back to original position</p><p> MoveWindow(Window, DefaultWindowRect.Left, DefaultWindowRect.Top, DefaultWindowRect.Right, DefaultWindowRect.Bottom, True);</p><p></p><p> SetWindowRgn(Window, CreateRectRgn(0, 0, Screen.Width, Screen.Height), True); //Reset the mask</p><p> Windows.SetParent(Window, 0); //Make the slingplayer parent back to the desktop</p><p>end;</p><p></p><p>end.</p><p>[/code]</p></blockquote><p></p>
[QUOTE="RoyN, post: 65345, member: 19028"] Well, it wouldnt be very difficult if you just resize/move the window to take the area that one has defined.... It can be made more complex (say if you want to remove window-titles, menu bar, etc...) I am amember at mp3car.com, and there we discuss in-car pcs... there are some appplications which do exactly this, embed applications in themselves (basically, the same thing I suggest here)... from what I gather, they are either parenting the original window (which requires you find the window by giving either/or the window name or class name), or they merely "hide" the areas we dont want to see... There is some delphi code that is really simple that embeds the slignplayer I mentioned above...I'll paste it here so you can see, it isnt really very complicated, and I guess I'll have to make something like this if no one else does, but I just dont have any programming tools on my machine at the mo... gotta go get the cds in the office :) Anyways, the code is pretty straight forwafrd, as it uses mainly windows methods... (ps, not written by me) [code]{ Application Name : SlingView Version : 1.2 Author : Andrew Butkus Website : [url]www.lommage.co.uk/slingbox[/url] ============================================================== Bugfix History -------------- 3/1/2006 - Recoded version 1.2 ============================================================== } unit MainForm1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, Buttons, ExtCtrls; type TForm1 = class(TForm) procedure FormShow(Sender: TObject); procedure FormResize(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); private { Private declarations } public { Public declarations } procedure DoResize; end; procedure InitialiseSlingWindow; var Form1: TForm1; Window: Cardinal = 0; // Slingplayer Window (make sure starts with 0) WindowRect, DefaultWindowRect: TRect; // Settings for windows position UserResizing: Boolean = False; //Boolean check to see if application is //resizing, or if its the user (this avoids //the code to be re-called everytime the //application resizes) implementation {$R *.dfm} //----------------------------- { Find Window to modify } function EnumViewWindowsProc(WHandle: HWND; lParam: LPARAM): BOOL; export; stdcall; var WindowName : array[0..MAX_PATH] of char; begin Result := True; GetWindowText(WHandle, WindowName, MAX_PATH); If (String(WindowName) = 'SlingPlayer') then begin //Store original size of window in a temp rect GetWindowRect(WHandle, WindowRect); //Set the mask to hide the window - for user testing of main window SetWindowRgn(WHandle, CreateRectRgn(0, 0, 0, 0), True); If MessageDlg('Did the main Sling Player Main Video window Disappear?', mtConfirmation, [mbYes, mbNo], 0) = mrYes then begin Window := WHandle; //If it is slingplayer window then assign to a global variable Result := False; //Discontinuing checking for window end else //If window doesnt hide, then set the mask back to the original dimensions SetWindowRgn(WHandle, CreateRectRgn(0, 0, WindowRect.Right, WindowRect.Bottom), True); end; end; { This is called when application starts } procedure InitialiseSlingWindow; begin { Start of by getting the slingplayer window } EnumWindows(@EnumViewWindowsProc, 0); { If doesnt exist then exit, as its not running } If Window = 0 then begin Showmessage('SlingPlayer not running, Exiting ...'); Application.Terminate; end; { Store current Slingplayer window position } DefaultWindowRect.Top := WindowRect.Top; DefaultWindowRect.Left := WindowRect.Left; DefaultWindowRect.Bottom := WindowRect.Bottom; DefaultWindowRect.Right := WindowRect.Right; end; //----------------------------- { Do the resize procedure (for resizing form and slingplayer window) } procedure TForm1.DoResize; begin UserResizing := False; //Switch into application resizing mode Form1.Left := WindowRect.Left; Form1.Top := WindowRect.Top; Form1.Width := WindowRect.Right - 40; Form1.Height := WindowRect.Bottom - 173; UserResizing := True; //Switch back to user resizing mode MoveWindow(Window, 0 - 24, 0 - 62, WindowRect.Right, WindowRect.Bottom, True); SetWindowRgn(Window, CreateRectRgn(0, 0, WindowRect.Right - 24, WindowRect.Bottom - 140), True); end; { Make our application the parent window of Slingplayer } procedure TForm1.FormShow(Sender: TObject); begin //Set constraints of the window (this is more due to slingplayer not being able to maxed sized) Form1.Constraints.MaxHeight := Screen.Height - 165; Form1.Constraints.MaxWidth := Screen.Width - 48; Form1.Constraints.MinHeight := 235; Form1.Constraints.MinWidth := 320; Windows.SetParent(Window, Form1.Handle); //Make sling player a part of our form DoResize; //and now resize slingplayer to the size of our form end; { When form is resized make sure the slingplayer window is updated } procedure TForm1.FormResize(Sender: TObject); begin If UserResizing then //here we check to see if the user is resizing or if the application is begin WindowRect.Left := Form1.Left; WindowRect.Top := Form1.Top; WindowRect.Right := Form1.Width + 40; WindowRect.Bottom := Form1.Height + 173; DoResize; end; end; { Put Slingplayer back the way it was before } procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction); begin //Move the window back to original position MoveWindow(Window, DefaultWindowRect.Left, DefaultWindowRect.Top, DefaultWindowRect.Right, DefaultWindowRect.Bottom, True); SetWindowRgn(Window, CreateRectRgn(0, 0, Screen.Width, Screen.Height), True); //Reset the mask Windows.SetParent(Window, 0); //Make the slingplayer parent back to the desktop end; end. [/code] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
MediaPortal 1 Plugins
New My Programs Plugin
Contact us
RSS
Top
Bottom