关于winapi函数(100分)

  • 主题发起人 主题发起人 土面小生
  • 开始时间 开始时间

土面小生

Unregistered / Unconfirmed
GUEST, unregistred user!
你好!我觉得自己做一个安装程序<br>现在遇到一点小问题<br>我想知道关于得到系统程序组目录的api函数<br>最好是一个将指定文件加入程序组的小程序!谢谢
 
在注册表里找
 
The GetSystemDirectory function retrieves the path of the Windows system directory. The system directory contains such files as Windows libraries, drivers, and font files. <br><br>UINT GetSystemDirectory(<br><br>&nbsp; &nbsp; LPTSTR lpBuffer, // address of buffer for system directory <br>&nbsp; &nbsp; UINT uSize // size of directory buffer <br>&nbsp; &nbsp;); <br>&nbsp;<br><br>Parameters<br><br>lpBuffer<br><br>Points to the buffer to receive the null-terminated string containing the path. This path does not end with a backslash unless the system directory is the root directory. For example, if the system directory is named WINDOWS/SYSTEM on drive C, the path of the system directory retrieved by this function is C:/WINDOWS/SYSTEM. <br><br>uSize<br><br>Specifies the maximum size of the buffer, in characters. This value should be set to at least MAX_PATH. <br><br>&nbsp;<br><br>Return Values<br><br>If the function succeeds, the return value is the length, in characters, of the string copied to the buffer, not including the terminating null character. If the length is greater than the size of the buffer, the return value is the size of the buffer required to hold the path. <br>If the function fails, the return value is zero. To get extended error information, call GetLastError. <br><br>Remarks<br><br>Applications should not create files in the system directory. If the user is running a shared version of Windows, the application does not have write access to the system directory. Applications should create files only in the directory returned by the GetWindowsDirectory function.
 
请问有没有现成的Example呀,这段Help我在Delphi中已经查过了呀,不知道该怎么声明呀
 
Lazy boy! :)<br><br>var SysDir:String;<br>begin<br>&nbsp; SetLength(SysDir,MAX_PATH);<br>&nbsp; GetSystemDirectory(PChar(SysDir),MAX_PATH);<br>end;
 
procedure TForm1.Button1Click(Sender: TObject);<br>var<br>&nbsp; SysDir: array[0..MAX_PATH] of Char; &nbsp; &nbsp;// holds the system directory<br>begin<br>&nbsp; {retrieve the system directory and display it}<br>&nbsp; GetSystemDirectory(SysDir, MAX_PATH);<br>&nbsp; Label1.Caption := StrPas(SysDir)<br>end;<br>
 
我劝你不要做安装程序了。后面的烦麻多着呢。<br>mdac,odbc,bde,vb runtime packet,jet...<br>都比这个问题难得多。<br>安装程序可不是只是简单的拷贝与界面。
 
后退
顶部