Class TPathForm (unit PathExpt) |
Inherits from
TForm
procedure AddBtnClick(Sender: TObject);
procedure DeleteBtnClick(Sender: TObject);
procedure DownBtnClick(Sender: TObject);
procedure EditClick(Sender: TObject);
procedure PathListBoxDragDrop(Sender, Source: TObject; X, Y: Integer);
procedure PathListBoxDragOver(Sender, Source: TObject; X, Y: Integer;
State: TDragState; var Accept: Boolean);
procedure UpBtnClick(Sender: TObject);
procedure DlgSelChanged(Sender: TObject; NewSel: string; NewSelPIDL: PItemIDList);
procedure MyHook (var HookCall: THookCall);
Having prepared a new path string we must now tell Delphi about it directly.
procedure MyWnd (var Msg: TMessage);
AddBtn : TBitBtn;
Bevel1 : TBevel;
Browser : TBrowseDirectoryDlg;
CancelBtn : TBitBtn;
DeleteBtn : TBitBtn;
DownBtn : TBitBtn;
Edit : TBitBtn;
OkBtn : TBitBtn;
PathListBox : TListBox;
UpBtn : TBitBtn;
DlgParent : THandle;
HookProc : pointer;
NewWndProc : pointer;
OldWndProc : pointer;
Path : string;
ThisHook : hHook;
procedure AddBtnClick(Sender: TObject);
procedure DeleteBtnClick(Sender: TObject);
procedure DownBtnClick(Sender: TObject);
procedure EditClick(Sender: TObject);
procedure PathListBoxDragDrop(Sender, Source: TObject; X, Y: Integer);
procedure PathListBoxDragOver(Sender, Source: TObject; X, Y: Integer;
State: TDragState; var Accept: Boolean);
procedure UpBtnClick(Sender: TObject);
procedure DlgSelChanged(Sender: TObject; NewSel: string; NewSelPIDL: PItemIDList);
procedure MyHook (var HookCall: THookCall);
Having prepared a new path string we must now tell Delphi about it directly. This is done by bringing up the Tools/Environment Options dialog box, putting the value in and closing the box programatically. This code will probably be Delphi 3 dependant. // This works in the following way: 1. Locate the Delphi IDE form - called "AppBuilder" 2. On this form (ie the top menu bar in the IDE) locate the ToolsOptionsItem menu item. When clicked this brings up the environment options dialog box. 3. Put a hook into the IDE so we can watch for the appearance of the dialog 4. "Click" the menu item programatically 5. Using the hook, watch for the appearance of the dialog box and when it has been created subclass the dialog box with a new winproc 6. Using the new winproc, watch for the CM_ACTIVATE message to show that the dialog box is ready, when this is seen put find the library path combobox and put our new path into it, then immediately post a CM_DEACTIVATE to the dialog. 7. When the CM_DEACTIVATE is seen set the modal result to mrOk which will close the box. 8. Finally remove the window subclass (probably not needed), and unhook the IDE. 9. This is probably a very clumsy way of doing it but it seems robust.
procedure MyWnd (var Msg: TMessage);
AddBtn : TBitBtn;
Bevel1 : TBevel;
Browser : TBrowseDirectoryDlg;
CancelBtn : TBitBtn;
DeleteBtn : TBitBtn;
DownBtn : TBitBtn;
Edit : TBitBtn;
OkBtn : TBitBtn;
PathListBox : TListBox;
UpBtn : TBitBtn;
DlgParent : THandle;
HookProc : pointer;
NewWndProc : pointer;
OldWndProc : pointer;
Path : string;
ThisHook : hHook;