zdqwy19 发表于 2014-8-18 16:31:00

arx 工程在特定的文件出错

acrxEntryPoint.cpp文件
// (C) Copyright 2002-2012 by Autodesk, Inc.
//-----------------------------------------------------------------------------
//----- acrxEntryPoint.cpp
//-----------------------------------------------------------------------------
#include "StdAfx.h"
#include "resource.h"
#include "CreateEnt.h"
#include "ModifyEnt.h"
#include
#pragma once;
using namespace std;
//-----------------------------------------------------------------------------
#define szRDS _RXST("")
//-----------------------------------------------------------------------------
//----- ObjectARX EntryPoint
class CtxbhApp : public AcRxArxApp {
public:
CtxbhApp () : AcRxArxApp () {}
virtual AcRx::AppRetCode On_kInitAppMsg (void *pkt) {
    // TODO: Load dependencies here
    // You *must* call On_kInitAppMsg here
    AcRx::AppRetCode retCode =AcRxArxApp::On_kInitAppMsg (pkt) ;
   
    // TODO: Add your initialization code here
    return (retCode) ;
}
virtual AcRx::AppRetCode On_kUnloadAppMsg (void *pkt) {
    // TODO: Add your code here
    // You *must* call On_kUnloadAppMsg here
    AcRx::AppRetCode retCode =AcRxArxApp::On_kUnloadAppMsg (pkt) ;
    // TODO: Unload dependencies here
    return (retCode) ;
}
virtual void RegisterServerComponents () {}
static void MyGroup_test () {
    // Put your command code here
    AcGePoint3d pt(0,0,0);
    vector pts;
    for(int i=0;i::iterator j=pts.begin();j!=pts.end();++j)
    {
      ACHAR str;
      AcDbObjectId textId;
      acdbRToS(bstart,-1,-1,str);
      textId = CCreateEnt::CreateText((*j),str,7);
      CModifyEnt::ChangeColor(textId, 3);
      CModifyEnt::ChangeWidthFactor(textId, 0.7);
      bstart=bstart+1;
    }
}


} ;
//-----------------------------------------------------------------------------
IMPLEMENT_ARX_ENTRYPOINT(CtxbhApp)
ACED_ARXCOMMAND_ENTRY_AUTO(CtxbhApp, MyGroup, _test, test, ACRX_CMD_MODAL, NULL)CreateEnt.h文件复制代码CreateEnt.cpp文件复制代码ModifyEnt.h文件复制代码ModifyEnt.cpp文件复制代码上面5段代码合在一起的压缩文件:
用于测试的图形
   现在是这样情况,我手头三台电脑:
1、安装win7x64+cad2014;
2、安装win7x86+cad2007;
3、安装winXPx86+cad2008;
三台电脑在新建的空白文件上运行上述代码都没有问题;1#机在test.dwg中运行上述代码也没有问题;2#机和3#机在test.dwg中运行上述代码就引起cad崩溃,提示acad.exe缓冲区溢出。**** Hidden Message *****
页: [1]
查看完整版本: arx 工程在特定的文件出错