- UID
- 3272
- 积分
- 0
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2002-3-23
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
我想把AUTOCAD做成类VC窗口的窗口,但加载CAD退出!!请帮忙!看看我的代码!!
// 材料成型CAD项目管理.cpp : Initialization functions
#include "StdAfx.h"
#include "StdArx.h"
#include "resource.h"
#include <afxdllx.h>
#include "DockBar.h"
#include <migrtion.h>
#include <dbapserv.h>
#include <Afxext.h>
#include "ManProjectVw1.h"
#include "ManProjectVw2.h"
#include "ManProjectVw3.h"
#include "CJTabCtrlBar.h"
void CreateSampToolBar();
void DeleteSampToolBar();
void CreateLeftView();
//SampToolWnd* gpWnd = NULL;
CDockViewBar* gpBar;
CCJTabCtrlBar* m_wndWorkspace;
CImageList m_ImageList;
CImageList m_TabImages;
HINSTANCE _hdllInstance =NULL ;
// This command registers an ARX command.
void AddCommand(const char* cmdGroup, const char* cmdInt, const char* cmdLoc,
const int cmdFlags, const AcRxFunctionPtr cmdProc, const int idLocal = -1);
// NOTE: DO NOT edit the following lines.
//{{AFX_ARX_MSG
void InitApplication();
void UnloadApplication();
//}}AFX_ARX_MSG
// NOTE: DO NOT edit the following lines.
//{{AFX_ARX_ADDIN_FUNCS
//}}AFX_ARX_ADDIN_FUNCS
////////////////////////////////////////////////////////////////////////////
//
// Define the sole extension module object.
AC_IMPLEMENT_EXTENSION_MODULE(CADDLL);
// Now you can use the CAcModuleRecourceOverride class in
// your application to switch to the correct resource instance.
// Please see the ObjectARX Documentation for more details
/////////////////////////////////////////////////////////////////////////////
// DLL Entry Point
extern "C"
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
{
if (dwReason == DLL_PROCESS_ATTACH)
{
_hdllInstance = hInstance;
// Extension DLL one time initialization
CADDLL.AttachInstance(hInstance);
InitAcUiDLL();
CreateLeftView();
CreateSampToolBar();
} else if (dwReason == DLL_PROCESS_DETACH) {
// Terminate the library before destructors are called
CADDLL.DetachInstance();
DeleteSampToolBar();
}
return TRUE; // ok
}
/////////////////////////////////////////////////////////////////////////////
// ObjectARX EntryPoint
extern "C" AcRx::AppRetCode
acrxEntryPoint(AcRx::AppMsgCode msg, void* pkt)
{
switch (msg) {
case AcRx::kInitAppMsg:
// Comment out the following line if your
// application should be locked into memory
acrxDynamicLinker->unlockApplication(pkt);
acrxDynamicLinker->registerAppMDIAware(pkt);
InitApplication();
break;
case AcRx::kUnloadAppMsg:
UnloadApplication();
break;
}
return AcRx::kRetOK;
}
// Init this application. Register your
// commands, reactors...
void InitApplication()
{
// NOTE: DO NOT edit the following lines.
//{{AFX_ARX_INIT
AddCommand("CADMFCTEST", "MANPROJECT", "MANPROJECT", ACRX_CMD_TRANSPARENT | ACRX_CMD_USEPICKSET, cadMfcTestManProject);
//}}AFX_ARX_INIT
// TODO: add your initialization functions
}
// Unload this application. Unregister all objects
// registered in InitApplication.
void UnloadApplication()
{
// NOTE: DO NOT edit the following lines.
//{{AFX_ARX_EXIT
acedRegCmds->removeGroup("CADMFCTEST");
//}}AFX_ARX_EXIT
// TODO: clean up your application
}
// This functions registers an ARX command.
// It can be used to read the localized command name
// from a string table stored in the resources.
void AddCommand(const char* cmdGroup, const char* cmdInt, const char* cmdLoc,
const int cmdFlags, const AcRxFunctionPtr cmdProc, const int idLocal)
{
char cmdLocRes[65];
// If idLocal is not -1, it's treated as an ID for
// a string stored in the resources.
if (idLocal != -1) {
// Load strings from the string table and register the command.
::LoadString(_hdllInstance, idLocal, cmdLocRes, 64);
acedRegCmds->addCommand(cmdGroup, cmdInt, cmdLocRes, cmdFlags, cmdProc);
} else
// idLocal is -1, so the 'hard coded'
// localized function name is used.
acedRegCmds->addCommand(cmdGroup, cmdInt, cmdLoc, cmdFlags, cmdProc);
}
void CreateLeftView()
{
InitCommonControls();
CMDIFrameWnd* pFrame=acedGetAcadFrame();
AfxSetResourceHandle(_hdllInstance);
// Create the image list to be used with the control bars.
m_ImageList.Create(IDB_BITMAP2, 13, 1, RGB(0,255,0));
// CG: The following block was inserted by the 'Dialog Bar' component
m_wndWorkspace->SetBtnImageList (&m_ImageList);
m_wndWorkspace->SetMenuID(IDR_POPUP);
// Initialize dialog bar m_wndWorkspace
if (!m_wndWorkspace->Create(pFrame, ID_LEFTVIEW,
_T("Workspace"), CSize(220,200)))
{
TRACE0("Failed to create dialog bar m_wndWorkspace\n");
}
// Add the views to the tab control.
m_wndWorkspace->AddView(_T("Class"), RUNTIME_CLASS(CManProjectVw1));
m_wndWorkspace->AddView(_T("Resource"), RUNTIME_CLASS(CManProjectVw2));
m_wndWorkspace->AddView(_T("Files"), RUNTIME_CLASS(CManProjectVw3));
// Define the image list to use with the tab control
m_TabImages.Create (IDB_BITMAP4, 16, 1, RGB(0,255,0));
m_wndWorkspace->SetTabImageList(&m_TabImages);
// allow bar to be resized when floating
m_wndWorkspace->SetBarStyle(m_wndWorkspace->GetBarStyle() |
CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
m_wndWorkspace->EnableDocking(CBRS_ALIGN_ANY);
// EnableDocking(CBRS_ALIGN_ANY);
// DockControlBar(&m_wndWorkspace, AFX_IDW_DOCKBAR_LEFT);
}
void CreateSampToolBar()
{
InitCommonControls();
CMDIFrameWnd* pFrame=acedGetAcadFrame();
AfxSetResourceHandle(_hdllInstance);
gpBar = new CDockViewBar;
// gpBar->SetBtnImageList (&m_ImageList);
// gpBar->SetMenuID(IDR_POPUP);
// Initialize dialog bar m_wndOutput
if (!gpBar->Create(pFrame,_T("Output")))
{
TRACE0("Failed to create dialog bar m_wndOutput\n");
}
// allow bar to be resized when floating
gpBar->SetBarStyle(gpBar->GetBarStyle() |
CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
gpBar->EnableDocking(CBRS_ALIGN_ANY);
gpBar->EnableDocking(CBRS_ALIGN_ANY);
pFrame->EnableDocking(CBRS_ALIGN_ANY);
pFrame ->DockControlBar(gpBar, AFX_IDW_DOCKBAR_TOP);
pFrame->ShowControlBar(gpBar, TRUE, TRUE);
pFrame ->RecalcLayout();
}
// clean up
void DeleteSampToolBar()
{
if(m_wndWorkspace)
{
delete m_wndWorkspace;
m_wndWorkspace= NULL;
}
if(gpBar)
{
delete gpBar;
gpBar = NULL;
}
if(acedGetAcadFrame()->m_hWnd && acdbCurDwg())
acedGetAcadFrame()->RecalcLayout();
} |
|