明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
楼主: 王咣生

ObjectARX工作日志

    [复制链接]
发表于 2006-8-31 18:27 | 显示全部楼层
多谢
发表于 2006-9-13 12:10 | 显示全部楼层

王老师,请教一下,我想单独用arx写个显示屏幕刷新命令。


#include "StdAfx.h"
#include "StdArx.h"

// This is command 'REE'
void apsree()
{
 acutPrintf("刷新实体:");
    actrTransactionManager->flushGraphics();
    acedUpdateDisplay();

 acutPrintf("OK!");
 return;
 // TODO: Implement the command

}

编译结果如下,请问怎么解决?

--------------------Configuration: ree - Win32 Debug--------------------
Compiling...
reeCommands.cpp
     Compiling STL header files in release mode.
E:\test\ree\reeCommands.cpp(14) : error C2065: 'actrTransactionManager' : undeclared identifier
E:\test\ree\reeCommands.cpp(14) : error C2227: left of '->flushGraphics' must point to class/struct/union
Error executing cl.exe.

reeCommands.obj - 2 error(s), 0 warning(s)

 楼主| 发表于 2006-9-16 16:24 | 显示全部楼层
引用actrans.h没有?
发表于 2006-9-24 21:01 | 显示全部楼层
谢谢,,MSN:exceedyjh@hotmail.com(同岩),我也是刚学学,多多指教,多多交流。
发表于 2006-10-10 17:00 | 显示全部楼层

引用了#include"actrans.h"还是同样的错误.......

是不是还缺少哪个库文件?

发表于 2006-11-3 10:10 | 显示全部楼层

好帖

 

发表于 2006-11-9 18:16 | 显示全部楼层

最近我遇到个问题,我自己下载了个DockBar作为控件,没用Acui的,但是还是存在首次Dock到CAD边界时候,高度不够,没有填充完整。

希望那位大哥解惑

 

// add the define


#include "StdAfx.h"
#include "DockBar.h"
#include "Resource.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

 

/////////////////////////////////////////////////////////////////////////////
// CMyBar

CMyDockBar::CMyDockBar()
{
}

CMyDockBar::~CMyDockBar()
{
}


BEGIN_MESSAGE_MAP(CMyDockBar, baseCMyBar)
 //{{AFX_MSG_MAP(CMyDockBar)
 ON_WM_CREATE()
 ON_WM_LBUTTONUP()


 
 //}}AFX_MSG_MAP

 
 ON_NOTIFY(TCN_SELCHANGE, IDC_TAB, OnTcnSelchangeTab)
 ON_NOTIFY(NM_DBLCLK, IDC_TREE, OnNMDblclkTree)
// ON_NOTIFY(WM_WINDOWPOSCHANGED,IDD_DOCKBAR,OnWindowPosChanging)
 
END_MESSAGE_MAP()

//ON_NOTIFY(TCN_SELCHANGE, IDC_TAB, OnTcnSelchangeTab)


/////////////////////////////////////////////////////////////////////////////
// CMyDockBar message handlers

