Unit ShowTwoWindowsExplorer;
Interface
Uses
Windows, Messages, SysUtils, Classes, Controls, Forms, ShellApi;
Type
TForm1 =
Class(TForm)
Procedure FormCreate(Sender: TObject);
Procedure FormActivate(Sender: TObject);
Procedure FormShow(Sender: TObject);
Private
Procedure WMSysCommand(
Var Message: TWMSysCommand);
Message WM_SysCommand;
End;
Var
Form1: TForm1;
Implementation
{$R *.dfm}
// Yes, this is optional or certainly overkill... hahaha...
Procedure TForm1.WMSysCommand(
var Message: TWMSysCommand);
Begin
Try
If Message.CmdType
And $FFF0 = SC_MINIMIZE
Then
Form1.Hide
Else
Inherited;
Except
Exit;
End;
End;
Procedure TForm1.FormCreate(Sender: TObject);
Var hwnd_Explorer : HWND;
Begin
Try
Form1.Height := 1;
Form1.Width := 1;
Form1.Top := 0;
Form1.Left := 0;
Form1.AlphaBlend := True;
Form1.AlphaBlendValue := 0;
If DirectoryExists('
I:\')
Then
Begin
ShellExecute(Form1.Handle,
Nil, PChar('
I:\MARTIN\(DOWNLOADS)'),
Nil,
Nil, SW_SHOW);
hwnd_Explorer := FindWindow(
Nil, '
I:\MARTIN\(DOWNLOADS)');
MoveWindow(hwnd_Explorer, 0, 0, (Screen.Width
div 2), Screen.WorkAreaHeight, True);
SetWindowPos(hwnd_Explorer, HWND_NOTOPMOST,0,0,0,0, SWP_NOSIZE);
ShellExecute(Form1.Handle,
Nil, PChar('
I:\MARTIN'),
Nil,
Nil, SW_SHOW);
hwnd_Explorer := FindWindow(
Nil, '
I:\MARTIN');
MoveWindow(hwnd_Explorer, (Screen.Width
div 2), 0, (Screen.Width
div 2), Screen.WorkAreaHeight, True);
SetWindowPos(hwnd_Explorer, HWND_NOTOPMOST,0,0,0,0, SWP_NOSIZE);
End
Else
Begin
ShellExecute(Form1.Handle,
Nil, PChar('
C:\'),
Nil,
Nil, SW_SHOW);
hwnd_Explorer := FindWindow(
Nil, '
C:\');
MoveWindow(hwnd_Explorer, 0, 0, (Screen.Width
div 2), Screen.WorkAreaHeight, True);
SetWindowPos(hwnd_Explorer, HWND_NOTOPMOST,0,0,0,0, SWP_NOSIZE);
ShellExecute(Form1.Handle,
Nil, PChar('
D:\'),
Nil,
Nil, SW_SHOW);
hwnd_Explorer := FindWindow(
Nil, '
D:\');
MoveWindow(hwnd_Explorer, (Screen.Width
div 2), 0, (Screen.Width
div 2), Screen.WorkAreaHeight, True);
SetWindowPos(hwnd_Explorer, HWND_NOTOPMOST,0,0,0,0, SWP_NOSIZE);
End;
Except
Exit;
End;
End;
Procedure TForm1.FormShow(Sender: TObject);
Var Owner: HWND;
Begin
Try
Owner := GetWindow(Form1.Handle, GW_OWNER);
ShowWindow(Owner, SW_HIDE);
Except
Exit;
End;
End;
Procedure TForm1.FormActivate(Sender: TObject);
Begin
Try
Close;
Except
FreeAndNil(Form1);
Exit;
End;
End;
End.