borderAndreaVB free resources for Visual Basic developersborder

AndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2008 Andrea Tincani
:: Returns the Windows '95/NT Directory...

Author  

Tessarollo Livio

Language  

VB5, VB6

Operating Systems  

Windows 95, 98 and NT
API Declarations

Option Explicit

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

Module

'---------------------------------------------
' get Windows '95/NT directory
'---------------------------------------------

Public Function GetWindows() As String
    Dim RetVal As String
    Dim AppName As String
    Dim worked As Long

    RetVal = String$(144, 0)
    worked = GetWindowsDirectory(RetVal, Len(RetVal))
    If worked = 0 Then
        GetWindows = "unknown"
    Else
        GetWindows = Left(RetVal, worked)
    End If
End Function

Usage

'Usage:
Private Sub Command1_Click()
    MsgBox GetWindows()
End Sub

:: Navigation

Home

Files and Disks Tips

Previous Tip

Next Tip

:: Search this site
Google
Partners: Il portale per lui e lei | Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

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