borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (E-Mail Address Validation) New Topic New Poll Post Reply
AndreaVB Forum : Frequently Asked Questions : Windows Path
Poster Message
m_carryme
Level: Guest


icon Windows Path

Hi pals,

How can I get Windows path, Fonts path, etc. in VB?

Thanks.

15-02-2003 at 03:33 PM
| Quote Reply
JLRodgers
Level: Moderator

Registered: 04-04-2002
Posts: 1616
icon Re: Windows Path

There's numerous things you can find, some are based on other values, but these are common ones (that I found easily:


Private Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long

Private Declare Function GetAllUsersProfileDirectory Lib "userenv.dll" Alias "GetAllUsersProfileDirectoryA" (ByVal lpProfileDir As String, lpcchSize As Long) As Boolean

Private Declare Function GetDefaultUserProfileDirectory Lib "userenv.dll" Alias "GetDefaultUserProfileDirectoryA" (ByVal lpProfileDir As String, lpcchSize As Long) As Boolean

Private Declare Function GetProfilesDirectory Lib "userenv.dll" Alias "GetProfilesDirectoryA" (ByVal lpProfileDir As String, lpcchSize As Long) As Boolean

Private Declare Function GetUserProfileDirectory Lib "userenv.dll" Alias "GetUserProfileDirectoryA" (ByVal hToken As Long, ByVal lpProfileDir As String, lpcchSize As Long) As Boolean

Private Sub Main()
    Dim WinDir As String
    WinDir = String(256, 0)
    GetWindowsDirectory WinDir, Len(WinDir)
    
    Debug.Print Left(WinDir, InStr(1, WinDir, Chr(0)))
End Sub




[Edited by JLRodgers on 15-02-2003 at 11:54 AM GMT]

____________________________
Everywhere's Local (classifieds, job postings, & more for everycity in the world - user entered)

15-02-2003 at 05:53 PM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
AndreaVB Forum : Frequently Asked Questions : Windows Path
Previous Topic (E-Mail Address Validation) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder