⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 exam15.cpp

📁 ARX/CAD二次开发
💻 CPP
字号:
// exam15.cpp : Implementation of DLL Exports.


// Note: Proxy/Stub Information
//      To build a separate proxy/stub DLL, 
//      run nmake -f exam15ps.mk in the project directory.

#include "stdafx.h"
#include "resource.h"
#include <initguid.h>
#include "exam15.h"

#include "exam15_i.c"
#include "Exam15Content.h"


CComModule _Module;

BEGIN_OBJECT_MAP(ObjectMap)
OBJECT_ENTRY(CLSID_Exam15Content, CExam15Content)
END_OBJECT_MAP()


void registerAppInfo(HINSTANCE hInstance)
{
	USES_CONVERSION;
	HRESULT hRes = S_OK;
	CComPtr<IRegistrar> p;
	hRes = CoCreateInstance(CLSID_Registrar, NULL,
	CLSCTX_INPROC_SERVER, IID_IRegistrar, (void**)&p);
	if(SUCCEEDED(hRes))
	{
		CString csProdKey = acrxProductKey();

		CString csPath = "SOFTWARE\\Autodesk\\AutoCAD\\R15.0\\";
		CString csStamp = csProdKey.Right(csProdKey.GetLength()
			- csPath.GetLength());
		_TCHAR szRegKey[_MAX_PATH];
		_tcscpy(szRegKey, csStamp);
		LPOLESTR pszId = T2OLE("AUTH");
		
		p->AddReplacement(pszId, T2OLE(szRegKey));
		_TCHAR szModule[_MAX_PATH];
		GetModuleFileName(hInstance, szModule, _MAX_PATH);
		LPCOLESTR szType = OLESTR("REGISTRY");
		LPOLESTR pszModule = T2OLE(szModule);
		
		hRes = p->ResourceRegister(pszModule, IDR_REGISTRY1,
			szType);
		if(FAILED(hRes))
			AfxMessageBox("Error registering the app info.");
	}
}

class CExam15App : public CWinApp
{
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CExam15App)
	public:
    virtual BOOL InitInstance();
    virtual int ExitInstance();
	//}}AFX_VIRTUAL

	//{{AFX_MSG(CExam15App)
		// NOTE - the ClassWizard will add and remove member functions here.
		//    DO NOT EDIT what you see in these blocks of generated code !
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

BEGIN_MESSAGE_MAP(CExam15App, CWinApp)
	//{{AFX_MSG_MAP(CExam15App)
		// NOTE - the ClassWizard will add and remove mapping macros here.
		//    DO NOT EDIT what you see in these blocks of generated code!
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

CExam15App theApp;

BOOL CExam15App::InitInstance()
{
    _Module.Init(ObjectMap, m_hInstance, &LIBID_EXAM15Lib);
    return CWinApp::InitInstance();
}

int CExam15App::ExitInstance()
{
    _Module.Term();
    return CWinApp::ExitInstance();
}

/////////////////////////////////////////////////////////////////////////////
// Used to determine whether the DLL can be unloaded by OLE

STDAPI DllCanUnloadNow(void)
{
    AFX_MANAGE_STATE(AfxGetStaticModuleState());
    return (AfxDllCanUnloadNow()==S_OK && _Module.GetLockCount()==0) ? S_OK : S_FALSE;
}

/////////////////////////////////////////////////////////////////////////////
// Returns a class factory to create an object of the requested type

STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
{
    return _Module.GetClassObject(rclsid, riid, ppv);
}

/////////////////////////////////////////////////////////////////////////////
// DllRegisterServer - Adds entries to the system registry

STDAPI DllRegisterServer(void)
{
    // registers object, typelib and all interfaces in typelib
    return _Module.RegisterServer(TRUE);
}

/////////////////////////////////////////////////////////////////////////////
// DllUnregisterServer - Removes entries from the system registry

STDAPI DllUnregisterServer(void)
{
    return _Module.UnregisterServer(TRUE);
}

extern "C" AcRx::AppRetCode
acrxEntryPoint(AcRx::AppMsgCode msg, void* appId)
{	
	switch(msg)
	{
	case AcRx::kInitAppMsg:
		acrxRegisterAppMDIAware(appId);
		break;
	case AcRx::kUnloadAppMsg:
		break;
	default:
		break;
	}
	return AcRx::kRetOK;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -