人生是一场不能存盘的RPG,我只能尽量多搞几个Screenshot

May 15, 2006

得到windows安装路径

Filed under: Code snippets

方法1 使用API

Private Declare Function GetWindowsDirectory Lib "kernel32.dll" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
 
‘ Return values as C:\Windows or <Driver>:\Windows
Public Function GetTheWindowsDirectory() As String
    Dim strWindowsDir As String        ‘ Variable to return the path of Windows Directory
    strWindowsDir = Space(250)         ‘ Initilize the buffer to receive the string
    GetWindowsDirectory(strWindowsDir, 250) ‘ Read the path of the windows directory
    Return strWindowsDir
End Function
   
方法2
Environment.GetEnvironmentVariable("windir")

Comments »

The URI to TrackBack this entry is: http://recordsome.blogsome.com/2006/05/15/p25/trackback/

No comments yet.

RSS feed for comments on this post.

Leave a comment

Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>



Anti-spam measure: please retype the above text into the box provided.






















Get free blog up and running in minutes with Blogsome
Theme designed by Hadley Wickham