|
阅读:1455回复:2
[分享代码]如何用密码保护你的mxd文档<P>Private Function MxDocument_OpenDocument() As Boolean Dim strPassword As String</P> <P> '设置密码</P> <P> strPassword = "password" Dim strTextEntered As String Dim intAttempts As Integer Do While intAttempts <> 3 strTextEntered = InputBox("Enter the password:") If strPassword = strTextEntered Then MsgBox "You're in...", vbOKOnly, "Welcome!!!" Exit Function ElseIf strPassword <> strTextEntered Then intAttempts = intAttempts + 1 End If Loop MsgBox "Sorry, not today...", vbOKOnly, "Goodbye!!!" Dim pUID As New UID Dim pExit As ICommandItem</P> <P> ' Use the GUID of the Exit ArcMap command</P> <P> pUID.Value = "{119591DB-0255-11D2-8D20-080009EE4E51}"</P> <P> ' or you can use the ProgID ' pUID.Value = "esriCore.MxFileMenuItem"</P> <P> pUID.SubType = 10 Set pExit = Application.Document.CommandBars.Find(pUID) pExit.Execute End Function </P> |
|
|
|
1楼#
发布于:2004-08-11 17:00
<P>好东西。我正好用到。。。</P><img src="images/post/smile/dvbbs/em01.gif" /><img src="images/post/smile/dvbbs/em01.gif" /><img src="images/post/smile/dvbbs/em01.gif" /><img src="images/post/smile/dvbbs/em01.gif" /><img src="images/post/smile/dvbbs/em02.gif" /><img src="images/post/smile/dvbbs/em02.gif" /><img src="images/post/smile/dvbbs/em02.gif" />
|
|
|
2楼#
发布于:2004-08-11 08:45
忘记了说如何使用,只需要把代码拷贝到vba中就ok了
|
|
|