如何调用系统的Find和Run窗口
编号:QA002509
建立日期: 2000年1月29日 最后修改日期:2000年1月29日
所属类别:
王加春:
编程工具: C or Delphi
操作系统: win95/nt
如何调用系统的Find和Run窗口?就象按‘开始’键选择的‘查找’和‘运行’?谢谢。
回答:
显示Find窗口可以调用shell32.dll的第61号函数,该函数没有函数名,只能通过索引号调用(调用方法可以参考QA002080 "如何实现Windows关机的那个对话窗口")。该函数定义如下:
'----------------------------
' The Run dialog via the Start menu
Declare Function SHRunDialog Lib "shell32" Alias "#61" _
(ByVal hOwner As Long, _
ByVal Unknown1 As Long, _
ByVal Unknown2 As Long, _
ByVal szTitle As String, _
ByVal szPrompt As String, _
ByVal uFlags As Long) As Long
' hOwner = Dialog owner, specify 0 for desktop (will be top-level)
' Unknown1 = ?
' Unknown2 = ?, non-zero causes gpf! strings are ok...(?)
' szTitle = Dialog title, specify vbNullString for default ("Run")
' szPrompt = Dialog prompt, specify vbNullString for default ("Type the name...")
例子可以参考
undocsh.zip。
调用查找文件对话框可以使用下面的代码:
procedure TForm1.Button1Click(Sender: TObject);
begin
with TDDEClientConv.Create(Self) do begin
ConnectMode := ddeManual;
ServiceApplication := 'explorer.exe';
SetLink( 'Folders', 'AppProperties');
OpenLink;
ExecuteMacro('[FindFolder(, C:\DOWNLOAD)]', False);
CloseLink;
Free;
end;
end;
此问题由李海回答。
| |
|
|
| |
|
|