int CMyDockBar::OnCreate(LPCREATESTRUCT lpCreateStruct)
{

  

 CAcModuleResourceOverride resourceOverride ;

 if (baseCMyBar::OnCreate(lpCreateStruct) == -1)
  return -1;

 SetSCBStyle(GetSCBStyle() | SCBS_SIZECHILD);

 

 

 


 //m_wndChild = new CChildDlg;

 //m_wndChild->Create(IDD_DIALOG1,this);
 ////m_wndChild->OnInitDialog();
 //m_wndChild->MoveWindow(0, 0, 100, 100, TRUE);
 
 /*if (!m_wndChild.Create(WS_CHILD|WS_VISIBLE|
  ES_MULTILINE|ES_WANTRETURN|ES_AUTOVSCROLL,
  CRect(0,0,0,0), this, 123))
  return -1;*/
 /*if (!m_wndIBTab.Create(WS_CHILD|WS_VISIBLE|WS_TABSTOP,CRect(0, 0, 0, 0), this, 100))
 {

  m_wndIBTab.ModifyStyleEx(0, WS_EX_CLIENTEDGE);

  m_wndIBTab.InsertItem(0,_T("隧道设计"));
  m_wndIBTab.InsertItem(1,_T("隧道监测"));
  m_wndIBTab.InsertItem(2,_T("隧道施工"));
  
 }
 m_wndIBTab.MoveWindow(0,0,200,600,TRUE);*/


 
 
 
 
 //if (!m_wndIBTree.Create(WS_CHILD|WS_VISIBLE|
 // TVS_HASLINES|TVS_HASBUTTONS|TVS_LINESATROOT,
 // Trect, this, 100))
 //{
 // TRACE0("Failed to create instant bar child\n");
 // return -1;  // fail to create
 //}

 //m_wndIBTree.ModifyStyleEx(0, WS_EX_CLIENTEDGE);


 //// populate the treectrl
 //HTREEITEM hti = m_wndIBTree.InsertItem(_T("Node 1"));
 //m_wndIBTree.InsertItem(_T("Node 2"));
 //m_wndIBTree.InsertItem(_T("SubNode 11"), hti);
 //m_wndIBTree.InsertItem(_T("SubNode 12"), hti);
 //m_wndIBTree.InsertItem(_T("SubNode 13"), hti);
 //m_wndIBTree.InsertItem(_T("SubNode 14"), hti);
 //m_wndIBTree.InsertItem(_T("SubNode 15"), hti);
 //m_wndIBTree.InsertItem(_T("SubNode 16"), hti);
 //m_wndIBTree.InsertItem(_T("SubNode 17"), hti);
 //m_wndIBTree.InsertItem(_T("SubNode 18"), hti);
 //m_wndIBTree.InsertItem(_T("SubNode 19"), hti);
 //m_wndIBTree.InsertItem(_T("SubNode 121"), hti);
 //m_wndIBTree.InsertItem(_T("SubNode 122"), hti);


 //m_wndIBTree.MoveWindow(0,0,100,600,TRUE);

 
 
 
 
if (m_Tab.Create(WS_CHILD|WS_VISIBLE,CRect(0,0,200,6000),this,IDC_TAB))
{

 m_Tab.ModifyStyleEx(0, WS_EX_CLIENTEDGE);

 m_Tab.InsertItem(0,_T("隧道设计"));
 m_Tab.InsertItem(1,_T("隧道监测"));
 m_Tab.InsertItem(2,_T("隧道施工"));

 //m_Tab.MoveWindow(0,0,200,600);

 

 if (!m_wndIBTree.Create(WS_CHILD|WS_VISIBLE|
  TVS_HASLINES|TVS_HASBUTTONS|TVS_LINESATROOT,
  CRect(0,30,200,6000), &m_Tab, IDC_TREE))
 {
  TRACE0("Failed to create instant bar child\n");
  return -1;  // fail to create
 }

 m_wndIBTree.ModifyStyleEx(0, WS_EX_CLIENTEDGE);


 // populate the treectrl
 HTREEITEM hti = m_wndIBTree.InsertItem(_T("Node 1"));
 m_wndIBTree.InsertItem(_T("Node 2"));
 m_wndIBTree.InsertItem(_T("SubNode 11"), hti);
 m_wndIBTree.InsertItem(_T("SubNode 12"), hti);
 m_wndIBTree.InsertItem(_T("SubNode 13"), hti);
 m_wndIBTree.InsertItem(_T("SubNode 14"), hti);
 m_wndIBTree.InsertItem(_T("SubNode 15"), hti);
 m_wndIBTree.InsertItem(_T("SubNode 16"), hti);
 m_wndIBTree.InsertItem(_T("SubNode 17"), hti);
 m_wndIBTree.InsertItem(_T("SubNode 18"), hti);
 m_wndIBTree.InsertItem(_T("SubNode 19"), hti);
 m_wndIBTree.InsertItem(_T("SubNode 121"), hti);
 m_wndIBTree.InsertItem(_T("SubNode 122"), hti);


 m_wndIBTree.MoveWindow(0,30,200,600,TRUE);

 
}

 // --- end instant bar creation and child setup ---

 

 //m_wndChild.ModifyStyleEx(0, WS_EX_CLIENTEDGE);

 //// older versions of Windows* (NT 3.51 for instance)
 //// fail with DEFAULT_GUI_FONT
 //if (!m_font.CreateStockObject(DEFAULT_GUI_FONT))
 // if (!m_font.CreatePointFont(80, _T("MS Sans Serif")))
 //  return -1;

 //m_wndChild.SetFont(&m_font);

 return 0;
}

 void CMyDockBar::OnTcnSelchangeTab(NMHDR *pNMHDR, LRESULT *pResult)
{
 // TODO: Add your control notification handler code here
 if (m_Tab.GetCurSel()==0)
 {
  m_wndIBTree.ShowWindow(SW_SHOW);
  
 }
 if (m_Tab.GetCurSel()==1)
 {
  m_wndIBTree.ShowWindow(SW_HIDE);
 

 }
 if (m_Tab.GetCurSel()==2)
 {
  m_wndIBTree.ShowWindow(SW_HIDE);

 }

}

 void CMyDockBar::OnNMDblclkTree(NMHDR *pNMHDR, LRESULT *pResult)
 {
  // TODO: Add your control notification handler code here
  NMTVDISPINFO* pNMTreeView = (NMTVDISPINFO*)pNMHDR;

  CString szText;
  HTREEITEM Item2; 


  Item2 = m_wndIBTree.GetSelectedItem();
  szText = m_wndIBTree.GetItemText(Item2);
  if (szText==_T("SubNode 11"))
  {
   CChildDlgII dlg1;
   dlg1.DoModal();
  }

  if (szText==_T("SubNode 12"))
  {
   CChildDlgII Dlg2;
   Dlg2.DoModal();
  }

  *pResult = 0;
 }

 void CMyDockBar::OnLButtonUp(UINT nFlags, CPoint point)
 {
  if (m_bTracking)
   StopTracking();

  baseCMyBar::OnLButtonUp(nFlags, point);

  MoveWindow(0,0,200,600);
 }

 void CMyDockBar::OnSize(UINT nType, int cx, int cy)
 {
  baseCMyBar::OnSize(nType, cx, cy);

  SetWindowPos(acedGetAcadFrame(),0,0,200,600,TRUE);
 }

 


