明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1750|回复: 3

[ARX] 请大侠帮忙,下面的2处错误什么意思

[复制链接]
发表于 2004-5-27 14:27:00 | 显示全部楼层 |阅读模式
// WindoInfoDlg.cpp : implementation file
//


#include "StdArx.h"
#include "resource.h"
#include "WindoInfoDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

HTREEITEM htCur, htPrev;

/////////////////////////////////////////////////////////////////////////////
// CWindoInfoDlg dialog


CWindoInfoDlg::CWindoInfoDlg(CWnd* pParent /*=NULL*/)
: CAdUiDialog(CWindoInfoDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CWindoInfoDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}


void CWindoInfoDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CWindoInfoDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CWindoInfoDlg, CDialog)
//{{AFX_MSG_MAP(CWindoInfoDlg)
// NOTE: the ClassWizard will add message map macros here
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CWindoInfoDlg message handlers
BOOL CWindoInfoDlg::OnInitDialog()
{
CDialog::OnInitDialog();

m_pTreeCtrl = (CTreeCtrl*)GetDlgItem(IDC_TREE1);

m_imgList.Create(16, 15, FALSE, 9, 3);

CBitmap* pBitmap = new CBitmap;
pBitmap->LoadBitmap(IDB_WINDOW);
m_nIdxWindow = m_imgList.Add(pBitmap, RGB(0, 0, 0));
pBitmap->LoadBitmap(IDB_RECT);
m_nIdxRect = m_imgList.Add(pBitmap, RGB(0, 0, 0));
pBitmap->LoadBitmap(IDB_ARCH);
m_nIdxArch = m_imgList.Add(pBitmap, RGB(0, 0, 0));
pBitmap->LoadBitmap(IDB_APEX);
m_nIdxApex = m_imgList.Add(pBitmap, RGB(0, 0, 0));
pBitmap->LoadBitmap(IDB_WIDTH);
m_nIdxWidth = m_imgList.Add(pBitmap, RGB(0, 0, 0));
pBitmap->LoadBitmap(IDB_HEIGHT);
m_nIdxHeight = m_imgList.Add(pBitmap, RGB(0, 0, 0));
pBitmap->LoadBitmap(IDB_ROWS);
m_nIdxRows = m_imgList.Add(pBitmap, RGB(0, 0, 0));
pBitmap->LoadBitmap(IDB_COLS);
m_nIdxCols = m_imgList.Add(pBitmap, RGB(0, 0, 0));
pBitmap->LoadBitmap(IDB_STARTPT);
m_nIdxStartPt = m_imgList.Add(pBitmap, RGB(0, 0, 0));
m_pTreeCtrl->SetImageList(&m_imgList, TVSIL_NORMAL);
delete pBitmap;

AddTreeViewItems();

HTREEITEM hRoot = m_pTreeCtrl->GetRootItem();

m_pTreeCtrl->Expand(hRoot, TVE_EXPAND);

return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}

void CWindoInfoDlg::AddTreeViewItems()
{
CString strItem("Window");

htCur = AddOneItem((HTREEITEM)NULL, strItem, (HTREEITEM)TVI_ROOT, m_nIdxWindow, TRUE);

switch(windInfo.m_nWindType)
{
case 0 :
strItem = "Rect";
htPrev = AddOneItem(htCur, strItem, NULL, m_nIdxRect, FALSE);
break;

case 1 :
strItem = "Arch";
htPrev = AddOneItem(htCur, strItem, NULL, m_nIdxArch, FALSE);
break;

case 2 :
strItem = "Apex";
htPrev = AddOneItem(htCur, strItem, NULL, m_nIdxApex, FALSE);
break;
}


strItem.Format("W = %.2lf", windInfo.m_dWindWt);
htPrev = AddOneItem(htCur, strItem, NULL, m_nIdxWidth, FALSE);

strItem.Format("H = %.2lf", windInfo.m_dWindHt);
htPrev = AddOneItem(htCur, strItem, NULL, m_nIdxHeight, FALSE);

strItem.Format("Rows = %d", windInfo.m_nRows);
htPrev = AddOneItem(htCur, strItem, NULL, m_nIdxRows, FALSE);

strItem.Format("Cols = %d", windInfo.m_nCols);
htPrev = AddOneItem(htCur, strItem, NULL, m_nIdxCols, FALSE);

strItem.Format("SP = (%.2lf, %.2lf)", windInfo.m_startPt.x, windInfo.m_startPt.y);
htPrev = AddOneItem(htCur, strItem, NULL, m_nIdxStartPt, FALSE);
}

HTREEITEM CWindoInfoDlg::AddOneItem( HTREEITEM hParent,
CString szText, HTREEITEM hInsAfter, int iImage, BOOL bChildren)
{
HTREEITEM hItem; // return value
TV_ITEM tvI; // item structure
TV_INSERTSTRUCT tvIns; // item insert structure
if(bChildren) // *** set tvI.mask member ***
tvI.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_CHILDREN | TVIF_SELECTEDIMAGE; // item has children
else // item has no children
tvI.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
tvI.pszText = szText.GetBuffer(szText.GetLength()); // set text, text lenght, image
tvI.cchTextMax = szText.GetLength();
tvI.iImage = iImage;
tvI.iSelectedImage = iImage;
tvI.cChildren = 1; // allow one more level down
// do the insert
tvIns.item = tvI;
tvIns.hInsertAfter = hInsAfter;
tvIns.hParent = hParent;
hItem = m_pTreeCtrl->InsertItem(&tvIns);
return (hItem); // return (add error trap here)
}// WindoTypeDlg.cpp : implementation file
//


#include "StdArx.h"
#include "resource.h"
#include "WindoTypeDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

extern CWindoTypeDlg *g_pWindoTypeDlg;
extern CAcToolBar *g_pAcToolBar;
extern CTBGenWnd *g_pTBGenWnd;

/////////////////////////////////////////////////////////////////////////////
// CWindoTypeDlg dialog


CWindoTypeDlg::CWindoTypeDlg(CWnd* pParent /*=NULL*/)
: CAdUiDialog(CWindoTypeDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CWindoTypeDlg)
m_nWindType = windInfo.m_nWindType;
m_nCols = windInfo.m_nCols;
m_nRows = windInfo.m_nRows;
m_dHeight = windInfo.m_dWindHt;
m_dWidth = windInfo.m_dWindWt;
m_dXVal = windInfo.m_startPt.x;
m_dYVal = windInfo.m_startPt.y;
//}}AFX_DATA_INIT
}


void CWindoTypeDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CWindoTypeDlg)
DDX_Radio(pDX, IDC_RB_TYPERECT, m_nWindType);
DDX_Text(pDX, IDC_EDIT_COLS, m_nCols);
DDV_MinMaxInt(pDX, m_nCols, 1, 10);
DDX_Text(pDX, IDC_EDIT_ROWS, m_nRows);
DDV_MinMaxInt(pDX, m_nRows, 1, 10);
DDX_Text(pDX, IDC_EDIT_HEIGHT, m_dHeight);
DDV_MinMaxDouble(pDX, m_dHeight, 20., 300.);
DDX_Text(pDX, IDC_EDIT_WIDTH, m_dWidth);
DDV_MinMaxDouble(pDX, m_dWidth, 20., 300.);
DDX_Text(pDX, IDC_EDIT_XVAL, m_dXVal);
DDX_Text(pDX, IDC_EDIT_YVAL, m_dYVal);
//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CWindoTypeDlg, CDialog)
//{{AFX_MSG_MAP(CWindoTypeDlg)
ON_BN_CLICKED(IDC_BTN_PICKPT, OnBtnPickPt)
ON_BN_CLICKED(IDC_CHK_VISTB, OnChkViewToolBar)
ON_BN_CLICKED(IDC_BTN_HIDEDLG, OnBtnHideDlg)
ON_COMMAND(ID_MENUITEM32769, OnMenuitem_dqml)
ON_COMMAND(ID_MENUITEM32772, OnMenuitem_xmg)
ON_COMMAND(ID_MENUITEM32770, OnMenuitem_jhcz)
ON_COMMAND(ID_MENUITEM32768, OnMenuitem_dxcz)
ON_COMMAND(ID_MENUITEM32771, OnMenuitem_gy)
ON_COMMAND(ID_MENUITEM32773, OnMenuitem_xjwd)
ON_COMMAND(ID_MENUITEM32775, OnMenuitem_jx)
ON_COMMAND(ID_MENUITEM32776, OnMenuitem_yx)
ON_COMMAND(ID_MENUITEM32777, OnMenuitem_ft)
ON_COMMAND(ID_MENUITEM32778, OnMenuitem_qt)
ON_COMMAND(ID_MENUITEM32782, OnMenuitem_bhsj)
ON_COMMAND(ID_MENUITEM32780, OnMenuitem_bzst)
ON_COMMAND(ID_MENUITEM32774, OnMenuitem_gb)
ON_COMMAND(ID_MENUITEM32783, OnMenuitem_biaozhu)
ON_COMMAND(ID_MENUITEM32784, OnMenuitem_scwl)
ON_COMMAND(ID_MENUITEM32785, OnMenuitem_zhaose)
ON_COMMAND(ID_MENUITEM32786, OnMenuitem_zx)
//}}AFX_MSG_MAP
ON_MESSAGE (WM_ACAD_KEEPFOCUS, onAcadKeepFocus)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CWindoTypeDlg message handlers

