gis
gis
管理员
管理员
  • 注册日期2003-07-16
  • 发帖数15951
  • QQ
  • 铜币25345枚
  • 威望15368点
  • 贡献值0点
  • 银元0个
  • GIS帝国居民
  • 帝国沙发管家
  • GIS帝国明星
  • GIS帝国铁杆
阅读:1455回复:2

[分享代码]如何用密码保护你的mxd文档

楼主#
更多 发布于:2004-08-11 08:41

<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>
喜欢0 评分0
GIS麦田守望者,期待与您交流。
wangcheng
路人甲
路人甲
  • 注册日期2004-06-06
  • 发帖数141
  • QQ39308652
  • 铜币110枚
  • 威望0点
  • 贡献值0点
  • 银元0个
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" />
举报 回复(0) 喜欢(0)     评分
gis
gis
管理员
管理员
  • 注册日期2003-07-16
  • 发帖数15951
  • QQ
  • 铜币25345枚
  • 威望15368点
  • 贡献值0点
  • 银元0个
  • GIS帝国居民
  • 帝国沙发管家
  • GIS帝国明星
  • GIS帝国铁杆
2楼#
发布于:2004-08-11 08:45
忘记了说如何使用,只需要把代码拷贝到vba中就ok了
GIS麦田守望者,期待与您交流。
举报 回复(0) 喜欢(0)     评分
游客

返回顶部