How To Find the windowssystem directory without using API Calls from Visual Basic

srinivas_gowd
srinivas_gowd used Ask the Experts™
on
Hi all

Can Any body tell me "How to get the windows system directory without using visual basic "


thanks in advantage

Srinivas Gowd

srinivas_gowd@yahoo.co.uk
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2006
Commented:
try
sWinDir = Environ("WINDIR")

Top Expert 2006

Commented:
or in dos

echo %WINDIR%
Ryan ChongSoftware Team Lead

Commented:
Public Const MAX_PATH = 260
Public Declare Function GetSystemDirectory Lib "kernel32" Alias "GetSystemDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long

Public Function GetSystemDir() As String
    Dim strBuffer As String
    Dim lngReturn As Long
    Dim strWindowsSystemDirectory As String
   
    strBuffer = Space$(MAX_PATH)
    lngReturn = GetSystemDirectory(strBuffer, MAX_PATH)
    strWindowsSystemDirectory = Left$(Trim$(strBuffer), Len(Trim$(strBuffer)) - 1)
    GetSystemDir = strWindowsSystemDirectory
End Function
Should you be charging more for IT Services?

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Top Expert 2006

Commented:
to me that is an API call or not ;)
Ryan ChongSoftware Team Lead

Commented:
haha, if not using VB, then code is not applicable. :)
Ryan ChongSoftware Team Lead

Commented:
Accept bruintje's comment as answer
Author of the Year 2009

Commented:
Moderator, my recommended disposition is:

    Accept bruintje's comment(s) as an answer.

DanRollins -- EE database cleanup volunteer

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial