找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 556|回复: 3

[求助]:请大虾们帮忙看看下面代码的错误

[复制链接]
发表于 2004-5-26 09:30:26 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

×
// 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);
}
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处错误,是什么意思啊?
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
发表于 2004-6-5 23:30:14 | 显示全部楼层
看看你的头文件是不是破坏拉,我有好几次都是出现莫明奇妙的问题
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

发表于 2004-6-7 22:05:10 | 显示全部楼层
May be dismatch   '('[/COLOR] and ')'[/COLOR] or '{'[/COLOR] and '}'[/COLOR]  in your program.
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

发表于 2004-6-10 19:36:26 | 显示全部楼层
#include "stdafx.H"  //here ,add it .try it
#include "StdArx.h"
#include "resource.h"
#include "WindoInfoDlg.h"
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|申请友链|Archiver|手机版|小黑屋|辽公网安备|晓东CAD家园 ( 辽ICP备15016793号 )

GMT+8, 2024-11-15 18:43 , Processed in 0.234551 second(s), 36 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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