First commit 19/07/1998

This commit is contained in:
2021-09-12 21:54:38 +02:00
commit b0116562cd
106 changed files with 16717 additions and 0 deletions

Binary file not shown.

View File

@ -0,0 +1,18 @@
Allows switching between open delphi applications and/or lauching (any) application
Note: App to Switch too must have TActivateApp component
two Methods: 1) ActivateApp - Switch to open App, if App Closed Then Launch It
2) ExecuteApp - Launch App
one Event: 1) BeforeLaunchApp - Allows one to discontinue Lauching of app when
ActivateApp senses app to switch to is not open, does not stop
launching of app when execute method used.
Properties: 1) MainFormTitle - Title On Main form of Application to Activate when
using AppActivate Method only. IF An MDI Application then included the
FULL title displayed on the titlebar of the main form
2) ExePath - Full path to executable including Exe name and any parameters
Used by both ActivateApp & Execute App
Freeware Use & Abuse
Author: Edward de la Rey
edwardr@mailbox.ru.ac.za
USE AT OWN RISK
For Delphi 1,2,3 Will Automatically pickup the correct DCR File,
D16 is for Delphi1, D32 for Delphi 2&3, Don't rename them.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,62 @@
// Borland C++ Builder
// Copyright (c) 1995, 1998 by Borland International
// All rights reserved
// (DO NOT EDIT: machine generated header) 'ActivApp.pas' rev: 3.00
#ifndef ActivAppHPP
#define ActivAppHPP
#include <Forms.hpp>
#include <Classes.hpp>
#include <SysUtils.hpp>
#include <Messages.hpp>
#include <Windows.hpp>
#include <SysInit.hpp>
#include <System.hpp>
//-- user supplied -----------------------------------------------------------
namespace Activapp
{
//-- type declarations -------------------------------------------------------
typedef void __fastcall (__closure *TMYParamEvent)(System::TObject* Sender, bool &Continue);
typedef void __fastcall (__closure *TSuccess)(System::TObject* Sender, bool Result);
class DELPHICLASS TActivApp;
class PASCALIMPLEMENTATION TActivApp : public Classes::TComponent
{
typedef Classes::TComponent inherited;
private:
System::AnsiString GetAppToActivate;
System::AnsiString GetExePath;
TMYParamEvent EBeforeLaunchApp;
void __fastcall SetAppToActivate(System::AnsiString Value);
void __fastcall SetExePath(System::AnsiString Value);
protected:
void __fastcall ShowYourSelf(tagMSG &Msg, bool &Handled);
__published:
__fastcall virtual TActivApp(Classes::TComponent* AOwner);
void __fastcall ActivateApp(void);
void __fastcall ExecuteApp(bool Success);
__property System::AnsiString MainFormTitle = {read=GetAppToActivate, write=SetAppToActivate};
__property System::AnsiString ExePath = {read=GetExePath, write=SetExePath};
__property TMYParamEvent BeforeLaunchApp = {read=EBeforeLaunchApp, write=EBeforeLaunchApp};
public:
/* TComponent.Destroy */ __fastcall virtual ~TActivApp(void) { }
};
//-- var, const, procedure ---------------------------------------------------
#define WM_ShowYourSelf (Word)(1426)
extern PACKAGE void __fastcall Register(void);
} /* namespace Activapp */
#if !defined(NO_IMPLICIT_NAMESPACE_USE)
using namespace Activapp;
#endif
//-- end unit ----------------------------------------------------------------
#endif // ActivApp

View File

