Тема: 1 приложение ObjectARX
Подскажите пожалуйста, где недоработки? Извечный русский вопрос, что делать?
Проект вроде бы простой, создать окно типа About. Дальше код.
//----------------------------------------------------------------------------- //----- acrxEntryPoint.cpp //----------------------------------------------------------------------------- #include "StdAfx.h" #include "resource.h" #include "DialogSetka.h" //----------------------------------------------------------------------------- #define szRDS _RXST("Asdk") //----------------------------------------------------------------------------- //----- ObjectARX EntryPoint class CArxProbaApp : public AcRxArxApp { public: CArxProbaApp () : AcRxArxApp () {} virtual AcRx::AppRetCode On_kInitAppMsg (void *pkt) { // TODO: Load dependencies here // You *must* call On_kInitAppMsg here AcRx::AppRetCode retCode =AcRxArxApp::On_kInitAppMsg (pkt) ; // TODO: Add your initialization code here return (retCode) ; } virtual AcRx::AppRetCode On_kUnloadAppMsg (void *pkt) { // TODO: Add your code here // You *must* call On_kUnloadAppMsg here AcRx::AppRetCode retCode =AcRxArxApp::On_kUnloadAppMsg (pkt) ; // TODO: Unload dependencies here return (retCode) ; } virtual void RegisterServerComponents () { } // - AsdkArxProba._CreateDialogSetka command (do not rename) static void AsdkArxProba_CDSetka(void) { CAcModuleResourceOverride res; CDialogSetka dlg; dlg.DoModal(); } } ; //----------------------------------------------------------------------------- IMPLEMENT_ARX_ENTRYPOINT(CArxProbaApp) ACED_ARXCOMMAND_ENTRY_AUTO(CArxProbaApp, AsdkArxProba, _CDSetka, CDSetka, ACRX_CMD_SESSION | ACRX_CMD_MODAL, NULL)
//----------------------------------------------------------------------------- //- ArxProba.cpp : Initialization functions //----------------------------------------------------------------------------- #include "StdAfx.h" #include "resource.h" #include <afxdllx.h> //----------------------------------------------------------------------------- //- Define the sole extension module object. AC_IMPLEMENT_EXTENSION_MODULE(ArxProbaDLL) //- Please do not remove the 3 following lines. These are here to make .NET MFC Wizards //- running properly. The object will not compile but is require by .NET to recognize //- this project as being an MFC project #ifdef NEVER AFX_EXTENSION_MODULE ArxProbaExtDLL ={ NULL, NULL } ; #endif //- Now you can use the CAcModuleResourceOverride 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) { //- Remove this if you use lpReserved UNREFERENCED_PARAMETER(lpReserved) ; if ( dwReason == DLL_PROCESS_ATTACH ) { _hdllInstance =hInstance ; ArxProbaDLL.AttachInstance (hInstance) ; InitAcUiDLL () ; } else if ( dwReason == DLL_PROCESS_DETACH ) { ArxProbaDLL.DetachInstance () ; } return (TRUE) ; }
//----------------------------------------------------------------------------- //----- DialogSetka.h : Declaration of the CDialogSetka //----------------------------------------------------------------------------- #pragma once //----------------------------------------------------------------------------- #include "adui.h" //----------------------------------------------------------------------------- class CDialogSetka : public CAcUiDialog { DECLARE_DYNAMIC (CDialogSetka) public: CDialogSetka (CWnd *pParent =NULL, HINSTANCE hInstance =NULL) ; enum { IDD = IDD_DIALOGSETKA} ; protected: virtual void DoDataExchange (CDataExchange *pDX) ; afx_msg LRESULT OnAcadKeepFocus (WPARAM, LPARAM) ; virtual BOOL OnInitDialog(); DECLARE_MESSAGE_MAP() public: afx_msg void OnBnClickedOk(); afx_msg void OnBnClickedCansel(); } ;
//----------------------------------------------------------------------------- //----- DialogSetka.cpp : Implementation of CDialogSetka //----------------------------------------------------------------------------- #include "StdAfx.h" #include "resource.h" #include "DialogSetka.h" //----------------------------------------------------------------------------- IMPLEMENT_DYNAMIC (CDialogSetka, CAcUiDialog) BEGIN_MESSAGE_MAP(CDialogSetka, CAcUiDialog) ON_MESSAGE(WM_ACAD_KEEPFOCUS, OnAcadKeepFocus) ON_BN_CLICKED(IDOK, OnBnClickedOk) ON_BN_CLICKED(IDCANCEL, OnBnClickedCansel) END_MESSAGE_MAP() //IDCANCEL //----------------------------------------------------------------------------- CDialogSetka::CDialogSetka (CWnd *pParent /*=NULL*/, HINSTANCE hInstance /*=NULL*/) : CAcUiDialog (CDialogSetka::IDD, pParent, hInstance) { } //----------------------------------------------------------------------------- void CDialogSetka::DoDataExchange (CDataExchange *pDX) { CAcUiDialog::DoDataExchange (pDX) ; } //----------------------------------------------------------------------------- //----- Needed for modeless dialogs to keep focus. //----- Return FALSE to not keep the focus, return TRUE to keep the focus LRESULT CDialogSetka::OnAcadKeepFocus (WPARAM, LPARAM) { return (TRUE) ; } // ----------------------------------------------------------------------------- BOOL CDialogSetka::OnInitDialog() { // Set the dialog name for registry lookup and storage CAcUiDialog::OnInitDialog(); SetWindowText(L"ObjectARX for Dummies - Lab 2"); /* SetWindowText("ObjectARX for Dummies - Lab 2"); m_select.AutoLoad(); m_btn_apply.EnableWindow(FALSE); */ return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } // ----------------------------------------------------------------------------- void CDialogSetka::OnBnClickedOk() { CAcUiDialog::OnOK(); } // ----------------------------------------------------------------------------- void CDialogSetka::OnBnClickedCansel() { CAcUiDialog::OnCancel(); }