elizarrj
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.
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.
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
print out what is err.number and err.description