@ -0,0 +1,144 @@
unit ActivApp;
{ Allows switching between open delphi applications and/or lauching (any) application
Note: App to Switch too must have TActivateApp component
two Methods: 1) ActivateApp - Switch to open App, if App Closed Then Launch It
2) ExecuteApp - Launch App
one Event: 1) BeforeLaunchApp - Allows one to discontinue Lauching of app when
ActivateApp senses app to switch to is not open, does not stop
launching of app when execute method used.
Properties: 1) MainFormTitle - Title On Main form of Application to Activate when
using AppActivate Method only. IF An MDI Application then included the
FULL title displayed on the titlebar of the main form
2) ExePath - Full path to executable including Exe name and any parameters
Used by both ActivateApp & Execute App
Freeware Use & Abuse
Author: Edward de la Rey
edwardr@mailbox.ru.ac.za
USE AT OWN RISK
For Delphi 1,2,3 Will Automatically pickup the correct DCR File,
D16 is for Delphi1, D32 for Delphi 2&3, Don't rename them.}
interface
{$IFDEF WIN32}
uses
Windows, Messages, SysUtils, Classes, Forms;
{$ELSE}
uses
SysUtils, WinTypes, WinProcs, Messages, Classes, Forms;
{$ENDIF}
const
WM_ShowYourSelf = WM_USER + 402;
type
TMYParamEvent = Procedure (Sender:TObject;var Continue:Boolean) of object;
TSuccess = Procedure (Sender:TObject;Result:Boolean) of object;
TActivApp = class(Tcomponent)
private
GetAppToActivate:String;
GetExePath:String;
EBeforeLaunchApp:TMYParamEvent;
Procedure SetAppToActivate(Value:String);
Procedure SetExePath(Value:String);
protected
{ Protected declarations }
procedure ShowYourSelf(var Msg: TMsg; var Handled: Boolean);
public
{ Public declarations }
published
Constructor Create(AOwner: TComponent); override;
Procedure ActivateApp;
Procedure ExecuteApp (Success:Boolean);
Property MainFormTitle:String Read GetAppToActivate Write SetAppToActivate;
Property ExePath:String Read GetExePath Write SetExePath;
Property BeforeLaunchApp:TMYParamEvent Read EBeforeLaunchApp Write EBeforeLaunchApp;
end;
procedure Register;
implementation
{$IFDEF WIN32}
{$R *.D32}
{$ELSE}
{$R *.D16}
{$ENDIF}
constructor TActivApp.Create(AOwner: TComponent);
begin
INHERITED CREATE(Aowner);
GetAppToActivate:='MyOtherApp';
GetExePath:=ExtractFilePath(application.ExeName);
if not (csDesigning in ComponentState) then
Application.OnMessage:=ShowYourSelf;
End;
procedure TActivApp.ShowYourSelf(var Msg: TMsg; var Handled: Boolean);
begin
{This procedure handles messages sent from other Apps}
Handled:=false;
if msg.message = WM_ShowYourSelf then
begin
Application.Restore;
application.BringToFront;
Handled:=true;
end;
End;
Procedure TActivApp.ExecuteApp(Success:Boolean);
Var
It:PChar;
Ans:integer;
begin
it:=Stralloc ((length(GetExePath))+2);
strPCopy(It,GetExePath);
Ans:=WinExec(It,SW_SHOW);
strDispose(it);
Success:= Ans > 31;
end;
procedure TActivApp.ActivateApp;
Var
it,AppToActiv:PChar;
MyHandle:HWnd;
Success:Integer;
Continue:Boolean;
begin
AppToActiv:=Stralloc ((length(GetAppToActivate))+2);
strPCopy(AppToActiv,GetAppToActivate);
MyHandle := FindWindow(nil,AppToActiv);
strDispose(ApptoActiv);
if MyHandle <> 0 then begin
PostMessage(MyHandle,WM_ShowYourSelf,0,0); {Unminimize and bring to front}
{nb Must use PostMessage Only}
end {My Handle <> 0}
else begin
Continue:=true;
If Assigned(EBeforeLaunchApp) Then EBeforeLaunchApp(Self,Continue);
if Continue Then begin
it:=Stralloc ((length(GetExePath))+2);
strPCopy(It,GetExePath);
Success:=WinExec(It,SW_SHOW);
strDispose(it);
end; {Continue}
end;{Else MyHAndle = 0}
end;
procedure TActivApp.SetAppToActivate (Value:String);
begin
GetAppToActivate:=Value;
end;
procedure TActivApp.SetExePath (Value:String);
begin
GetExePath:=Value;
end;
procedure Register;
begin
RegisterComponents('Freeware', [TActivApp]);
end;
end.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,26 @@
// Borland C++ Builder
// Copyright (c) 1995, 1998 by Borland International
// All rights reserved
// (DO NOT EDIT: machine generated header) 'CloseApp.pas' rev: 3.00
#ifndef CloseAppHPP
#define CloseAppHPP
#include <Windows.hpp>
#include <SysInit.hpp>
#include <System.hpp>
//-- user supplied -----------------------------------------------------------
namespace Closeapp
{
//-- type declarations -------------------------------------------------------
//-- var, const, procedure ---------------------------------------------------
extern PACKAGE void __fastcall CloseAppFromInst(int HInst);
} /* namespace Closeapp */
#if !defined(NO_IMPLICIT_NAMESPACE_USE)
using namespace Closeapp;
#endif
//-- end unit ----------------------------------------------------------------
#endif // CloseApp

View File

@ -0,0 +1,34 @@
unit CloseApp;
{ By Duncan McNiven, duncan.mcniven@lecs.inet.fi }
{ Comments by Brad Stowers, bstowers@pobox.com }
interface
uses WinTypes;
procedure CloseAppFromInst(HInst: THandle);
implementation
uses WinProcs, Messages;
{ Callback function that has each top-level window passed to it. }
{ Return true to continue enumerating, false to stop. }
function EnumWindowsProc(Handle: HWND; Info: Pointer): boolean; export;
begin
Result := TRUE; { continue enumeration }
{ Does this app have the same instance as what we are looking for? }
if GetWindowWord(Handle, GWL_HINSTANCE) = LongInt(Info) then begin
PostMessage(Handle, WM_CLOSE, 0, 0); { Close the app }
Result := FALSE; { stop enumerating windows, we are done. }
end;
end;
procedure CloseAppFromInst(HInst: THandle);
begin
EnumWindows(@EnumWindowsProc, LongInt(HInst));
end;
end.