我做了一个简单的dll 可是 在arcmap中却不能用 提示 no new object added
看来我的代码有问题 代码如下
Implements ITool
Implements ICommand
Private pApp As IApplication
Private pBitmap As IPictureDisp
Private pMxdoc As IMxDocument
Private bInUse As Boolean
Private pEnvFeedBack As INewEnvelopeFeedbackPrivate Sub Class_Initialize()
Set pBitmap = LoadResPicture(101, vbResBitmap)
bInUse = False
End SubPrivate Property Get ICommand_Bitmap() As esriCore.OLE_HANDLE
ICommand_Bitmap = pBitmap.Handle
End PropertyPrivate Property Get ICommand_Caption() As String
ICommand_Caption = "点击"
End PropertyPrivate Property Get ICommand_Category() As String
ICommand_Category = "ao tools"
End PropertyPrivate Property Get ICommand_Checked() As Boolean
ICommand_Checked = FalseEnd PropertyPrivate Property Get ICommand_Enabled() As Boolean
ICommand_Enabled = True
End PropertyPrivate Property Get ICommand_HelpContextID() As Long
ICommand_HelpContextID = 0
End PropertyPrivate Property Get ICommand_HelpFile() As String
ICommand_HelpFile = ""
End PropertyPrivate Property Get ICommand_Message() As String
ICommand_Message = "dainji chanxun"
End PropertyPrivate Property Get ICommand_Name() As String
ICommand_Name = "shuxing chaxun "
End PropertyPrivate Sub ICommand_OnClick()End SubPrivate Sub ICommand_OnCreate(ByVal hook As Object)
Set pApp = hook
Set pMxdoc = pApp.Document
End SubPrivate Property Get ICommand_Tooltip() As StringEnd PropertyPrivate Property Get ITool_Cursor() As esriCore.OLE_HANDLE
Dim pcursor As IPictureDisp
Set pcursor = LoadPicture(101, vbResCursor)
itoolc_ursor = pcursor.HandleEnd PropertyPrivate Function ITool_Deactivate() As Boolean
ITool_Deactivate = True
End FunctionPrivate Function ITool_OnContextMenu(ByVal X As Long, ByVal Y As Long) As BooleanEnd FunctionPrivate Sub ITool_OnDblClick()
MsgBox "3232asdf"
End SubPrivate Sub ITool_OnKeyDown(ByVal keyCode As Long, ByVal Shift As Long)End SubPrivate Sub ITool_OnKeyUp(ByVal keyCode As Long, ByVal Shift As Long)End SubPrivate Sub ITool_OnMouseDown(ByVal Button As Long, ByVal Shift As Long, ByVal X As Long, ByVal Y As Long)
MsgBox 232343
End SubPrivate Sub ITool_OnMouseMove(ByVal Button As Long, ByVal Shift As Long, ByVal X As Long, ByVal Y As Long)End SubPrivate Sub ITool_OnMouseUp(ByVal Button As Long, ByVal Shift As Long, ByVal X As Long, ByVal Y As Long)End SubPrivate Sub ITool_Refresh(ByVal hDC As esriCore.OLE_HANDLE)End Sub
看来我的代码有问题 代码如下
Implements ITool
Implements ICommand
Private pApp As IApplication
Private pBitmap As IPictureDisp
Private pMxdoc As IMxDocument
Private bInUse As Boolean
Private pEnvFeedBack As INewEnvelopeFeedbackPrivate Sub Class_Initialize()
Set pBitmap = LoadResPicture(101, vbResBitmap)
bInUse = False
End SubPrivate Property Get ICommand_Bitmap() As esriCore.OLE_HANDLE
ICommand_Bitmap = pBitmap.Handle
End PropertyPrivate Property Get ICommand_Caption() As String
ICommand_Caption = "点击"
End PropertyPrivate Property Get ICommand_Category() As String
ICommand_Category = "ao tools"
End PropertyPrivate Property Get ICommand_Checked() As Boolean
ICommand_Checked = FalseEnd PropertyPrivate Property Get ICommand_Enabled() As Boolean
ICommand_Enabled = True
End PropertyPrivate Property Get ICommand_HelpContextID() As Long
ICommand_HelpContextID = 0
End PropertyPrivate Property Get ICommand_HelpFile() As String
ICommand_HelpFile = ""
End PropertyPrivate Property Get ICommand_Message() As String
ICommand_Message = "dainji chanxun"
End PropertyPrivate Property Get ICommand_Name() As String
ICommand_Name = "shuxing chaxun "
End PropertyPrivate Sub ICommand_OnClick()End SubPrivate Sub ICommand_OnCreate(ByVal hook As Object)
Set pApp = hook
Set pMxdoc = pApp.Document
End SubPrivate Property Get ICommand_Tooltip() As StringEnd PropertyPrivate Property Get ITool_Cursor() As esriCore.OLE_HANDLE
Dim pcursor As IPictureDisp
Set pcursor = LoadPicture(101, vbResCursor)
itoolc_ursor = pcursor.HandleEnd PropertyPrivate Function ITool_Deactivate() As Boolean
ITool_Deactivate = True
End FunctionPrivate Function ITool_OnContextMenu(ByVal X As Long, ByVal Y As Long) As BooleanEnd FunctionPrivate Sub ITool_OnDblClick()
MsgBox "3232asdf"
End SubPrivate Sub ITool_OnKeyDown(ByVal keyCode As Long, ByVal Shift As Long)End SubPrivate Sub ITool_OnKeyUp(ByVal keyCode As Long, ByVal Shift As Long)End SubPrivate Sub ITool_OnMouseDown(ByVal Button As Long, ByVal Shift As Long, ByVal X As Long, ByVal Y As Long)
MsgBox 232343
End SubPrivate Sub ITool_OnMouseMove(ByVal Button As Long, ByVal Shift As Long, ByVal X As Long, ByVal Y As Long)End SubPrivate Sub ITool_OnMouseUp(ByVal Button As Long, ByVal Shift As Long, ByVal X As Long, ByVal Y As Long)End SubPrivate Sub ITool_Refresh(ByVal hDC As esriCore.OLE_HANDLE)End Sub
可以 直接用 而不是 再次编程
Set pApp = hook
Set pMxdoc = pApp.Document
End Sub在里的hook你是怎么传进来的?
Implements ICommandITool和ICommand
的类怎么写的?
如果那里也没有接口你的DLL怎么用?