阅读:4979回复:11
VC+MO to Create BufferMy work. Hope that it can help you. The Function is as follows: vector |
|
|
1楼#
发布于:2004-10-10 17:29
不用CComVariant用COleVariant不行吗? 我用CComVariant为什么说未定义? 俺还是个初学者,请多指教!先行谢过 |
|
2楼#
发布于:2004-10-11 09:49
我的代码是这样写的 CMoLine l; CMoLine g_searchLine; l=m_Map.TrackLine(); if(LPDISPATCH(l)) g_searchLine = l; CMoPolygon shpBuffer; VARIANT va; VariantInit(;va); va.vt=VT_DISPATCH; va.pdispVal=g_searchLine.GetExtent().m_lpDispatch; shpBuffer=g_searchLine.Buffer(100,va); 为什么执行到最后一句shpBuffer=g_searchLine.Buffer(100,va);总是出错?还请多多指教 |
|
3楼#
发布于:2004-10-11 11:37
![]() ![]() ![]() |
|
|
4楼#
发布于:2004-10-11 14:42
以下是引用mao__mao_在2004-10-10 17:29:24的发言:
不用CComVariant用COleVariant不行吗? 我用CComVariant为什么说未定义? 俺还是个初学者,请多指教!先行谢过
#include then you can use CComVariant you can see MSDN , to search CComVairant ,then you will find: CComVariant ClassSee AlsoRequirementsHeader: atlcomcli.h This class wraps the VARIANT type, providing a member indicating the type of data stored. class CComVariant : public tagVARIANT RemarksCComVariant wraps the CComVariant derives from the VARIANT type so it can be used wherever a VARIANT can be used. You can, for example, use the V_VT macro to extract the type of a CComVariant or you can access the vt member directly just as you can with a VARIANT. RequirementsHeader: atlcomcli.h See Also |
|
|
5楼#
发布于:2004-10-11 14:49
以下是引用mao__mao_在2004-10-11 9:49:02的发言:
我的代码是这样写的 CMoLine l; CMoLine g_searchLine; l=m_Map.TrackLine(); if(LPDISPATCH(l)) g_searchLine = l; CMoPolygon shpBuffer; VARIANT va; VariantInit(;va); va.vt=VT_DISPATCH; va.pdispVal=g_searchLine.GetExtent().m_lpDispatch; shpBuffer=g_searchLine.Buffer(100,va); 为什么执行到最后一句shpBuffer=g_searchLine.Buffer(100,va);总是出错?还请多多指教 i can't find the error if you give me only these codes. but i think maybe the reason is you haven't create the shpBuffer using the "CreateDispatch" mothed. i am not sure. suggest you have a try . and variant is also ok ,but i haven't used it ,i have no time to try. you can do it by yourself. or ask somebody who have used it . besides , i strongly suggest that you should use the standard C++ ,use CComVariant . |
|
|
6楼#
发布于:2004-10-11 17:50
强烈支持楼上兄弟的热情
|
|
|
7楼#
发布于:2004-10-11 19:19
先谢谢袁兄 其实相关的代码只有我贴出的这些。 我开始用的是COleVariant 先在CMoPolygon shpBuffer;后加入shpBuffer.CreateDispatch(TEXT("MapObjects2.Polygon")); 还是在shpBuffer=g_searchLine.Buffer(100,va);句出错,运行错误提示如下 Unhandled exception in map.exe(OLEAUT32.DLL):OxC000000 Access Violation 后又打算用CComVariant 结果在#include 我改成#include "atlcomcli.h"也不行 真是愁人啊,还请列位高人多多指教! |
|
8楼#
发布于:2004-10-12 15:00
搞定了,我用的是#include 再次多谢袁兄 ![]() |
|
9楼#
发布于:2004-10-21 10:02
以下是引用袁绍伦在2004-10-10 16:34:06的发言:
My work. Hope that it can help you. The Function is as follows: vector
我想问一下其中的CMoRecordset; BufferRecords是怎么获取的,是对选中的目标进行获取的还是直接对一层数据进行buffer分析的?谢谢!我获取buffer总是空值. |
|