实现桌面地理信息系统ArcView和VB5应用程序之间的通讯
如果已安装VB5 和ArcView,按照下面步骤建立应用程序:?
(1) 启动VB5,建立缺省窗体Form1。?
(2) 在Form1上根据下列属性建立控件,然后放大窗体以便整齐地排列控件。?
ObjectProperty Setting?
Text BoxNametxtDDE?
Command ButtonCaptionSend Request?
NamecmdRequest?
Combo BoxNamecboDocType?
(3) 在Form1的说明部分增加下面代码:?
Const NONE=0, MANUAL=2?
Sub Startup()?
Dim t?
Const DDE_NO_APP=282?
'this will start ArcView if it isn't running?
On Error GoTo FireUp?
txtDDE.LinkMode=NONE'清除DDE链接?
txtDDE.LinkTopic="ArcView|System"'建立对话?
txtDDE.LinkMode=MANUAL'建立人工链接?
Exit Sub?
FireUp:?
If Err=DDENOAPP Then?
ChDir "C:\ARCVIEW2\BIN"?
t=Shell("arcview",1)?
t=DoEvents()?
Resume?
Else?
MsgBox "Unknown error."?
Stop?
End If?
End Sub?
(4) 在FormLoad 事件中增加下列代码:?
Sub FormLoad()?
cboDocType.text=""?
cboDocType.AddItem "View"?
cboDocType.AddItem "Layout"?
cboDocType.AddItem "SEd"?
Startup'调startup 程序?
End Sub?
(5) 在FormUnload 事件中增加下列代码:?
Sub FormUnload (Cancel As Integer)?
txtDDE.LinkMode = NONE'关闭DDE 对话?
End Sub?
(6) 在cboDocTypeClick事件中增加下列代码:?
Sub cboDocTypeClick()?
cmd="av.GetProject.AddDoc("&cboDocType&".make) av.GetProject.GetActive.Get(0)
《实现桌面地理信息系统ArcView和VB5应用程序之间的通讯(第2页)》