Link to home
Start Free TrialLog in
Avatar of elizarrj
elizarrjFlag for United States of America

asked on

Unable to device as Administrator

I have a weird issue. I have created a program that maps a drive to a folder using DefineDosDevice.  The program works great as a standard user.  I see the folder with the appropriate drive letter.  Once I run the program as an administrator it won;t map the folder.  Here is the function that does the work.

Private Function CreateDevice(DeviceName As String, PathName As String) As String
    If DefineDosDevice(0, DeviceName, PathName) = 0 Then
        MsgBox "Unable to create device " & DeviceName, vbCritical
        CreateDevice = vbNullString
    Else
        CreateDevice = DeviceName
        DoEvents
    End If
End Function

How can I make it work as a standard user and a Administrator.  Thanks.
Avatar of EDDYKT
EDDYKT
Flag of Canada image

what is an error?
print out what is err.number and err.description
Avatar of elizarrj

ASKER

No error is generated. It just does not map the drive when running the program in administor mode.  It does map a drive when run as non administrator.  I did verify that the folder is correct under both scenerios.
SOLUTION
Avatar of EDDYKT
EDDYKT
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial