我利用关CnShellUtils单元中DisplayContextMenu函数,来显示我需要的右键上下文菜单。
右键上下文菜单显示了,但是其中cut和Copy不起作用。在详细一些就是我选择了一个文件或文件夹,调用DisplayContextMenu函数,右键菜单出来了。点击cut或copy但是在别去paste按钮是灰色不能用。
调用代码如下:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Menus,
Dialogs, StdCtrls, VirtualTrees, ImgList, ExtCtrls, ComCtrls, AppEvnts, CnShellUtils;
type
TForm1 = class(TForm)
btn4: TButton;
btn1: TButton;
procedure btn4Click(Sender: TObject);
procedure btn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses
ShellAPI;
{$R *.dfm}
procedure TForm1.btn4Click(Sender: TObject);
var
pos: TPoint;
begin
GetCursorPos(pos);
pos:= ScreenToClient(pos);
DisplayContextMenu(Self.Handle, 'C:\Documents and Settings\admin\Desktop\????\Everything\', pos);
end;
procedure TForm1.btn1Click(Sender: TObject);
var
pos: TPoint;
begin
GetCursorPos(pos);
pos:= ScreenToClient(pos);
DisplayContextMenu(Self.Handle, 'C:\Documents and Settings\admin\Desktop\????\Everything\Everything-1.2.1.371.exe', pos)
end;
end.
希望cnpack的大侠们给解决一下。