We help IT Professionals succeed at work.

Program on top of another full screen program..

Palamedes
Palamedes asked
on
Medium Priority
173 Views
Last Modified: 2010-04-06
I am wanting to write a small program that will "piggy back" another..

The main application I have can be displayed in any number of different screen resolutions and graphics
modes..

How do I write a program that knows what that resolution/screen mode is and then uses that information
to display itself?

Does this make sense?

The program I am running runs in OpenGL or Direct3D and a number of different resolutions.. And it is
full screen.. the standard "ONTOP" wont work of course..

Thanks

(I just asked this question but it didn't show up anywhere.. *shrug*)
Comment
Watch Question

Well this might be a bit off track but you might find something of use within the code example. This code is based on a David Souchard's code (A Delphi programmer)on another message board.
//It set's the res mode to whatever then restores the original settings on a second button click.
Good luck
T.
*********************************************
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, ExtCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Button2: TButton;

    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

  implementation

{$R *.DFM}


 function SetScreenResolution( Width, Height: integer): longint;
var
 DeviceMode: TDeviceMode;
begin
 with DeviceMode do begin
    dmSize := SizeOf( TDeviceMode );
    dmPelsWidth := Width;
    dmPelsHeight := Height;
    dmFields := DM_PELSWIDTH or DM_PELSHEIGHT;
 end;
 Result := ChangeDisplaySettings( DeviceMode, CDS_UPDATEREGISTRY );
end;
var
 oldWidth, oldHeight: integer;

procedure TForm1.Button1Click( Sender: TObject );
begin
 oldWidth := GetSystemMetrics( SM_CXSCREEN );
 oldHeight := GetSystemMetrics( SM_CYSCREEN );
 showmessage('You are about to change your Screen Resolution to 800x600');
 SetScreenResolution( 800, 600 );//Or whatever
 form1.position:=poScreenCenter;
end;


procedure TForm1.Button2Click(Sender: TObject);
begin
showmessage('This will reset your Screen  Resolution');
SetScreenResolution( oldWidth, oldHeight );
form1.position:=poScreenCenter;
end;

procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
SetScreenResolution( oldWidth, oldHeight );

end;

end.

Commented:
Why don't declare first application as a COM objects. Then you can make second to ask first abouth it's position and size.

Best Regards
Ivan

Author

Commented:
Thank you for your time and effort.. I haven't checked that to see if it works but it looks like it will and it certainly will head me in the right direction..

Thanks..

Explore More ContentExplore courses, solutions, and other research materials related to this topic.