Controlling EXE files

I've make a program like Windows Explorer which execute EXEs.
The question is, can I arrange all executed EXEs to TILE/CASCADE like
in MDI?

Need a help for this,

Daniel
LVL 7
daniel_cAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

intheCommented:

Hi

unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
 
implementation

{$R *.DFM}
function CreateProcessSimple(sExecutableFilePath : string ): string;
  var
   pi: TProcessInformation;
   si: TStartupInfo;
   wnd : hwnd;
   i : integer;
  begin
   FillMemory( @si, sizeof( si ), 0 );
   si.cb := sizeof( si );
    CreateProcess(Nil, PChar( sExecutableFilePath ),
                  Nil, Nil, False, NORMAL_PRIORITY_CLASS,
                  Nil, Nil, si, pi );

      WaitForSingleObject(pi.hProcess,1000);
   wnd:= FindWindow(nil, PChar('Untitled - Notepad'));
   setwindowpos(wnd,HWND_TOPMOST,0,0,0,0,SWP_NOACTIVATE+SWP_NOMOVE+SWP_NOSIZE);
   CloseHandle( pi.hProcess );
   CloseHandle( pi.hThread );
  end;

procedure TForm1.Button1Click(Sender: TObject);
begin
CreateProcessSimple('notepad.exe');
end;


procedure TForm1.Button2Click(Sender: TObject);
var h: THandle;
begin
  h:= FindWindow(nil, PChar('Untitled - Notepad'));
  SendMessage(h, WM_CLOSE, 0, 0);
end;


end.

use in the HWND_TOPMOST,0,0,0,0
the 0,0,0,0 equals :
    int X,      // horizontal position
    int Y,      // vertical position
    int cx,      // width
    int cy,      // height
   


also look at movewindow() api:
from win32.hlp:

The MoveWindow function changes the position and dimensions of the specified window. For a top-level window, the position and dimensions are relative to the upper-left corner of the screen. For a child window, they are relative to the upper-left corner of the parent window's client area.

BOOL MoveWindow(

    HWND hWnd,      // handle of window
    int X,      // horizontal position
    int Y,      // vertical position
    int nWidth,      // width
    int nHeight,      // height
    BOOL bRepaint       // repaint flag
   );      
 

Parameters

hWnd

Identifies the window.

X

Specifies the new position of the left side of the window.

Y

Specifies the new position of the top of the window.

nWidth

Specifies the new width of the window.

nHeight

Specifies the new height of the window.

bRepaint

Specifies whether the window is to be repainted. If this parameter is TRUE, the window receives a WM_PAINT message. If the parameter is FALSE, no repainting of any kind occurs. This applies to the client area, the nonclient area (including the title bar and scroll bars), and any part of the parent window uncovered as a result of moving a child window. If this parameter is FALSE, the application must explicitly invalidate or redraw any parts of the window and parent window that need redrawing.


hope taht helps some#
Regards Barry
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
men xinCEOCommented:
following
0
daniel_cAuthor Commented:
Thanks Barry...
I'll try it first!
0
rwilson032697Commented:
Listening!
0
daniel_cAuthor Commented:
Thanks Barry!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.