摘要载入中…    请稍等…












内容载入中…    请稍等…

如长时间看不到内容,请关闭浏览器,重新打开此页!

芯友首页 应用软件 编程开发 网络硬件 资源下载 动漫音乐 精美图库 芯友论坛 视频教程 电脑技术QQ群:72845454
 ★★photoshop学友-史上最强播放器★★
 位置:编程开发>Deiphi>Deiphi系统文件
◎→ 本类最新
在DELPHI中映射网络驱动器
在Delphi中实现对目录拷贝、删除
在Delphi中接受文件拖放
在Delphi中定位文件位置
用代码打开屏幕保护
用Delphi编程得到OS的类型
用Delphi编码实现程序自启动
◎→相关资源
C语言入门视频教程
C#编程WinForm入门视频
Asp.net入门视频教程下载
VC++编程视频教程下载
VB窗体文章
HTML入门教程
Deiphi实例教程
Deiphi窗体文章
Deiphi数据库编程
Deiphi网络编程
Deiphi图形图象文章
Deiphi系统文件
◎→ 热门资源
在Delphi7中实现停靠功能
DELPHI中的消息处理机制(1)
用Delphi编制趣味动画鼠标
资源文件的应用
怎样向SQL Server插入带有Image字
支持D6的FastReport2.45 (报表控
只允许建立一次子窗体的MDI程序

在DELPHI中如何调用系统对话框


日期:2008-10-20 22:10:23    来源:
   
 ·简析Delphi中如何进行XML编程 ·Flash调用HTML网页页面
 ·用Delphi获取Windows及系统路径 ·用Delphi实现自定义颜色对话框及其构件

在DELPHI中如何调用系统对话框
  在写程序的时候,有时我们为了省力,或者为了别的目的,我们常常想借用系统的对话框,那么,如何才能调用系统对话框呢?一位朋友是VB中是这样调用“打开方式”对话框的:
winexec(PChar('rundll32 shell32,OpenAs_RunDLL '+FilePath),SW_SHOWDEFAULT);
这句代码是运行rundll32.exe,让它调用shell32.dll中的资源来实现的。方法可行,但是有许多像我一样的菜鸟并不明白如何调用shell32.dll中的宝贵资源,我们应该如何去做呢?
下面说说我是如何调用的:
一、调用系统“About”对话框:
首先在uses中加入SHellApi,
然后写下如下代码:
procedure TForm1.Button1Click(Sender: TObject);
var
shellapp: variant;
begin
ShellAboutW(0,'Timer v1.03','kedy版权所有',1);
end;
其他步骤我不详述。运行后点击button就会弹出标准的WINDOWS关于对话框。对话框标题为"关于Timer v 1.03"。大家可以看到,在程序中我使用了ShellAboutW这个函数。在MSDN2003中这个函数是这样描述的:
ShellAbout Function
Displays a ShellAbout dialog box.
Syntax
int ShellAbout( HWND hWnd,
LPCTSTR szApp,
LPCTSTR szOtherStuff,
HICON hIcon
);
Parameters
hWnd
[in] Window handle to a parent window. This parameter can be NULL.
szApp
[in] Pointer to a null-terminated string containing text that will be displayed in the
title bar of the ShellAbout dialog box and on the first line of the dialog box after the
text "Microsoft". If the text contains a separator (#) dividing it into two parts, the
function displays the first part in the title bar and the second part on the first line
after the text "Microsoft".
szOtherStuff
[in] Pointer to a null-terminated string containing text that will be displayed in the
dialog box after the version and copyright information.
hIcon
[in] Icon that the function displays in the dialog box. If this parameter is NULL, the
function displays the Microsoft? Windows? or Microsoft Windows NT? icon.
什么意思我想不用我来翻译了吧,这些东西自己去看最好。
二、调用关机对话框
我们只要把begin部分代码改为
begin
shellapp := CreateOleObject('Shell.Application');
shellapp.ShutDownWindows;
end;
其他部分不变。运行点击button我们就可以看到标准的系统关机对话框了。
其实这还是调用的WindowsAPI函数shutdownwindows.
这个部分使用的是windows的shell application的method中的两个函数。method其他的函数还有:
BrowseForFolder、CascadeWindows、ControlPanelItem、EjectPC、Explore、FileRun、FindComputer、FindFiles、Help、MinimizeAll、NameSpace、Open、RefreshMenu、SetTime、TileHorizontally、TileVertically、TrayProperties、UndoMinimizeALL。我也只是学会了使用其中的几个函数。详细情况请大家查看MSDN中有关shell object的内容。

我最想说的是,学windows下的程序一定要用MSDN。这个库里的资源让我实在惊叹不已,大家可以看一看,我想你也会这样认为的。

 [1]

简析Delphi中如何进行XML编程(10)

调用XML数据简易教程

百度最近收录量查询系统

用Delphi实现自定义颜色对话框及其构件(1)

--->flashgot for Firefox V0.5.97.02┊可调用多种下载工具插件┊英文绿色特别版
--->OneKey Ghost 11 Y1.2┊对系统所在分区进行备份还原操作┊简体中文绿色免费版
--->多操作系统一键恢复 V5.00┊任何单机及网吧批量硬盘克隆┊简体中文绿色免费版
--->DriverGrabber V0.5.1 Beta1┊可以自动备份现有系统内的驱动┊英文绿色免费版
--->WinRescue XP V1.08.38┊最小巧的Windows系统备份及恢复工具┊英文绿色特别版
Tags:  如何 调用 系统 对话框
{$enumber$}
芯友网版权所有 1999-2006 | 著作权与商标声明 | 法律声明 | 服务条款 | 隐私声明 | 联系我们