home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 November / CMCD1104.ISO / Software / Shareware / Programare / skincraft / SkinCrafter_v1.4.12_Demo.msi / _49E29CB9A65AABBF653C1037E1AA74B6 / _D2A8C0F3182F427989B8983F4DA501F2 < prev    next >
Encoding:
Text File  |  2003-10-04  |  4.7 KB  |  187 lines

  1. // MDIDemo.cpp : Defines the class behaviors for the application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "MDIDemo.h"
  6.  
  7. #include "MainFrm.h"
  8. #include "ChildFrm.h"
  9.  
  10. #ifdef _DEBUG
  11. #define new DEBUG_NEW
  12. #undef THIS_FILE
  13. static char THIS_FILE[] = __FILE__;
  14. #endif
  15.  
  16. /////////////////////////////////////////////////////////////////////////////
  17. // CMDIDemoApp
  18.  
  19. BEGIN_MESSAGE_MAP(CMDIDemoApp, CWinApp)
  20.     //{{AFX_MSG_MAP(CMDIDemoApp)
  21.     ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
  22.         // NOTE - the ClassWizard will add and remove mapping macros here.
  23.         //    DO NOT EDIT what you see in these blocks of generated code!
  24.     ON_COMMAND(ID_FILE_NEW, OnFileNew)
  25.     //}}AFX_MSG_MAP
  26. END_MESSAGE_MAP()
  27.  
  28. /////////////////////////////////////////////////////////////////////////////
  29. // CMDIDemoApp construction
  30.  
  31. CMDIDemoApp::CMDIDemoApp()
  32. {
  33.     // TODO: add construction code here,
  34.     // Place all significant initialization in InitInstance
  35. }
  36.  
  37. /////////////////////////////////////////////////////////////////////////////
  38. // The one and only CMDIDemoApp object
  39.  
  40. CMDIDemoApp theApp;
  41.  
  42. /////////////////////////////////////////////////////////////////////////////
  43. // CMDIDemoApp initialization
  44.  
  45. BOOL CMDIDemoApp::InitInstance()
  46. {
  47.     AfxEnableControlContainer();
  48.  
  49.     // Standard initialization
  50.     // If you are not using these features and wish to reduce the size
  51.     //  of your final executable, you should remove from the following
  52.     //  the specific initialization routines you do not need.
  53.  
  54. #ifdef _AFXDLL
  55.     Enable3dControls();            // Call this when using MFC in a shared DLL
  56. #else
  57.     Enable3dControlsStatic();    // Call this when linking to MFC statically
  58. #endif
  59.  
  60.     // Change the registry key under which our settings are stored.
  61.     // TODO: You should modify this string to be something appropriate
  62.     // such as the name of your company or organization.
  63.     SetRegistryKey(_T("Local AppWizard-Generated Applications"));
  64.  
  65.     CoInitialize(NULL);
  66.     
  67.     m_pSkin.CreateDispatch("SkinCrafter.SCSkin");
  68.     
  69.     m_pSkin.InitLicenKeys("0","SKINCRAFTER","SKINCRAFTER.COM","support@skincrafter.com","DEMOSKINCRAFTERLICENCE");
  70.  
  71.     m_pSkin.DefineLanguage(0);
  72.     m_pSkin.InitDecoration(1);
  73.     
  74.     // To create the main window, this code creates a new frame window
  75.     // object and then sets it as the application's main window object.
  76.  
  77.     HINSTANCE hInst = AfxGetResourceHandle();
  78.     m_hMDIMenu  = ::LoadMenu(hInst, MAKEINTRESOURCE(IDR_MDIDEMTYPE));
  79.  
  80.     CMDIFrameWnd* pFrame = new CMainFrame;
  81.     m_pMainWnd = pFrame;
  82.  
  83.     
  84.     // create main MDI frame window
  85.     if (!pFrame->LoadFrame(IDR_MAINFRAME))
  86.         return FALSE;
  87.  
  88.     // try to load shared MDI menus and accelerator table
  89.     //TODO: add additional member variables and load calls for
  90.     //    additional menu types your application may need. 
  91.  
  92.     m_hMDIAccel = ::LoadAccelerators(hInst, MAKEINTRESOURCE(IDR_MDIDEMTYPE));
  93.  
  94.  
  95.     OnFileNew();
  96.     OnFileNew();
  97.     // The main window has been initialized, so show and update it.
  98.     pFrame->ShowWindow(m_nCmdShow);
  99.     pFrame->UpdateWindow();
  100.  
  101.     return TRUE;
  102. }
  103.  
  104. /////////////////////////////////////////////////////////////////////////////
  105. // CMDIDemoApp message handlers
  106.  
  107. int CMDIDemoApp::ExitInstance() 
  108. {
  109.     //TODO: handle additional resources you may have added
  110.  
  111.     m_pSkin.DeInitDecoration();
  112.  
  113.     if (m_hMDIMenu != NULL)
  114.         FreeResource(m_hMDIMenu);
  115.     if (m_hMDIAccel != NULL)
  116.         FreeResource(m_hMDIAccel);
  117.  
  118.     return CWinApp::ExitInstance();
  119. }
  120.  
  121. void CMDIDemoApp::OnFileNew() 
  122. {
  123.     CMainFrame* pFrame = STATIC_DOWNCAST(CMainFrame, m_pMainWnd);
  124.  
  125.     // create a new MDI child window
  126.     pFrame->CreateNewChild(
  127.         RUNTIME_CLASS(CChildFrame), IDR_MDIDEMTYPE, m_hMDIMenu, m_hMDIAccel);
  128. }
  129.  
  130.  
  131.  
  132. /////////////////////////////////////////////////////////////////////////////
  133. // CAboutDlg dialog used for App About
  134.  
  135. class CAboutDlg : public CDialog
  136. {
  137. public:
  138.     CAboutDlg();
  139.  
  140. // Dialog Data
  141.     //{{AFX_DATA(CAboutDlg)
  142.     enum { IDD = IDD_ABOUTBOX };
  143.     //}}AFX_DATA
  144.  
  145.     // ClassWizard generated virtual function overrides
  146.     //{{AFX_VIRTUAL(CAboutDlg)
  147.     protected:
  148.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  149.     //}}AFX_VIRTUAL
  150.  
  151. // Implementation
  152. protected:
  153.     //{{AFX_MSG(CAboutDlg)
  154.         // No message handlers
  155.     //}}AFX_MSG
  156.     DECLARE_MESSAGE_MAP()
  157. };
  158.  
  159. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  160. {
  161.     //{{AFX_DATA_INIT(CAboutDlg)
  162.     //}}AFX_DATA_INIT
  163. }
  164.  
  165. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  166. {
  167.     CDialog::DoDataExchange(pDX);
  168.     //{{AFX_DATA_MAP(CAboutDlg)
  169.     //}}AFX_DATA_MAP
  170. }
  171.  
  172. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  173.     //{{AFX_MSG_MAP(CAboutDlg)
  174.         // No message handlers
  175.     //}}AFX_MSG_MAP
  176. END_MESSAGE_MAP()
  177.  
  178. // App command to run the dialog
  179. void CMDIDemoApp::OnAppAbout()
  180. {
  181.     m_pSkin.AboutSkinCrafter();
  182. }
  183.  
  184. /////////////////////////////////////////////////////////////////////////////
  185. // CMDIDemoApp message handlers
  186.  
  187.