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

请帮忙,看问题在哪?

楼主#
更多 发布于:2004-08-10 16:55

在我的程序里,需要监听打开和新建文档事件。声明如下变量:

Private WithEvents m_pDocEvents As esriArcMapUI.DocumentEvents

响应打开和新建文档事件代码如下:

Private Sub m_pDocEvents_NewDocument()     MsgBox "m_pDocEvents_NewDocument" End Sub

Private Sub m_pDocEvents_OpenDocument()     MsgBox "m_pDocEvents_OpenDocument" End Sub

但是在ArcMap打开和新建文档并没有响应以上两个消息!这是为什么,请帮忙看看!!

喜欢0 评分0
默认头像
gis
管理员
管理员
  • 注册日期2003-07-16
  • 发帖数15951
  • QQ
  • 铜币25345枚
  • 威望15368点
  • 贡献值0点
  • 银元0个
  • GIS帝国居民
  • 帝国沙发管家
  • GIS帝国明星
  • GIS帝国铁杆
1楼#
发布于:2004-08-11 15:12

是vba环境里吗,下面这个例子有用

Private Function MxDocument_OpenDocument() As Boolean   Dim strPassword As String

  '设置密码

 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

  ' Use the GUID of the Exit ArcMap command

  pUID.Value = "{119591DB-0255-11D2-8D20-080009EE4E51}"

  ' or you can use the ProgID   ' pUID.Value = "esriCore.MxFileMenuItem"

  pUID.SubType = 10   Set pExit = Application.Document.CommandBars.Find(pUID)   pExit.Execute      End Function

 

GIS麦田守望者,期待与您交流。
举报 回复(0) 喜欢(0)     评分
默认头像
路人甲
路人甲
  • 注册日期2004-05-08
  • 发帖数135
  • QQ
  • 铜币543枚
  • 威望0点
  • 贡献值0点
  • 银元0个
2楼#
发布于:2004-08-11 15:25
不是VBA环境,是动态连接库!
举报 回复(0) 喜欢(0)     评分
默认头像
gis
管理员
管理员
  • 注册日期2003-07-16
  • 发帖数15951
  • QQ
  • 铜币25345枚
  • 威望15368点
  • 贡献值0点
  • 银元0个
  • GIS帝国居民
  • 帝国沙发管家
  • GIS帝国明星
  • GIS帝国铁杆
3楼#
发布于:2004-08-11 16:49
dll必须先定义你用到的对象了
GIS麦田守望者,期待与您交流。
举报 回复(0) 喜欢(0)     评分
默认头像
路人甲
路人甲
  • 注册日期2003-07-30
  • 发帖数79
  • QQ
  • 铜币92枚
  • 威望0点
  • 贡献值0点
  • 银元0个
4楼#
发布于:2004-08-12 10:33
给 m_pDocEvents赋值了吗?
举报 回复(0) 喜欢(0)     评分
默认头像
路人甲
路人甲
  • 注册日期2004-05-08
  • 发帖数135
  • QQ
  • 铜币543枚
  • 威望0点
  • 贡献值0点
  • 银元0个
5楼#
发布于:2004-08-12 13:06
是大海兄提到的问题,呵呵,搞定了,谢谢!上面两位大吓!!
举报 回复(0) 喜欢(0)     评分
默认头像

返回顶部