1. You can programmatically create a *.WMS in the format that appears below, and fill the respective information for your server and layer.
2. Use IObjectManager.CreateImageryLayer with this file to add any WMS layer
*.WMS (text) file format:
[INFO]
Meters=0
MPP=0.17578125
Url=http://wms.jpl.nasa.gov/wms.cgi?request=GetMap&Version=1.1.1&Service=WMS&SRS=EPSG:4326&BBOX=-180,-90,180,90&HEIGHT=128&WIDTH=256&Layers=global_mosaic&Styles=pseudo&Format=image/png
xul=-180
ylr=-90
xlr=180
yul=90
vb代码实现
x1=-180
y1=90
x2=180
y2=-90
LayerName = "XXX"
set om=TerraExplorer.Interface("IObjectManager5")
wmsFile = _
"[INFO]" & vbNewLine &_
"Meters=0" & vbNewLine &_
"MPP=2.68220901489258E-06" & vbNewLine &_
"Url=http://god2.skyline.co.il:81/wmsproxy/wmsproxy.ashx?request=GetMap&Version=1.1.1&Service=WMS&SRS=EPSG:4326&BBOX=0,0,0,0&HEIGHT=0&WIDTH=0&Layers=CAM_3D_wgs84_15cm.mpt&Styles=&Format=image/jpeg" & vbNewLine &_
"xul=-180" & vbNewLine &_
"ylr=-90" & vbNewLine &_
"xlr=180" & vbNewLine &_
"yul=90" & vbNewLine
msgbox wmsFile
om.CreateImageryLayer LayerName ,x1,y1,x2,y2,"<EXT><ExtInfo><![CDATA[" & wmsFile & "]]></ExtInfo><ExtType>wms</ExtType></EXT>","gisplg.rct",0,LayerName