Good point "rstrandmark". Realy, Tony.... Come on. Its not because AutoCAD doesn't do something that its not possible or not worth doing.... I expected a bit more of an open mind from you!
Since our drawings are not DWGs themselfs, but dynamicly generated drawings from a DB that are simply outputed to DWG for backup reasons, it makes perfect sence to do what I am doing. The user never directly opens a DWG (he doesn't even know that there is a DWG), thus modification rights must be handled directly at the user's input. OS restrictions are completly obsolete in this case.
I got it to work pretty well.
If you care to know how, here it is.
[code]
Public Sub HandleBeginCommand(CommandName As String)
On Error GoTo ErrorHandler
Dim vAnnCommandName As String
If UCase$(Left$(CommandName, 7)) <> "-VBARUN" Then
If CI_CurrentWindowSession.UserHasModificationRights() = False Then
vAnnCommandName = CommandName
vAnnCommandName = Replace(vAnnCommandName, "_", "")
vAnnCommandName = Replace(vAnnCommandName, "-", "")
vAnnCommandName = Replace(vAnnCommandName, ".", "")
vAnnCommandName = UCase$(vAnnCommandName)
If mROCommandsToBeUndoed.Exists(vAnnCommandName) = True Then
Ci_ThisDrawing.SendCommand Chr(27) & "U" & vbCr
ElseIf mAllowedROCommands.Exists(vAnnCommandName) = False Then
Ci_ThisDrawing.SendCommand Chr(27) & Chr(27)
End If
End If
End If
Exit Sub
ErrorHandler:
'-------------------------Error Handler---------------------------------
iFM_ErrHandler.AppendParent "Ci_GraphicalInterface", "HandleBeginCommand", Erl
iFM_ErrHandler.CreateSystemMessage True
'-------------------------Error Handler---------------------------------
End Sub
Private Sub BuildROCommandList()
On Error GoTo ErrorHandler
'This sub builds a list of all commands that are available in a
''drawing that is read only (User Does Not Have Modification Rights)
''and all commands that need to be UNDOed in Read-Only mode
Set mAllowedROCommands = New Dictionary
mAllowedROCommands.Add "PURGE", ""
mAllowedROCommands.Add "PAN", ""
mAllowedROCommands.Add "ZOOM", ""
mAllowedROCommands.Add "LAYERP", ""
mAllowedROCommands.Add "LAYMCUR", ""
mAllowedROCommands.Add "LAYER", ""
mAllowedROCommands.Add "LAYWALK", ""
mAllowedROCommands.Add "LAYISO", ""
mAllowedROCommands.Add "LAYVPI", ""
mAllowedROCommands.Add "LAYUNISO", ""
mAllowedROCommands.Add "LAYOFF", ""
mAllowedROCommands.Add "LAYON", ""
mAllowedROCommands.Add "LAYFRZ", ""
mAllowedROCommands.Add "LAYTHW", ""
mAllowedROCommands.Add "LAYLCK", ""
mAllowedROCommands.Add "LAYULK", ""
mAllowedROCommands.Add "DIST", ""
Set mROCommandsToBeUndoed = New Dictionary
mROCommandsToBeUndoed.Add "E", ""
mROCommandsToBeUndoed.Add "ERASE", ""
mROCommandsToBeUndoed.Add "X", ""
mROCommandsToBeUndoed.Add "EXPLODE", ""
Exit Sub
ErrorHandler:
'-------------------------Error Handler---------------------------------
iFM_ErrHandler.Handle "Ci_GraphicalInterface", "BuildROCommandList", Erl
'-------------------------Error Handler---------------------------------
End Sub
[/code]
You oubviously need to call the BuildROCommandList before. But this has a pretty good look and feel.
......
And please Tony, keep unconstructive comments to yourself. You did not need to attack me and tell me I am waisting someone's money. Mabee just letting me know of the normal way to manage drawing access rights TO SEE IF IT WOULD MATCH MY REQUIREMENTS......
It is why we are AutoCAD customizers... to do what AutoCAD CANNOT do, no?
Sorry Tony but I had to say this.
No hard feelings?