Delphi在Vasta/win 7下获取权限
毕竟Win32程序的开发,Delphi还是有顽强的生命力的。
操作步骤如下:
1.建立 res 文件
建立一个文本文件,名字可以自己起,我这里叫:UAC.manifest,内容:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="requireAdministrator"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
建立文本文件,名为 UAC.rc,内容:
1 24 UAC.manifest
编译成 uac.res 文件,运行:
brcc32 uac.rc -fouac.res
2.在代码中引入
打开项目文件,加入
{$R uac.res}
3.编译程序
这时程序就支持 VISTA 了,在运行的时候,会弹出 WINDOWS 的提示框,询问用户是否允许以管理员身份运行。
通过我自己实践,在Delphi7下面是可以的,但是在Delphi2009下面测试没有通过。
相关文档:
function ListFiles(Dir: String):TStrings;
var
FSearchRec: TSearchRec;
FileList: TStrings;
FindResult: Integer;
begin
if Dir[length(Dir)]<>'\' then Dir:=Dir+'\';
FileList :=TStringList.Create;
FindResult:=FindFirst(Dir+'*.*,faAnyFile+faDirectory,FSearchRec);
while FindRes ......
Delphi的Socket编程要分几步?
2008-12-20 02:03:24
标签:Delphi Socket 编程 [推送到技术圈]
ClientSocket 和ServerSocket
几个重要的属性:
1.client和server都有port属性,需要一致才能互相通信
2.client有Address属性,使用时填写对方(server)的IP地址 & ......
Day 开头的函数
●
Unit
DateUtils
function DateOf(const Avalue: TDateTime): TDateTime;
描述
使用 DateOf 函数用来把一个 TDateTime 类型的变量转变成一个
只带有日期的 TDateTime 类型变量。
例如:
showmessage(DateTimetostr(dateof(now())));
你得到的是 2003/03/19
而 showmessage(Dat ......
bool是LongBool类型。
Delphi中定义了四种布尔类型:Boolean,ByteBool,WordBool和LongBool。后面三种布尔类型是为了与其他语言兼容而引入的,一般情况下建议使用Boolean类型。
这四种类型的布尔值占用内存的数量如下:
Boolean 1 Byte
ByteBool 1 Byte
WordBool 2 Bytes(1 Word)
LongBool 4 Bytes(2 Words)
对 ......