home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 January / Chip_2001-01_cd1.bin / tema / mysql / mysql-3.23.28g-win-source.exe / mysqlmanager / mysqlmanager.cpp < prev    next >
C/C++ Source or Header  |  1999-10-12  |  5KB  |  169 lines

  1. // MySqlManager.cpp : Defines the class behaviors for the application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "MySqlManager.h"
  6.  
  7. #include "MainFrm.h"
  8. #include "ChildFrm.h"
  9. #include "MySqlManagerDoc.h"
  10. #include "MySqlManagerView.h"
  11.  
  12. #ifdef _DEBUG
  13.    #define new DEBUG_NEW
  14.    #undef THIS_FILE
  15. static char THIS_FILE[] = __FILE__;
  16. #endif
  17.  
  18. /////////////////////////////////////////////////////////////////////////////
  19. // CMySqlManagerApp
  20.  
  21. BEGIN_MESSAGE_MAP(CMySqlManagerApp, CWinApp)
  22. //{{AFX_MSG_MAP(CMySqlManagerApp)
  23.     ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
  24. // NOTE - the ClassWizard will add and remove mapping macros here.
  25. //    DO NOT EDIT what you see in these blocks of generated code!
  26. //}}AFX_MSG_MAP
  27. // Standard file based document commands
  28.     ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
  29.     ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
  30. // Standard print setup command
  31.     ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup)
  32. END_MESSAGE_MAP()
  33.  
  34. /////////////////////////////////////////////////////////////////////////////
  35. // CMySqlManagerApp construction
  36.  
  37. CMySqlManagerApp::CMySqlManagerApp()
  38. {
  39.    // TODO: add construction code here,
  40.    // Place all significant initialization in InitInstance
  41. }
  42.  
  43. /////////////////////////////////////////////////////////////////////////////
  44. // The one and only CMySqlManagerApp object
  45.  
  46. CMySqlManagerApp theApp;
  47.  
  48. /////////////////////////////////////////////////////////////////////////////
  49. // CMySqlManagerApp initialization
  50.  
  51. BOOL CMySqlManagerApp::InitInstance()
  52. {
  53.  
  54.    WSADATA WsaData;
  55.  
  56.    if (SOCKET_ERROR == WSAStartup (0x0101, &WsaData))
  57.    {
  58.       AfxMessageBox("WSAStartup Failed\n");
  59.       return FALSE;
  60.    }
  61.  
  62.    AfxEnableControlContainer();
  63.  
  64.    // Standard initialization
  65.    // If you are not using these features and wish to reduce the size
  66.    //  of your final executable, you should remove from the following
  67.    //  the specific initialization routines you do not need.
  68.  
  69. #ifdef _AFXDLL
  70.    Enable3dControls();        // Call this when using MFC in a shared DLL
  71. #else
  72.    Enable3dControlsStatic();  // Call this when linking to MFC statically
  73. #endif
  74.  
  75.    // Change the registry key under which our settings are stored.
  76.    // You should modify this string to be something appropriate
  77.    // such as the name of your company or organization.
  78.    SetRegistryKey(_T("Local AppWizard-Generated Applications"));
  79.  
  80.    LoadStdProfileSettings();  // Load standard INI file options (including MRU)
  81.  
  82.    // Register the application's document templates.  Document templates
  83.    //  serve as the connection between documents, frame windows and views.
  84.  
  85.    CMultiDocTemplate* pDocTemplate;
  86.    pDocTemplate = new CMultiDocTemplate(
  87.                                        IDR_MYSQLMTYPE,
  88.                                        RUNTIME_CLASS(CMySqlManagerDoc),
  89.                                        RUNTIME_CLASS(CChildFrame), // custom MDI child frame
  90.                                        RUNTIME_CLASS(CMySqlManagerView));
  91.    AddDocTemplate(pDocTemplate);
  92.  
  93.    // create main MDI Frame window
  94.    CMainFrame* pMainFrame = new CMainFrame;
  95.    if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
  96.       return FALSE;
  97.    m_pMainWnd = pMainFrame;
  98.  
  99.    // Parse command line for standard shell commands, DDE, file open
  100.    CCommandLineInfo cmdInfo;
  101.    ParseCommandLine(cmdInfo);
  102.  
  103.    // Dispatch commands specified on the command line
  104.    if (!ProcessShellCommand(cmdInfo))
  105.       return FALSE;
  106.  
  107.    // The main window has been initialized, so show and update it.
  108.    pMainFrame->ShowWindow(m_nCmdShow);
  109.    pMainFrame->UpdateWindow();
  110.  
  111.    return TRUE;
  112. }
  113.  
  114. /////////////////////////////////////////////////////////////////////////////
  115. // CAboutDlg dialog used for App About
  116.  
  117. class CAboutDlg : public CDialog
  118. {
  119. public:
  120.    CAboutDlg();
  121.  
  122. // Dialog Data
  123.    //{{AFX_DATA(CAboutDlg)
  124.    enum {IDD = IDD_ABOUTBOX};
  125.    //}}AFX_DATA
  126.  
  127.    // ClassWizard generated virtual function overrides
  128.    //{{AFX_VIRTUAL(CAboutDlg)
  129. protected:
  130.    virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  131.    //}}AFX_VIRTUAL
  132.  
  133. // Implementation
  134. protected:
  135.    //{{AFX_MSG(CAboutDlg)
  136.    // No message handlers
  137.    //}}AFX_MSG
  138.    DECLARE_MESSAGE_MAP()
  139. };
  140.  
  141. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  142. {
  143.    //{{AFX_DATA_INIT(CAboutDlg)
  144.    //}}AFX_DATA_INIT
  145. }
  146.  
  147. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  148. {
  149.    CDialog::DoDataExchange(pDX);
  150.    //{{AFX_DATA_MAP(CAboutDlg)
  151.    //}}AFX_DATA_MAP
  152. }
  153.  
  154. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  155. //{{AFX_MSG_MAP(CAboutDlg)
  156. // No message handlers
  157. //}}AFX_MSG_MAP
  158. END_MESSAGE_MAP()
  159.  
  160. // App command to run the dialog
  161. void CMySqlManagerApp::OnAppAbout()
  162. {
  163.    CAboutDlg aboutDlg;
  164.    aboutDlg.DoModal();
  165. }
  166.  
  167. /////////////////////////////////////////////////////////////////////////////
  168. // CMySqlManagerApp commands
  169.