我原来是D7在XP下的,如果在文件夹中双击打开工程文件,然后再点D7左上角的打开,候选文件中都是在同一个文件夹内的PAS文件,这样很方便对程序的编辑。现在装在WIN7下后,用同样的方式双击打开工程文件,再点左上角的打开,候选文件是上一次打开的文件夹,这样不得不再寻找当前文件夹的位置再打开文件,很烦,有没有什么方法设置成XP下那种只打开工程文件所在文件夹的内容?
解决方案 »
- 怎么用DELPHI开发系统服务程序
- combobox 怎样设置才能默认全选text啊
- Vista 权限问题
- ListView問題,怎樣讓判斷鼠標移動后,ListView的Item顏色的改變。
- 求教高手:delphi 对msxml接受 中文乱码问题? 急!!!!!!!!!!
- 有关dll子窗体的问题
- 如何锁屏?分不够再加!
- 用鼠标右键单击文件或者文件夹时弹出的那个菜单显示路径??
- 请问哪里有Windows98/2000/Me的繁体中文版下载!
- 一个对于高手和使用过的同志来说比较易的问题,关于关闭程序!!
- MDI的DLL子窗体中怎么实现快捷键功能啊
- 用delphi2010怎么在win7下自定义注册表定位的过程
1.所有已经保存的工程在标题上显示全路径
2.Win 7下调整打开文件对话框的路径为当前项目的路径.首先把 $(DELPHI)\Source\ToolsAPI 加入到搜索搜索路径中,
把以下代码复制到一个单元中并保存为IDEShowPath.pas;
然后点菜单 Component -> Install Component... 弹出的窗口中,Package file name中选择
???\borland\delphi7\Lib\dclusr.dpk,这个是用户自定义包,方便搞的,
然后在Unit file name 一栏中,选择刚才保存的文件IDEShowPath.pas,然后点OK
询问是否重新编译,选择YES,然后关闭Delphi 7,关闭过程中,选择保存 dclusr
重新启动Delphi 7功能实现.//1.在Delphi 7的IDE的主窗口中显示项目全路径
//2.在Win 7下调整打开文件对话框的路径为当前项目路径
//由于使用了固定名称,所以只能在Delphi7中使用,其他版本自行调整
//By 蓝色光芒
unit IDEShowPath;interfaceprocedure Register;implementation{$IFDEF VER150} //只有Delphi 7.0用,其它版本相应调整
Uses
Windows, Messages, Forms, Dialogs, Classes, SysUtils , ToolsAPI;Type
TNotifyOTAObject = class(TNotifierObject, IOTANotifier, IOTAIDENotifier)
protected
procedure FileNotification(NotifyCode: TOTAFileNotification;
const FileName: string; var Cancel: Boolean);
procedure BeforeCompile(const Project: IOTAProject; var Cancel: Boolean); overload;
procedure AfterCompile(Succeeded: Boolean); overload; procedure HwndProc(var Message: TMessage);
end;var
Obj : TNotifyOTAObject;
fOldHwndProc : TWndMethod;
fFileName : String;
liIndex : integer;procedure InitOpenDialogPath(Const Path : String);
var
i : integer;
begin
for i:=0 to Application.MainForm.ComponentCount-1 do begin
if Application.MainForm.Components[i].ClassName='TOpenDialog' then begin
TOpenDialog(Application.MainForm.Components[i]).InitialDir := Path;
Break;
end;
end;
end;procedure SetTextProc(var Message: TMessage);
var
fCaption , FileName : String;
PJ : IOTAProject;
begin
PJ := GetActiveProject;
if PJ<>NIL then FileName := PJ.FileName
else if StrScan(PChar(Message.LParam) , '-')=NIL then FileName := ''
else FileName := fFileName;
if FileName='' then fCaption := 'Delphi 7'
else begin
fCaption := 'Delphi 7 - ' + FileName;
InitOpenDialogPath(ExtractFilePath(FileName));
end;
Message.LParam := integer(fCaption);
fOldHwndProc(Message);
end;{ TNotifyOTAObject }
procedure TNotifyOTAObject.HwndProc(var Message: TMessage);
begin
if Message.Msg=WM_SETTEXT then SetTextProc(Message)
else fOldHwndProc(Message);
end;
procedure TNotifyOTAObject.AfterCompile(Succeeded: Boolean);
begin
end;
procedure TNotifyOTAObject.BeforeCompile(const Project: IOTAProject;var Cancel: Boolean);
begin
end;
procedure TNotifyOTAObject.FileNotification(NotifyCode: TOTAFileNotification;
const FileName: string; var Cancel: Boolean);
begin
if NotifyCode=ofnActiveProjectChanged then
fFileName := FileName;
end;procedure Register;
begin
Obj := TNotifyOTAObject.Create;
fOldHwndProc := Application.MainForm.WindowProc;
Application.MainForm.WindowProc := Obj.HwndProc;
liIndex := (BorlandIDEServices as IOTAServices).AddNotifier(Obj);
end;initialization
finalization
Application.MainForm.WindowProc := fOldHwndProc;
(BorlandIDEServices as IOTAServices).RemoveNotifier(liIndex);
{$ELSE}
procedure Register;
begin
end;
{$ENDIF}
end.
我的测试环境如下:
XPSP3+DELPHI7 测试OK、
WIN7+DELPHI7 测试OK、
1)将打开方式指定即可2)重装安装DELPHI,让DELPHI自己关联一下即可
蓝色光芒