gsl1982
路人甲
路人甲
  • 注册日期2004-05-08
  • 发帖数135
  • QQ
  • 铜币543枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:2294回复:5

请帮忙,看问题在哪?

楼主#
更多 发布于:2004-08-10 16:55
<P>在我的程序里,需要监听打开和新建文档事件。声明如下变量:</P>
<P>Private WithEvents m_pDocEvents As esriArcMapUI.DocumentEvents</P>
<P>响应打开和新建文档事件代码如下:</P>
<P>Private Sub m_pDocEvents_NewDocument()
    MsgBox "m_pDocEvents_NewDocument"
End Sub</P>
<P>Private Sub m_pDocEvents_OpenDocument()
    MsgBox "m_pDocEvents_OpenDocument"
End Sub</P>
<P>但是在ArcMap打开和新建文档并没有响应以上两个消息!这是为什么,请帮忙看看!!</P>
喜欢0 评分0
gsl1982
路人甲
路人甲
  • 注册日期2004-05-08
  • 发帖数135
  • QQ
  • 铜币543枚
  • 威望0点
  • 贡献值0点
  • 银元0个
1楼#
发布于:2004-08-12 13:06
是大海兄提到的问题,呵呵,搞定了,谢谢!上面两位大吓!!
举报 回复(0) 喜欢(0)     评分
大海
路人甲
路人甲
  • 注册日期2003-07-30
  • 发帖数79
  • QQ
  • 铜币92枚
  • 威望0点
  • 贡献值0点
  • 银元0个
2楼#
发布于:2004-08-12 10:33
给 m_pDocEvents赋值了吗?
举报 回复(0) 喜欢(0)     评分
gis
gis
管理员
管理员
  • 注册日期2003-07-16
  • 发帖数15951
  • QQ
  • 铜币25345枚
  • 威望15368点
  • 贡献值0点
  • 银元0个
  • GIS帝国居民
  • 帝国沙发管家
  • GIS帝国明星
  • GIS帝国铁杆
3楼#
发布于:2004-08-11 16:49
dll必须先定义你用到的对象了
GIS麦田守望者,期待与您交流。
举报 回复(0) 喜欢(0)     评分
gsl1982
路人甲
路人甲
  • 注册日期2004-05-08
  • 发帖数135
  • QQ
  • 铜币543枚
  • 威望0点
  • 贡献值0点
  • 银元0个
4楼#
发布于:2004-08-11 15:25
不是VBA环境,是动态连接库!
举报 回复(0) 喜欢(0)     评分
gis
gis
管理员
管理员
  • 注册日期2003-07-16
  • 发帖数15951
  • QQ
  • 铜币25345枚
  • 威望15368点
  • 贡献值0点
  • 银元0个
  • GIS帝国居民
  • 帝国沙发管家
  • GIS帝国明星
  • GIS帝国铁杆
5楼#
发布于:2004-08-11 15:12
<P>是vba环境里吗,下面这个例子有用</P><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><P>
 </P>
GIS麦田守望者,期待与您交流。
举报 回复(0) 喜欢(0)     评分
游客

返回顶部