LONG CWindoTypeDlg::onAcadKeepFocus(UINT, LONG)
{
return (TRUE) ;
}


BOOL CWindoTypeDlg::OnInitDialog()
{
CDialog::OnInitDialog();

CSpinButtonCtrl* pSpin;
pSpin = (CSpinButtonCtrl*) GetDlgItem(IDC_SPIN_COLS);
pSpin->SetRange(1, 10);

pSpin = (CSpinButtonCtrl*) GetDlgItem(IDC_SPIN_ROWS);
pSpin->SetRange(1, 10);

return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}

void CWindoTypeDlg::PostNcDestroy()
{
delete this;
g_pWindoTypeDlg = NULL;
CDialog::PostNcDestroy();
}

void CWindoTypeDlg::OnCancel()
{
// Do NOT call CDialog::OnCancel();
// Remember we're modeless,
// Call DestroyWindow() instead!

DestroyWindow();
}

void CWindoTypeDlg::OnOK()
{
if (!UpdateData(TRUE))
{
return;
}

// Transfer the values in the dialog
// back to the global variables

windInfo.m_dWindHt = m_dHeight;
windInfo.m_dWindWt = m_dWidth;
windInfo.m_nCols = m_nCols;
windInfo.m_nRows = m_nRows;
windInfo.m_nWindType = m_nWindType;
windInfo.m_startPt.x = m_dXVal;
windInfo.m_startPt.y = m_dYVal;

drawWindo();
}

void CWindoTypeDlg::OnBtnPickPt()
{
// Here we hide our modal dialog
// to allow the user to pick a point
AcGePoint3d pkPt;
int retCode;

ShowWindow(SW_HIDE); // Hide our dialog

acedInitGet(NULL, NULL);

retCode = acedGetPoint(NULL, "\nPick lower left corner of window: ",
asDblArray(pkPt));

switch(retCode)
{
case RTCAN :
case RTNONE :

pkPt.set(0.0, 0.0, 0.0);

break;

case RTNORM :



break;
}

m_dXVal = pkPt.x;
m_dYVal = pkPt.y;

ShowWindow(SW_SHOW); // Display our dialog again

// Transfer the data values from the member variables
// to the dialog.
UpdateData(FALSE);
}

void CWindoTypeDlg::OnBtnHideDlg()
{
ShowWindow(SW_HIDE);
}

