怎样调出Run和Find Computer对话框?(200分)

  • 主题发起人 主题发起人 o*o
  • 开始时间 开始时间
O

o*o

Unregistered / Unconfirmed
GUEST, unregistred user!
在WIN98下用IShellDispatch接口可以调出这两个对话框。
但在WIN95下不好使。请告诉我不用IShellDispatch的调法。

每一个100分。
 
打开查找文件对话框:
ShellExecute(handle,'find','c://',nil, nil,SW_SHOWNORMAL)
 
to cAkk: 不是这个。
 
ShellExecute的verb设为"run","runfile","findcomputer"都不认。
 
习习,肯定不是用的shellexecute. :-)
 
别习习的,你道是说说呀。给点儿思路。
 
你牙!我要是知道,还能憋住不告诉你?
正在查资料呢.
 
//用的是98,不知道95上行不行。
unit RunDialog;

{**********************************************************}
{ }
{ TRunDialog Unit }
{ Copyright ?999 Workshell Software. }
{ }
{ Version 1.0 }
{ }
{ }
{ Web -> http://www.workshell.uni.cc/ }
{ E - Mail -> rundlg@kinsella.u-net.com }
{ }
{**********************************************************}

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;

type
TRunDialog = class(TComponent)
private
{ Private declarations }
FDescription: String;
FHideBrowseButton: Boolean;
FIcon: TIcon;
FInitialDir: String;
FTitle: String;
procedure SetDescription(Value: String);
procedure SetHideBrowseButton(Value: Boolean);
procedure SetIcon(Value: TIcon);
procedure SetInitialDir(Value: String);
procedure SetTitle(Value: String);
protected
{ Protected declarations }
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
public
{ Public declarations }
procedure Execute;
published
{ Published declarations }
property Description: String read FDescription write SetDescription;
property HideBrowseButton: Boolean read FHideBrowseButton write SetHideBrowseButton;
property Icon: TIcon read FIcon write SetIcon;
property InitialDir: String read FInitialDir write SetInitialDir;
property Title: String read FTitle write SetTitle;
end;

var
Flags: LongInt = 0;

const
RFF_NOBROWSE = 1;

procedure Register;

implementation

procedure RunFileDlgA(OwnerWnd: HWND; Icon: HICON; lpstrDirectory: PAnsiChar;
lpstrTitle: PAnsiChar; lpstrDescription: PAnsiChar; Flags: LongInt); stdcall;
external 'Shell32.dll' index 61;

constructor TRunDialog.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FIcon := TIcon.Create;
end;

destructor TRunDialog.Destroy;
begin
FIcon.Free;
inherited Destroy;
end;

procedure TRunDialog.Execute;
begin
if FHideBrowseButton = True then
begin
Flags := Flags or RFF_NOBROWSE;
end;
RunFileDlgA(0,FIcon.Handle,PChar(FInitialDir),PChar(FTitle),PChar(FDescription),Flags);
end;

procedure TRunDialog.SetDescription(Value: String);
begin
if Value <> FDescription then
begin
FDescription := Value;
end;
end;

procedure TRunDialog.SetHideBrowseButton(Value: Boolean);
begin
if Value <> FHideBrowseButton then
begin
FHideBrowseButton := Value;
end;
end;

procedure TRunDialog.SetIcon(Value: TIcon);
begin
if Value <> FIcon then
begin
FIcon.Assign(Value);
end;
end;

procedure TRunDialog.SetInitialDir(Value: String);
begin
if Value <> FInitialDir then
begin
FInitialDir := Value;
end;
end;

procedure TRunDialog.SetTitle(Value: String);
begin
if Value <> FTitle then
begin
FTitle := Value;
end;
end;

procedure Register;
begin
RegisterComponents('Dialogs', [TRunDialog]);
end;

end.
unit FindDialogs;

{**********************************************************}
{ }
{ TFindFilesDialog & TFindComputerDialog Unit }
{ Copyright ?999 Workshell Software. }
{ }
{ Version 1.0 }
{ }
{ }
{ Web -> http://www.workshell.uni.cc/ }
{ E - Mail -> finddlgs@kinsella.u-net.com }
{ }
{**********************************************************}

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ShlObj;

type
TFindFilesDialog = class(TComponent)
private
{ Private declarations }
protected
{ Protected declarations }
public
{ Public declarations }
function Execute: Boolean;
function ExecuteEx(pidlRoot, pidlSavedSearch: PItemIDList): Boolean;
published
{ Published declarations }
end;

type
TFindComputerDialog = class(TComponent)
private
{ Private declarations }
protected
{ Protected declarations }
public
{ Public declarations }
function Execute: Boolean;
function ExecuteEx(pidlRoot, pidlSavedSearch: PItemIDList): Boolean;
published
{ Published declarations }
end;

procedure Register;

implementation

function SHFindFiles(pidlRoot: PItemIDList; pidlSavedSearch: PItemIDList): Boolean;
stdcall; external 'Shell32.dll' index 90;

function SHFindComputer(pidlRoot: PItemIDList; pidlSavedSearch: PItemIDList): Boolean;
stdcall; external 'Shell32.dll' index 91;

function TFindFilesDialog.Execute: Boolean;
begin
Result := SHFindFiles(nil,nil);
end;

function TFindFilesDialog.ExecuteEx(pidlRoot, pidlSavedSearch: PItemIDList): Boolean;
begin
Result := SHFindFiles(pidlRoot,pidlSavedSearch);
end;

function TFindComputerDialog.Execute: Boolean;
begin
Result := SHFindComputer(nil,nil);
end;

function TFindComputerDialog.ExecuteEx(pidlRoot, pidlSavedSearch: PItemIDList): Boolean;
begin
Result := SHFindComputer(pidlRoot,pidlSavedSearch);
end;

procedure Register;
begin
RegisterComponents('Dialogs', [TFindFilesDialog,TFindComputerDialog]);
end;

end.
 
在WIN95下安装IE4或以上, 就可同在Win98中一样使用了.
 
hubdog: 你的代码不能用在win95上吧?

>>在WIN95下安装IE4或以上, 就可同在Win98中一样使用了
win95自己是怎么实现的??????
 
感谢HUBDOG,给你200分。这才是标准的调法。

这几个函数在SHELL32.DLL中没有NAME,只有INDEX。
我用EXESCOPE查看SHELL32.DLL的EXPORT,发现有很多无名函数,
想必都很有用。
谁能告诉我它们的调法,给500分。
 
hehe,o*o我又发现10几个shell32.dll未公开的的调用,是关于ishellfolder的
若你想知道,告诉我。
 
hubdog,谢谢,邮件收到,请到外面领200分。
 
后退
顶部