Go homepage(回首页) Upload pictures (上传图片) Write articles (发文字帖)
The author:(作者)aaapublished in(发表于) 2014/7/19 0:13:11 delphi获取System目录
获取System 目录获取System 目录只需要用一个Win32 函数就能够实现,此函数为GetSystemDirectory,它的原型如下:UINT GetSystemDirectory(LPTSTR lpBuffer, //变量UINT uSize //变量大小);(1)新建一个项目,向窗体上添加一个Edit 组件和一个Button 组件,并设置Button 组件的Caption 属性为“获得”。(2)为“获得”按钮编写代码。procedure TForm1.Button1Click(Sender: TObject);varMySysPath:PChar;beginGetMem(MySysPath,255);GetSystemDirectory(MySysPath,255); //取得系统目录Edit1.Text:=MySysPath;end;
赞