void CWindoTypeDlg::OnChkViewToolBar()
{
CMDIFrameWnd *pAcadFrame = acedGetAcadFrame();

if(g_pAcToolBar != NULL && g_pAcToolBar->IsWindowVisible())
{
((CButton*) GetDlgItem(IDC_CHK_VISTB))->SetCheck(0);
pAcadFrame->ShowControlBar(g_pAcToolBar, FALSE, FALSE);
GetDlgItem(IDC_BTN_HIDEDLG)->EnableWindow(FALSE);
}
else if(g_pAcToolBar != NULL)
{
((CButton*) GetDlgItem(IDC_CHK_VISTB))->SetCheck(1);
pAcadFrame->ShowControlBar(g_pAcToolBar, TRUE, FALSE);
GetDlgItem(IDC_BTN_HIDEDLG)->EnableWindow(TRUE);
}
else
{
pAcadFrame->EnableDocking(CBRS_ALIGN_ANY);
pAcadFrame->RecalcLayout();

CAcModuleResourceOverride resOverride;

// Does the CTBGenWnd already exist?
if(g_pTBGenWnd == NULL)
{
g_pTBGenWnd = new CTBGenWnd;
g_pTBGenWnd->Create (NULL,
NULL,
WS_CHILD | WS_MINIMIZE,
CRect (0,0,1,1),
pAcadFrame,
10);
}


g_pAcToolBar = new CAcToolBar;

g_pAcToolBar->Create(pAcadFrame, g_pTBGenWnd);
g_pAcToolBar->LoadToolBar(IDR_TB_WINDDLG);
g_pAcToolBar->EnableDocking(CBRS_ALIGN_ANY);
g_pAcToolBar->SetWindowText(_T("ARX Window")) ;

pAcadFrame->FloatControlBar(g_pAcToolBar, CPoint (100, 200), CBRS_ALIGN_TOP) ;
pAcadFrame->ShowControlBar(g_pAcToolBar, TRUE, FALSE) ;

((CButton*) GetDlgItem(IDC_CHK_VISTB))->SetCheck(1);
GetDlgItem(IDC_BTN_HIDEDLG)->EnableWindow(TRUE);
}

}



void CWindoTypeDlg::OnMenuitem_dqml()
{
// TODO: Add your command handler code here

acedArxLoad ( "asdkInspector.arx");
// acedArxUnload("app");
// acedCommend("");
}

void CWindoTypeDlg::OnMenuitem_xmg()
{
AcApDocument* pcurdoc;
pcurdoc = acDocManager->curDocument();
char *cmdstr="open\n";
acDocManager->sendStringToExecute(pcurdoc,cmdstr,0);
free(cmdstr);
}

void CWindoTypeDlg::OnMenuitem_jhcz()
{
// TODO: Add your command handler code here

acedArxLoad ( "zbzd.arx");
AcApDocument* pcurdoc;
pcurdoc = acDocManager->curDocument();
char *cmdstr="zbzd\n";
acDocManager->sendStringToExecute(pcurdoc,cmdstr,0);
free(cmdstr);
}

void CWindoTypeDlg::OnMenuitem_dxcz()
{
// TODO: Add your command handler code here
acedArxLoad ( "trop.arx");
AcApDocument* pcurdoc;
pcurdoc = acDocManager->curDocument();
char *cmdstr="_windo\n";
acDocManager->sendStringToExecute(pcurdoc,cmdstr,0);
free(cmdstr);
}

void CWindoTypeDlg::OnMenuitem_gy()
{
// TODO: Add your command handler code here
AfxMessageBox("毕业设计");
}

void CWindoTypeDlg::OnMenuitem_xjwd()
{
// TODO: Add your command handler code here
AcApDocument* pcurdoc;
pcurdoc = acDocManager->curDocument();
char *cmdstr="_new\n";
acDocManager->sendStringToExecute(pcurdoc,cmdstr,0);
free(cmdstr);
}

void CWindoTypeDlg::OnMenuitem_jx()
{
// TODO: Add your command handler code here
AcApDocument* pcurdoc;
pcurdoc = acDocManager->curDocument();
char *cmdstr="_rectang\n";
acDocManager->sendStringToExecute(pcurdoc,cmdstr,0);
free(cmdstr);
}

void CWindoTypeDlg::OnMenuitem_yx()
{
// TODO: Add your command handler code here
AcApDocument* pcurdoc;
pcurdoc = acDocManager->curDocument();
char *cmdstr="_circle\n";
acDocManager->sendStringToExecute(pcurdoc,cmdstr,0);
free(cmdstr);
}

void CWindoTypeDlg::OnMenuitem_ft()
{
// TODO: Add your command handler code here
AcApDocument* pcurdoc;
pcurdoc = acDocManager->curDocument();
char *cmdstr="_ai_box\n";
acDocManager->sendStringToExecute(pcurdoc,cmdstr,0);
free(cmdstr);
}