//////////////////////////////////////////////////////////////////////////

BOOL InitApp()
{
 CMyDockBar *m_wndInstantBar = NULL;
 //CTreeCtrl m_wndIBTree;
 //HTREEITEM  TreeItem;

 CAcModuleResourceOverride res;

 // --- instant bar ---
 

 if ( !m_wndInstantBar)
 {
  m_wndInstantBar = new CMyDockBar;

  

  
 if (!m_wndInstantBar->Create(_T("Instant Bar"), acedGetAcadFrame(),
  IDD_DOCKBAR,WS_CHILD|WS_VISIBLE|CBRS_ALIGN_LEFT|CBRS_SIZE_DYNAMIC))
  {
   TRACE0("Failed to create instant bar\n");
   return -1;  // fail to create
  }
  m_wndInstantBar->SetSCBStyle(m_wndInstantBar->GetSCBStyle() |
   SCBS_SIZECHILD);

  acedGetAcadFrame()->EnableAutomation();

 

  
  //if (!m_wndIBTree.Create(WS_CHILD|WS_VISIBLE|
  // TVS_HASLINES|TVS_HASBUTTONS|TVS_LINESATROOT,
  // CRect(0, 0, 0, 0), m_wndInstantBar, 100))
  //{
  // TRACE0("Failed to create instant bar child\n");
  // return -1;  // fail to create
  //}
  //m_wndIBTree.ModifyStyleEx(0, WS_EX_CLIENTEDGE);

  //
  //// populate the treectrl
  //HTREEITEM hti = m_wndIBTree.InsertItem(_T("Node 1"));
  //m_wndIBTree.InsertItem(_T("Node 2"));
  //m_wndIBTree.InsertItem(_T("SubNode 11"), hti);
  //m_wndIBTree.InsertItem(_T("SubNode 12"), hti);
  // --- end instant bar creation and child setup ---

  m_wndInstantBar->SetBarStyle(m_wndInstantBar->GetBarStyle() |
   CBRS_TOOLTIPS | CBRS_FLYBY );

  m_wndInstantBar->EnableAutomation();
  

  //m_wndInstantBar.EnableDocking(CBRS_ALIGN_LEFT|CBRS_ALIGN_RIGHT);
  m_wndInstantBar->EnableDocking(CBRS_ALIGN_LEFT|CBRS_ALIGN_RIGHT|CBRS_ALIGN_TOP);


  //
  //#ifdef _SCB_REPLACE_MINIFRAME
  //  m_pFloatingFrameClass = RUNTIME_CLASS(CSCBMiniDockFrameWnd);
  //
  //  
  //#endif //_SCB_REPLACE_MINIFRAME  AFX_IDW_DOCKBAR_LEFT

 
  //acedGetAcadFrame()->DockControlBar(m_wndInstantBar,AFX_IDW_DOCKBAR_TOP,NULL);

  acedGetAcadFrame()->FloatControlBar (m_wndInstantBar, CPoint(100, 100), CBRS_ALIGN_LEFT|CBRS_ALIGN_TOP|CBRS_ALIGN_RIGHT);
 
  acedGetAcadFrame ()->ShowControlBar (m_wndInstantBar, !m_wndInstantBar->IsVisible(), TRUE);
  //acedGetAcadFrame()->FloatControlBar (m_wndInstantBar, CPoint(100, 100), CBRS_ALIGN_LEFT|CBRS_ALIGN_TOP|CBRS_ALIGN_RIGHT);

 

  //RestoreControlBar(AFX_IDW_DOCKBAR_LEFT , lpRect);
     
  acedGetAcadFrame()->RecalcLayout(TRUE);
 
 }

 if(!m_wndInstantBar->IsVisible())
 {
  acedGetAcadFrame ()->ShowControlBar (m_wndInstantBar, !m_wndInstantBar->IsVisible(), TRUE);
  
 }
   //DockControlBar(&m_wndInstantBar, AFX_IDW_DOCKBAR_LEFT);
   //ShowControlBar(&m_wndInstantBar, !m_wndInstantBar.IsVisible(), FALSE);


  return TRUE;


}

发表于 2006-12-1 16:02 | 显示全部楼层
真好,这位老兄!有源码就更好的!
发表于 2006-12-1 16:04 | 显示全部楼层
真好,这位老兄!有源码就更好的!
发表于 2006-12-1 16:11 | 显示全部楼层
向版主致敬!向版主学习!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-4-25 03:47 , Processed in 0.308761 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表