Solved

Get windows system directory

Posted on 2004-05-03
3
425 Views
Last Modified: 2012-08-14
How can I retrieve the Windows root directory or the system32 directory?
I've been looking for an API GetSystemRoot or GetWindowsRoot or something like that with no result...
0
Comment
Question by:boeman
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 53

Expert Comment

by:Dhaest
ID: 10975450
Try:
environ("windir")
0
 
LVL 53

Accepted Solution

by:
Dhaest earned 125 total points
ID: 10975457
Or

Option Explicit
Private Declare Function GetSystemDirectory Lib "KERNEL32" Alias "GetSystemDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long

Private Sub Command1_Click()
    Dim strBuf As String

    strBuf = Space$(255)
    GetSystemDirectory strBuf, 255
    strBuf = Left$(strBuf, InStr(strBuf, Chr$(0)) - 1)
    Debug.Print strBuf
End Sub
0
 
LVL 3

Author Comment

by:boeman
ID: 10975535
muchos gracias
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
using Access 8 84
Macro: print each sheet to pdf using ExportAsFixedFormat 11 64
MS Access Search and Replace Using VBA 6 92
Access 2013 combo box not working 3 59
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question