void CWindoTypeDlg::OnMenuitem_qt()
{
// TODO: Add your command handler code here
AcApDocument* pcurdoc;
pcurdoc = acDocManager->curDocument();
char *cmdstr="_ai_sphere\n";
acDocManager->sendStringToExecute(pcurdoc,cmdstr,0);
free(cmdstr);
}

void CWindoTypeDlg::OnMenuitem_bhsj()
{
// TODO: Add your command handler code here
AcApDocument* pcurdoc;
pcurdoc = acDocManager->curDocument();
char *cmdstr="_3dorbit\n";
acDocManager->sendStringToExecute(pcurdoc,cmdstr,0);
free(cmdstr);
}

void CWindoTypeDlg::OnMenuitem_bzst()
{
// TODO: Add your command handler code here
acedArxLoad ( "pre.arx");
AcApDocument* pcurdoc;
pcurdoc = acDocManager->curDocument();
char *cmdstr="_ENTDSP\n";
acDocManager->sendStringToExecute(pcurdoc,cmdstr,0);
free(cmdstr);
}

void CWindoTypeDlg::OnMenuitem_gb()
{
// TODO: Add your command handler code here
AcApDocument* pcurdoc;
pcurdoc = acDocManager->curDocument();
char *cmdstr="_close\n";
acDocManager->sendStringToExecute(pcurdoc,cmdstr,0);
free(cmdstr);
}

void CWindoTypeDlg::OnMenuitem_biaozhu()
{
// TODO: Add your command handler code here
AcApDocument* pcurdoc;
pcurdoc = acDocManager->curDocument();
char *cmdstr="_qdim\n";
acDocManager->sendStringToExecute(pcurdoc,cmdstr,0);
free(cmdstr);
}

void CWindoTypeDlg::OnMenuitem_scwl()
{
// TODO: Add your command handler code here
acedArxLoad ( "post.arx");
AcApDocument* pcurdoc;
pcurdoc = acDocManager->curDocument();
//char *cmdstr="_FEM_POST\n";
char *cmdstr="_FEM_POST\n";
acDocManager->sendStringToExecute(pcurdoc,cmdstr,0);
free(cmdstr);
}

void CWindoTypeDlg::OnMenuitem_zhaose()
{
// TODO: Add your command handler code here
AcApDocument* pcurdoc;
pcurdoc = acDocManager->curDocument();
//char *cmdstr="_FEM_POST\n";
char *cmdstr="_shademode\n";
acDocManager->sendStringToExecute(pcurdoc,cmdstr,0);
free(cmdstr);
}

void CWindoTypeDlg::OnMenuitem_zx()
{
// TODO: Add your command handler code here
AcApDocument* pcurdoc;
pcurdoc = acDocManager->curDocument();
//char *cmdstr="_FEM_POST\n";
char *cmdstr="_line\n";
acDocManager->sendStringToExecute(pcurdoc,cmdstr,0);
free(cmdstr);
} 运行以上程序出现以下2个一样的错误:
f:\program files\microsoft visual studio\myprojects\bysj\windoinfodlg.cpp(150) : fatal error C1010: unexpected end of file while looking for precompiled header directive
WindoTypeDlg.cpp
f:\program files\microsoft visual studio\myprojects\bysj\windotypedlg.cpp(414) : fatal error C1010: unexpected end of file while looking for precompiled header directive。
这2处错误,是什么意思啊?有人能告诉我吗,怎么改?
发表于 2004-5-28 17:16:00 | 显示全部楼层
要么在那两个cpp文件的开头加上:#include <stdafx.h>


要么在工程设置中,把针对那两个文件的设置改为:不使用预编译
 楼主| 发表于 2004-5-28 20:00:00 | 显示全部楼层
我按照你的方法都试了,错误越来越多了啊~~


不行啊,还有别的解决办法吗?
发表于 2004-6-1 10:20:00 | 显示全部楼层
可能是在WindoInfoDlg.cpp 的某个函数的末尾多加了或是少了一个"}"
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-26 04:23 , Processed in 0.166592 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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