- UID
- 756
- 积分
- 197
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2002-1-16
- 最后登录
- 1970-1-1
|
楼主 |
发表于 2013-8-6 08:51:51
|
显示全部楼层
不用向导方式,把进度条函数的struct resbuf *rb 参数去掉,我还是不知道咋改!下面是全部的定义代码,请看看如何改合适?- // (C) Copyright 2002-2005 by Autodesk, Inc.
- //
- // Permission to use, copy, modify, and distribute this software in
- // object code form for any purpose and without fee is hereby granted,
- // provided that the above copyright notice appears in all copies and
- // that both that copyright notice and the limited warranty and
- // restricted rights notice below appear in all supporting
- // documentation.
- //
- // AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
- // AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
- // MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
- // DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
- // UNINTERRUPTED OR ERROR FREE.
- //
- // Use, duplication, or disclosure by the U.S. Government is subject to
- // restrictions set forth in FAR 52.227-19 (Commercial Computer
- // Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
- // (Rights in Technical Data and Computer Software), as applicable.
- //
- //-----------------------------------------------------------------------------
- //----- acrxEntryPoint.h
- //-----------------------------------------------------------------------------
- #include "StdAfx.h"
- #include "adslib.h"
- #include "resource.h"
- //-----------------------------------------------------------------------------
- #define szRDS _RXST("LLRX")
- /* Utility definition to get an array's element count (at compile
- time). For example:
- int arr[] = {1,2,3,4,5};
- ...
- printf("%d", ELEMENTS(arr));
- would print a five. ELEMENTS("abc") can also be used to tell how
- many bytes are in a string constant INCLUDING THE TRAILING NULL. */
- //
- #define ELEMENTS(array) (sizeof(array)/sizeof((array)[0]))
- /* All the functions that we'll define will be listed in a single table,
- together with the internal function that we call to handle each. The
- functions all take a single argument (the resbuf that has the
- arguments) and return an integer (RTNORM or RTERROR for good or bad
- status). */
- /* First, define the structure of the table: a string giving the AutoCAD name
- of the function, and a pointer to a function returning type int. */
- struct func_entry { TCHAR *func_name; int (*func) (struct resbuf *); };
- /* Here we declare the functions that handle the calls; at the moment there are
- two of them. */
- /* Here we define the array of function names and handlers. */
- struct func_entry func_table[] =
- {
- {_T("LLRX-ProgressInit"), ProgressInit},
- {_T("LLRX-Progress"), ProgressMeterPos},
- {_T("LLRX-ProgressDone"), ProgressDone},
- };
- static int funcload();
- static int dofun();
- //加载自定义函数
- static int funcload()
- {
- int i;
- for (i = 0; i < ELEMENTS(func_table); i++) {
- if (!acedDefun(func_table.func_name, (short)i))
- return RTERROR;
- }
- return RTNORM;
- }
- //执行函数
- static int dofun()
- {
- struct resbuf *rb;
- int val;
- /* Get the function code and check that it's within range.
- (It can't fail to be, but paranoia doesn't hurt.) */
- if ((val = acedGetFunCode()) < 0 || val >= ELEMENTS(func_table)) {
- acdbFail(_T(/*MSG2*/"Received nonexistent function code."));
- return RTERROR;
- }
- /* Fetch the arguments, if any. */
- rb = acedGetArgs();
- /* Call the handler and return its success-failure status. */
- val = (*func_table[val].func)(rb);
- acutRelRb(rb);
- return val;
- }
- //-----------------------------------------------------------------------------
- //----- ObjectARX EntryPoint
- //extern "C" AcRx::AppRetCode
- class CArxProject2App : public AcRxArxApp {
- public:
- CArxProject2App () : AcRxArxApp () {}
- virtual AcRx::AppRetCode On_kInitAppMsg (void *pkt) {
- // TODO: Load dependencies here
- acrxDynamicLinker->unlockApplication(pkt);
- //acrxDynamicLinker->registerAppMDIAware(pkt);
- // You *must* call On_kInitAppMsg here
- AcRx::AppRetCode retCode =AcRxArxApp::On_kInitAppMsg (pkt) ;
-
- // TODO: Add your initialization code here
- //initApp() ;
- //funcload();
- return (retCode) ;
- }
- virtual AcRx::AppRetCode On_kLoadDwgMsg (void *pkt) {
- // TODO: Load dependencies here
- // You *must* call On_kInitAppMsg here
- AcRx::AppRetCode retCode =AcRxArxApp::On_kLoadDwgMsg (pkt) ;
- // TODO: Add your initialization code here
- funcload();
- return (retCode) ;
- }
- virtual AcRx::AppRetCode On_kInvkSubrMsg (void *pkt) {
- // TODO: Load dependencies here
- //acrxDynamicLinker->registerAppMDIAware(pkt);
- // You *must* call On_kInitAppMsg here
- AcRx::AppRetCode retCode =AcRxArxApp::On_kInvkSubrMsg (pkt) ;
- // TODO: Add your initialization code here
- dofun();
- return (retCode) ;
- }
- virtual AcRx::AppRetCode On_kUnloadAppMsg (void *pkt) {
- // TODO: Add your code here
- //acrxDynamicLinker->unlockApplication(pkt);
- // You *must* call On_kUnloadAppMsg here
- AcRx::AppRetCode retCode =AcRxArxApp::On_kUnloadAppMsg (pkt) ;
- // TODO: Unload dependencies here
- //unloadApp() ;
- return (retCode) ;
- }
- virtual void RegisterServerComponents () {
- }
-
- } ;
- //-----------------------------------------------------------------------------
- IMPLEMENT_ARX_ENTRYPOINT(CArxProject2App)
- //进度条函数
- //进度条初始化
- int ProgressInit(struct resbuf *rb)
- {
- if (rb == NULL)
- {acdbFail(_T("\n参数太少"));
- acedRetVoid();
- return RTERROR;
- }
- ACHAR* str ;
- //ACHAR *sPrompt;
- if (rb->restype != RTSTR)
- {
- acdbFail(_T("\n第1个参数应为提示字串"));
- acedRetVoid();
- return RTERROR;
- //sPrompt = str;
- }
- str = rb->resval.rstring;
- rb = rb->rbnext;
- if (rb == NULL)
- {
- acdbFail(_T("\n参数太少"));
- acedRetVoid();
- return RTERROR;
- }
- long nMaxPos;
- if (rb->restype == RTLONG)
- {
- nMaxPos = rb->resval.rlong;
- }
- else
- if (rb->restype == RTSHORT)
- {
- nMaxPos = long(rb->resval.rint);
- }
- else
- {
- acdbFail(_T("\n第2个参数应为整数"));
- acedRetVoid();
- return RTERROR;
- }
- if (rb->rbnext !=NULL)
- {
- acdbFail(_T("\n参数太多"));
- acedRetVoid();
- return RTERROR;
- }
- acedSetStatusBarProgressMeter(str,0,nMaxPos);
- // TODO: Replace the following line by your returned value if any
- acedRetVoid () ;
- return (RSRSLT) ;
- }
- //设置进度条位置
- int ProgressMeterPos (struct resbuf *rb)
- {
- if (rb == NULL)
- {acdbFail(_T("\n参数太少"));
- acedRetVoid();
- return RTERROR;
- }
- long nPos;
- if (rb->restype == RTLONG)
- {
- nPos = rb->resval.rlong;
- }
- else
- if (rb->restype == RTSHORT)
- {
- nPos = long(rb->resval.rint) ;
- }
- else
- {
- acdbFail(_T("\n参数应为整数"));
- acedRetVoid();
- return RTERROR;
- }
- if (rb->rbnext !=NULL)
- {
- acdbFail(_T("\n参数太多"));
- acedRetVoid();
- return RTERROR;
- }
- acedSetStatusBarProgressMeterPos(nPos);
- acedRetVoid () ;
- return (RSRSLT) ;
- }
- //进度条终止
- int ProgressDone (struct resbuf *rb)
- {
- if (rb != NULL)
- {acdbFail(_T("\n参数太多"));
- acedRetVoid();
- return RTERROR;
- }
- acedRestoreStatusBar();
- acedRetVoid () ;
- return (RSRSLT) ;
- }
|
|