请问API函数shellexecute的用法? 我最急须用shellexecute!请高手指教! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 这个是VB版的说明..凑和着看一下吧.ShellExecute函数的简单说明【函数】ShellExecute【操作系统】Win9X:YesWinNT:Yes【声明】ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long【说明】 查找与指定文件关联在一起的程序的文件名 【返回值】 Long,非零表示成功,零表示失败。会设置GetLastError 【其它】【参数表】 hwnd ----------- Long,指定一个窗口的句柄,有时候,windows程序有必要在创建自己的主窗口前显示一个消息框 lpOperation ---- String,指定字串“open”来打开lpFlie文档,或指定“Print”来打印它 lpFile --------- String,想用关联程序打印或打开一个程序名或文件名 lpParameters --- String,如lpszFlie是可执行文件,则这个字串包含传递给执行程序的参数 lpDirectory ---- String,想使用的完整路径 nShowCmd ------- Long,定义了如何显示启动程序的常数值。参考ShowWindow函数的nCmdShow参数例:在程序的uses处引用shellapi单元.procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);begin ShellExecute(Handle,'open','www.google.com',nil,nil,SW_SHOWNORMAL);end ShellExecute的功能是运行一个外部程序(或者是打开一个已注册的文件、打开一个目录、打印一个文件等等),并对外部程序有一定的控制。 有几个API函数都可以实现这些功能,但是在大多数情况下ShellExecute是更多的被使用的,同时它并不是太复杂。下面举例说明它的用法。开始一个新的应用程序 ShellExecute(Handle, 'open', PChar('c:\test\app.exe'), nil, nil, SW_SHOW);打开记事本,并打开一个文件(系统能识别记事本应用程序的路径,因此我们不必使用绝对路径) ShellExecute(Handle, 'open', PChar('notepad'), PChar('c:\test\readme.txt'), nil, SW_SHOW);打印一个文档 ShellExecute(Handle, 'print', PChar('c:\test\test.doc'), nil, nil, SW_SHOW); 注意:可能你会看到word暂时的被打开,但它会自动关闭。打开一个HTML页面 ShellExecute(Handle, 'open', PChar('http://www.festra.com/'), nil, nil, SW_SHOW);你能通过一个已经注册的文件类型来打开应用程序 ShellExecute(Handle, 'open', PChar('c:\test\readme.txt'), nil, nil, SW_SHOW);用windows Explorer 打开一个目录 ShellExecute(Handle, 'explore', PChar('c:\windows)', nil, nil, SW_SHOW);运行一个DOS命令并立即返回 ShellExecute(Handle, 'open', PChar('command.com'), PChar('/c copy file1.txt file2.txt'), nil, SW_SHOW);运行一个DOS命令并保持DOS窗口存在 ShellExecute(Handle, 'open', PChar('command.com'), PChar('/k dir'), nil, SW_SHOW); delphi代码 ISA代理验证 递归表中所有字段名,怎么做,请教大家?,还有一个问题:怎么清出cxGrid1DBTableView1的显示 如果将Listview中的内容保存到EXCEL中?? 如何用PC控制灯的亮灭? 高手帮忙dbgrid问题 找东莞市内delphi专家帮助修改程序 如何进行网络udp数据包的发送和接收 在Delphi中如何设置注册表中键值项为只读属性,写属性? 关于PDF文件(高分奉送) xpath的查询条件中不能用中文吗? GG,JJ帮个忙撒!! 呵,刚学DELPHI! 存储过程问题
ShellExecute函数的简单说明
【函数】
ShellExecute
【操作系统】
Win9X:Yes
WinNT:Yes
【声明】
ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
【说明】
查找与指定文件关联在一起的程序的文件名
【返回值】
Long,非零表示成功,零表示失败。会设置GetLastError
【其它】
【参数表】
hwnd ----------- Long,指定一个窗口的句柄,有时候,windows程序有必要在创建自己的主窗口前显示一个消息框
lpOperation ---- String,指定字串“open”来打开lpFlie文档,或指定“Print”来打印它
lpFile --------- String,想用关联程序打印或打开一个程序名或文件名
lpParameters --- String,如lpszFlie是可执行文件,则这个字串包含传递给执行程序的参数
lpDirectory ---- String,想使用的完整路径
nShowCmd ------- Long,定义了如何显示启动程序的常数值。参考ShowWindow函数的nCmdShow参数例:
在程序的uses处引用shellapi单元.procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
ShellExecute(Handle,'open','www.google.com',nil,nil,SW_SHOWNORMAL);
end
ShellExecute(Handle, 'open', PChar('c:\test\app.exe'), nil, nil, SW_SHOW);打开记事本,并打开一个文件(系统能识别记事本应用程序的路径,因此我们不必使用绝对路径)
ShellExecute(Handle, 'open', PChar('notepad'), PChar('c:\test\readme.txt'), nil, SW_SHOW);打印一个文档
ShellExecute(Handle, 'print', PChar('c:\test\test.doc'), nil, nil, SW_SHOW); 注意:可能你会看到word暂时的被打开,但它会自动关闭。打开一个HTML页面
ShellExecute(Handle, 'open', PChar('http://www.festra.com/'), nil, nil, SW_SHOW);你能通过一个已经注册的文件类型来打开应用程序
ShellExecute(Handle, 'open', PChar('c:\test\readme.txt'), nil, nil, SW_SHOW);用windows Explorer 打开一个目录
ShellExecute(Handle, 'explore', PChar('c:\windows)', nil, nil, SW_SHOW);运行一个DOS命令并立即返回
ShellExecute(Handle, 'open', PChar('command.com'), PChar('/c copy file1.txt file2.txt'), nil, SW_SHOW);运行一个DOS命令并保持DOS窗口存在
ShellExecute(Handle, 'open', PChar('command.com'), PChar('/k dir'), nil, SW_SHOW);