Example #1
0
/*
================
InitAfx
================
*/
void InitAfx( void ) {
	if ( !afxInitialized ) {
		AfxWinInit( win32.hInstance, NULL, "", SW_SHOW );
		AfxInitRichEdit();
		afxInitialized = true;
	}
}
Example #2
0
BOOL CTextEditApp::InitInstance()
{

	InitCommonControls();

	AfxInitRichEdit();

	CWinApp::InitInstance();

	// To create the main window, this code creates a new frame window
	// object and then sets it as the application's main window object
	CMainFrame* pFrame = new CMainFrame;
	m_pMainWnd = pFrame;

	// create and load the frame with its resources
	pFrame->LoadFrame(IDR_MAINFRAME,
		WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE, NULL,
		NULL);

	// The one and only window has been initialized, so show and update it
	pFrame->ShowWindow(SW_SHOW);
	pFrame->UpdateWindow();

	return TRUE;
}
Example #3
0
extern "C" __declspec(dllexport) BOOL ShowMainWnd()
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());

	CoInitialize(NULL);
	AfxEnableControlContainer();
	AfxInitRichEdit();

	CMainDlg dlg;
	theApp.m_pMainWnd = &dlg;

	//GDI+
	ULONG_PTR gdiplusToken;
	GdiplusStartupInput gdiplusStartupInput;
	Gdiplus::GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);


	if (dlg.DoModal() == -1)
	{
		TRACE(traceAppMsg, 0, "警告: 对话框创建失败,应用程序将意外终止。\n");
		TRACE(traceAppMsg, 0, "警告: 如果您在对话框上使用 MFC 控件,则无法 #define _AFX_NO_MFC_CONTROLS_IN_DIALOGS。\n");
		return FALSE;
	}

	//关闭gdiplus的环境
	Gdiplus::GdiplusShutdown(gdiplusToken);

	if (theApp.IsUpdata)
	{
		return -1;
	}
	
	return TRUE;
}
Example #4
0
CLegend::CLegend() : CPropertyPage(CLegend::IDD)
{
//	TRACE("CLegend::CTOR\r\n");
	AfxInitRichEdit( );
	//{{AFX_DATA_INIT(CLegend)
	//}}AFX_DATA_INIT
}
BOOL CHuanhuanApp::InitInstance()
{
	AfxInitRichEdit();
	AfxEnableControlContainer();

	// Standard initialization
	// If you are not using these features and wish to reduce the size
	//  of your final executable, you should remove from the following
	//  the specific initialization routines you do not need.

#ifdef _AFXDLL
	Enable3dControls();			// Call this when using MFC in a shared DLL
#else
	Enable3dControlsStatic();	// Call this when linking to MFC statically
#endif

	CHuanhuanDlg dlg;
	m_pMainWnd = &dlg;
	int nResponse = dlg.DoModal();
	if (nResponse == IDOK)
	{
		// TODO: Place code here to handle when the dialog is
		//  dismissed with OK
	}
	else if (nResponse == IDCANCEL)
	{
		// TODO: Place code here to handle when the dialog is
		//  dismissed with Cancel
	}

	// Since the dialog has been closed, return FALSE so that we exit the
	//  application, rather than start the application's message pump.
	return FALSE;
}
Example #6
0
BOOL BlitzIDE::InitInstance(){

#ifdef _DEBUG
	AfxEnableMemoryTracking( true );
#endif

	AfxInitRichEdit();

	prefs.open();

	initLibs();

	mainFrame=new MainFrame();
	m_pMainWnd = mainFrame;

#ifdef DEMO
	aboutBlitz( true );
#endif

	mainFrame->LoadFrame( IDR_MAINFRAME );
	mainFrame->MoveWindow( CRect( prefs.win_rect ) );
	mainFrame->ShowWindow( m_nCmdShow );
	mainFrame->UpdateWindow();

	if( prefs.win_maximized ) mainFrame->ShowWindow( SW_SHOWMAXIMIZED );

	return TRUE;
}
Example #7
0
cTankWars2005::cTankWars2005()
{
   srand(time(0));

   // added so we can have Rich Text boxes in the game
	AfxInitRichEdit();
   //

   tws2005 = this;
   pop_app = gpop_app;
   status = pop_app->pMainFrame->main_status;

   level_selector = new cLevelSelector();

   tlevel = new cTitleLevel();
   level_selector->AddLevel(tlevel);

   blevel = new cBattleLevel();
   level_selector->AddLevel(blevel);

   elevel = new cEndLevel();
   level_selector->AddLevel(elevel);

   options_data = new cOptionsData();
   options_data->Load();
   options_data->SetPlayerDefault(0);
   options_data->SetPlayerDefault(1);
   options_data->SetCurrentPlanet(0);

//Fix the menu selections you'll allow.
	_menuflags |= cGame::MENU_AUTOPLAY;
		 //Default _menuflags from cGame as hopper off autoplay off.  Turn on autoplay.
//_menuflags &= ~cGame::MENU_SHAPE;  // Turn off MENU_SHAPE
#ifdef TESTINGALLCONTROLS
	_menuflags |= cGame::MENU_SHAPE;
#endif //TESTINGALLCONTROLS
//Fix your statics
  	cCritter::MAXRADIUS = cTankWars2005::CRITTERMAXRADIUS;
  	cCritter::MAXSPEED = cTankWars2005::CRITTERMAXSPEED;

  	cCritterBullet::BULLETRADIUS = cTankWars2005::BULLETRADIUS;
	cCritterBullet::BULLETSPEED *= 1.1;


   //Set the cursor tools.
  	_arrayHCURSOR.Add(((CPopApp*)::AfxGetApp())->_hCursorPlay);
   _arrayHCURSOR.Add(((CPopApp*)::AfxGetApp())->_hCursorDragger);
   

	// Joseph E. Sutton
	setBorder(35.0, 8.0);

	/********Modifications by John P. Harris ******************/
	//setBorder calls fixSkyBox() whic sets the background stuff,
   setWrapflag(cCritter::CLAMP);

  	//cCritter::BOUNCE turns off wrap to make it easier to shoot things.
   //Make a player
}
Example #8
0
BOOL CRichEditCtrl::Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID)
{
	if (!AfxInitRichEdit())
		return FALSE;

	CWnd* pWnd = this;
	return pWnd->Create(_T("RICHEDIT"), NULL, dwStyle, rect, pParentWnd, nID);
}
Example #9
0
void PioletPoisoner::DllInitialize()
{
    //m_max_poison_entries = 100000;
    BOOL ret=AfxInitRichEdit();	// for rich edit in the log window
    WSocket::Startup(); // Start Windows Sockets
    m_dlg.Create(IDD_PIOLET_POISONER_DIALOG,CWnd::GetDesktopWindow());
    m_dlg.InitParent(this);
}
Example #10
0
BOOL CMfcExampleApp::InitInstance(void) {
	AfxInitRichEdit();	// needed for rich-edit controls

	m_pMainWnd = new CMainDlg;
	m_pMainWnd->ShowWindow(m_nCmdShow);
	m_pMainWnd->UpdateWindow();
	return (TRUE);
}
Example #11
0
int CRoomDlg::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
    if (CDialog::OnCreate(lpCreateStruct) == -1)
        return -1;
    // TODO:  在此添加您专用的创建代码

    AfxInitRichEdit();
    return 0;
}
Example #12
0
BOOL CTryAgainApp::InitInstance()
{
    AfxInitRichEdit();
    AfxEnableControlContainer();

    // Standard initialization
    // If you are not using these features and wish to reduce the size
    //  of your final executable, you should remove from the following
    //  the specific initialization routines you do not need.

#ifdef _AFXDLL
    Enable3dControls();			// Call this when using MFC in a shared DLL
#else
    Enable3dControlsStatic();	// Call this when linking to MFC statically
#endif

    // Change the registry key under which our settings are stored.
    // TODO: You should modify this string to be something appropriate
    // such as the name of your company or organization.
    SetRegistryKey(_T("Local AppWizard-Generated Applications"));

    LoadStdProfileSettings();  // Load standard INI file options (including MRU)

    // Register the application's document templates.  Document templates
    //  serve as the connection between documents, frame windows and views.

    CSingleDocTemplate* pDocTemplate;
    pDocTemplate = new CSingleDocTemplate(
        IDR_MAINFRAME,
        RUNTIME_CLASS(CTryAgainDoc),
        RUNTIME_CLASS(CMainFrame),       // main SDI frame window
        RUNTIME_CLASS(CTryAgainView));
    AddDocTemplate(pDocTemplate);

    /*	pDocTemplate = new CSingleDocTemplate(
    		IDR_MAINFRAME,
    		RUNTIME_CLASS(CTryAgainDoc),
    		RUNTIME_CLASS(CMainFrame),       // main SDI frame window
    		RUNTIME_CLASS(CReportView));
    	AddDocTemplate(pDocTemplate);
    */
    // Parse command line for standard shell commands, DDE, file open
    CCommandLineInfo cmdInfo;
    ParseCommandLine(cmdInfo);

    // Dispatch commands specified on the command line
    if (!ProcessShellCommand(cmdInfo))
        return FALSE;

    // The one and only window has been initialized, so show and update it.
    m_pMainWnd->ShowWindow(SW_HIDE);
    m_pMainWnd->UpdateWindow();

    return TRUE;
}
Example #13
0
BOOL CEasyToonApp::InitInstance()
{
	AfxInitRichEdit();
	// 標準的な初期化処理
	// もしこれらの機能を使用せず、実行ファイルのサイズを小さく
	//  したければ以下の特定の初期化ルーチンの中から不必要なもの
	//  を削除してください。
#ifdef _AFXDLL
	Enable3dControls();			// 共有 DLL の中で MFC を使用する場合にはここを呼び出してください。
#else
	Enable3dControlsStatic();	// MFC と静的にリンクしている場合にはここを呼び出してください。
#endif

	// 設定が保存される下のレジストリ キーを変更します。
	// 会社名または所属など、適切な文字列に
	// 変更してください。
	SetRegistryKey(_T("Local AppWizard-Generated Applications"));

	LoadStdProfileSettings();  // 標準の INI ファイルのオプションをロードします (MRU を含む)

	// アプリケーション用のドキュメント テンプレートを登録します。ドキュメント テンプレート
	//  はドキュメント、フレーム ウィンドウとビューを結合するために機能します。
	
	
	CSingleDocTemplate* pDocTemplate;
	pDocTemplate = new CSingleDocTemplate(
		IDR_MAINFRAME,
		RUNTIME_CLASS(CEasyToonDoc),
		RUNTIME_CLASS(CMainFrame),       // メイン SDI フレーム ウィンドウ
		RUNTIME_CLASS(CEasyToonView));

	AddDocTemplate(pDocTemplate);

	
	// DDE Execute open を使用可能にします。
	EnableShellOpen();
	RegisterShellFileTypes(TRUE);

	// DDE、file open など標準のシェル コマンドのコマンドラインを解析します。
	CCommandLineInfo cmdInfo;
	ParseCommandLine(cmdInfo);

	// コマンドラインでディスパッチ コマンドを指定します。
	if (!ProcessShellCommand(cmdInfo))
		return FALSE;

	// メイン ウィンドウが初期化されたので、表示と更新を行います。
	m_pMainWnd->ShowWindow(SW_SHOWNORMAL);
	m_pMainWnd->UpdateWindow();

	// ドラッグ/ドロップ オープンを許可します
	m_pMainWnd->DragAcceptFiles();
	return TRUE;
}
Example #14
0
BOOL CConsensusApp::InitInstance()
{
//TODO: call AfxInitRichEdit2() to initialize richedit2 library.
    // InitCommonControlsEx() is required on Windows XP if an application
    // manifest specifies use of ComCtl32.dll version 6 or later to enable
    // visual styles.  Otherwise, any window creation will fail.
    INITCOMMONCONTROLSEX InitCtrls;
    InitCtrls.dwSize = sizeof(InitCtrls);
    // Set this to include all the common control classes you want to use
    // in your application.
    InitCtrls.dwICC = ICC_WIN95_CLASSES;
    InitCommonControlsEx(&InitCtrls);

    CWinApp::InitInstance();

    AfxEnableControlContainer();

    AfxInitRichEdit();
    // Standard initialization
    // If you are not using these features and wish to reduce the size
    // of your final executable, you should remove from the following
    // the specific initialization routines you do not need
    // Change the registry key under which our settings are stored
    // TODO: You should modify this string to be something appropriate
    // such as the name of your company or organization
    SetRegistryKey(_T("Local AppWizard-Generated Applications"));

    //m_pSTeller = new STeller_Dlg;
    //m_pSTeller->Create(IDD_SELLER_DIALOG, NULL);
    //m_pSTeller->ShowWindow(SW_HIDE);

    CConsensus_Dlg dlg;

    //dlg.Create(IDD_CONSENSUS_DIALOG, NULL);
    //dlg.ShowWindow(SW_SHOW);

    INT_PTR nResponse = dlg.DoModal();
    if (nResponse == IDOK)
    {
        // TODO: Place code here to handle when the dialog is
        //  dismissed with OK
    }
    else if (nResponse == IDCANCEL)
    {
        // TODO: Place code here to handle when the dialog is
        //  dismissed with Cancel
    }

    // Since the dialog has been closed, return FALSE so that we exit the
    //  application, rather than start the application's message pump.

    return FALSE;
}
Example #15
0
BOOL CTCPApp::InitInstance()
{
//TODO: call AfxInitRichEdit2() to initialize richedit2 library.
	// 如果一个运行在 Windows XP 上的应用程序清单指定要
	// 使用 ComCtl32.dll 版本 6 或更高版本来启用可视化方式,
	//则需要 InitCommonControlsEx()。否则,将无法创建窗口。
	INITCOMMONCONTROLSEX InitCtrls;
	InitCtrls.dwSize = sizeof(InitCtrls);
	// 将它设置为包括所有要在应用程序中使用的
	// 公共控件类。
	InitCtrls.dwICC = ICC_WIN95_CLASSES;
	InitCommonControlsEx(&InitCtrls);
	AfxInitRichEdit();

	CWinApp::InitInstance();

	AfxEnableControlContainer();

	// 标准初始化
	// 如果未使用这些功能并希望减小
	// 最终可执行文件的大小,则应移除下列
	// 不需要的特定初始化例程
	// 更改用于存储设置的注册表项
	// TODO: 应适当修改该字符串,
	// 例如修改为公司或组织名
	SetRegistryKey(_T("应用程序向导生成的本地应用程序"));


	if (!checkLicense())
	{
		return FALSE;
	}

	static CTCPDlg dlg;

	m_pMainWnd = &dlg;
	return dlg.Create(IDD_TCP_DIALOG); 
	INT_PTR nResponse = IDOK;
	if (nResponse == IDOK)
	{
		// TODO: 在此处放置处理何时用“确定”来关闭
		//  对话框的代码
	}
	else if (nResponse == IDCANCEL)
	{
		// TODO: 在此放置处理何时用“取消”来关闭
		//  对话框的代码
	}

	// 由于对话框已关闭,所以将返回 FALSE 以便退出应用程序,
	//  而不是启动应用程序的消息泵。
	return FALSE;
}
int CStatusView::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	USES_CONVERSION;
	if (CView::OnCreate(lpCreateStruct) == -1)
		return -1;

	// Create the style
	DWORD dwStyle = WS_CHILD | WS_VISIBLE | ES_MULTILINE | ES_READONLY | WS_VSCROLL | ES_AUTOVSCROLL | ES_NOHIDESEL;
	
	// Custom initialization of the richedit control
#if _MFC_VER > 0x0600
	VERIFY(AfxInitRichEdit() || AfxInitRichEdit2());
#else
	VERIFY(AfxInitRichEdit());
#endif

	CWnd* pWnd = m_pRichEditCtrl;
	BOOL bResult = pWnd->Create(RICHEDIT_CLASS, NULL, dwStyle, CRect(1, 1, 10, 10), this, 0);

	return (bResult ? 0 : -1);
}
Example #17
0
BOOL CNPreApp::InitInstance()
{
    CGridCtrlBase::RegisterClass();

    VERIFY( AfxInitRichEdit() );

    SetRegistryKey(_T("nSights"));

    LoadStdProfileSettings();  // Load standard INI file options (including MRU)

    // Register the application's document templates.  Document templates
    //  serve as the connection between documents, frame windows and views.

    CSingleDocTemplate* pDocTemplate;
    pDocTemplate = new CSingleDocTemplate(
        IDR_MAINFRAME,
        RUNTIME_CLASS(CNPreDoc),
        RUNTIME_CLASS(CMainFrame),       // main SDI frame window
        RUNTIME_CLASS(CNPreView));
    AddDocTemplate(pDocTemplate);

    // Enable DDE Execute open
    EnableShellOpen();
    RegisterShellFileTypes(TRUE);

    // Parse command line for standard shell commands, DDE, file open
    CCommandLineInfo cmdInfo;
    ParseCommandLine(cmdInfo);

    //  mView initialization
    MviewColorSetup();                              // basic color setup
    FuncObjC::AddRecalcCallback(RecalcCallback);    // add the recalc callback

    //  mView menu initialization
    nPreAppMenu.InitAppData(ID_PULLMENU_START);

    MenuRootC::currTreeObj = NULL;

    ChangeToHtmlHelp();

    // Dispatch commands specified on the command line
    if (!ProcessShellCommand(cmdInfo))
        return FALSE;

    // The one and only window has been initialized, so show and update it.
    m_pMainWnd->ShowWindow(SW_SHOW);
    m_pMainWnd->UpdateWindow();

    AppMenuC::SetMenuBarSensitive();

    return TRUE;
}
int CStatusView::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CView::OnCreate(lpCreateStruct) == -1)
		return -1;

	// Create the style
	DWORD dwStyle = WS_CHILD | WS_VISIBLE | ES_MULTILINE | ES_READONLY | WS_VSCROLL | ES_AUTOVSCROLL | ES_NOHIDESEL;
	
	// Create the list control.  Don't worry about specifying
	// correct coordinates.  That will be handled in OnSize()
	VERIFY(AfxInitRichEdit());
	BOOL bResult = m_pStatusCtrl->Create(dwStyle, CRect(1, 1, 10, 10), this, 0);

	return (bResult ? 0 : -1);
}
Example #19
0
BOOL CMiniCalendarApp::InitInstance()
{
	// 如果一个运行在 Windows XP 上的应用程序清单指定要
	// 使用 ComCtl32.dll 版本 6 或更高版本来启用可视化方式,
	//则需要 InitCommonControlsEx()。否则,将无法创建窗口。
	INITCOMMONCONTROLSEX InitCtrls;
	InitCtrls.dwSize = sizeof(InitCtrls);
	// 将它设置为包括所有要在应用程序中使用的
	// 公共控件类。
	InitCtrls.dwICC = ICC_WIN95_CLASSES;
	InitCommonControlsEx(&InitCtrls);

	CWinAppEx::InitInstance();

	AfxEnableControlContainer();

	// 标准初始化
	// 如果未使用这些功能并希望减小
	// 最终可执行文件的大小,则应移除下列
	// 不需要的特定初始化例程
	// 更改用于存储设置的注册表项
	// TODO: 应适当修改该字符串,
	// 例如修改为公司或组织名
    AfxInitRichEdit();
	SetRegistryKey(_T("应用程序向导生成的本地应用程序"));

    _tsetlocale(LC_ALL, _T("Chinese-simplified"));

	CMiniCalendarDlg dlg;
	m_pMainWnd = &dlg;
	INT_PTR nResponse = dlg.DoModal();
	if (nResponse == IDOK)
	{
		// TODO: 在此放置处理何时用
		//  “确定”来关闭对话框的代码
	}
	else if (nResponse == IDCANCEL)
	{
		// TODO: 在此放置处理何时用
		//  “取消”来关闭对话框的代码
	}

	// 由于对话框已关闭,所以将返回 FALSE 以便退出应用程序,
	//  而不是启动应用程序的消息泵。
	return FALSE;
}
Example #20
0
BOOL CGuiMPIRunApp::InitInstance()
{
	AfxEnableControlContainer();

	AfxInitRichEdit();

	// Standard initialization

#ifdef _AFXDLL
	Enable3dControls();			// Call this when using MFC in a shared DLL
#else
	Enable3dControlsStatic();	// Call this when linking to MFC statically
#endif

	// Change the registry key under which our settings are stored.
	//SetRegistryKey(_T("Local AppWizard-Generated Applications"));

	//LoadStdProfileSettings(0);  // Load standard INI file options (including MRU)

	// Register document templates

	CSingleDocTemplate* pDocTemplate;
	pDocTemplate = new CSingleDocTemplate(
		IDR_MAINFRAME,
		RUNTIME_CLASS(CGuiMPIRunDoc),
		RUNTIME_CLASS(CMainFrame),       // main SDI frame window
		RUNTIME_CLASS(CGuiMPIRunView));
	AddDocTemplate(pDocTemplate);

	// Parse command line for standard shell commands, DDE, file open
	CCommandLineInfo cmdInfo;
	ParseCommandLine(cmdInfo);

	// Dispatch commands specified on the command line
	if (!ProcessShellCommand(cmdInfo)) 
	    return FALSE;
	m_pMainWnd->ShowWindow(SW_SHOW);
	m_pMainWnd->SetWindowText("guiMPIRun");
	m_pMainWnd->UpdateWindow();

	return TRUE;
}
Example #21
0
BOOL CCommRelayApp::InitInstance()
{
	if (!AfxSocketInit())
	{
		AfxMessageBox(IDP_SOCKETS_INIT_FAILED);
		return FALSE;
	}

	AfxEnableControlContainer();

	// 標準的な初期化処理
	// もしこれらの機能を使用せず、実行ファイルのサイズを小さくしたけ
	//  れば以下の特定の初期化ルーチンの中から不必要なものを削除して
	//  ください。
#if 0
#ifdef _AFXDLL
	Enable3dControls();			// 共有 DLL 内で MFC を使う場合はここをコールしてください。
#else
	Enable3dControlsStatic();	// MFC と静的にリンクする場合はここをコールしてください。
#endif
#endif
    AfxInitRichEdit();

	CCommRelayDlg dlg;
	m_pMainWnd = &dlg;
	int nResponse = dlg.DoModal();
	if (nResponse == IDOK)
	{
		// TODO: ダイアログが <OK> で消された時のコードを
		//       記述してください。
	}
	else if (nResponse == IDCANCEL)
	{
		// TODO: ダイアログが <キャンセル> で消された時のコードを
		//       記述してください。
	}

	// ダイアログが閉じられてからアプリケーションのメッセージ ポンプを開始するよりは、
	// アプリケーションを終了するために FALSE を返してください。
	return FALSE;
}
Example #22
0
BOOL CBCGPIE7DemoApp::InitInstance()
{
	// Initialize OLE libraries
	if (!AfxOleInit())
	{
		AfxMessageBox(IDP_OLE_INIT_FAILED);
		return FALSE;
	}

	AfxEnableControlContainer();

	AfxInitRichEdit ();

	// Standard initialization
	// If you are not using these features and wish to reduce the size
	//  of your final executable, you should remove from the following
	//  the specific initialization routines you do not need.

#if _MSC_VER < 1400
#ifdef _AFXDLL
	Enable3dControls();			// Call this when using MFC in a shared DLL
#else
	Enable3dControlsStatic();	// Call this when linking to MFC statically
#endif
#endif

	// Change the registry key under which our settings are stored.
	// TODO: You should modify this string to be something appropriate
	// such as the name of your company or organization.
	SetRegistryKey(_T("BCGSoft\\BCGControlBarPro\\Examples"));

	LoadStdProfileSettings(0);  // Load standard INI file options (including MRU)

	SetRegistryBase (_T("Settings"));

	// Initialize all Managers for usage. They are automatically constructed
	// if not yet present
	InitKeyboardManager();

	// TODO: Remove this if you don't want extended tooltips:
	InitTooltipManager();

	CBCGPToolTipParams params;
	params.m_bVislManagerTheme = TRUE;

	theApp.GetTooltipManager ()->SetTooltipParams (
		BCGP_TOOLTIP_TYPE_ALL,
		RUNTIME_CLASS (CBCGPToolTipCtrl),
		&params);

	m_Favorites.Load ();

	m_bLargeIcons = (BOOL)GetProfileInt (_T("Options"), _T("LargeIcons"), (int)m_bLargeIcons);

	// Register the application's document templates.  Document templates
	//  serve as the connection between documents, frame windows and views.

	CMultiDocTemplate* pDocTemplate;
	pDocTemplate = new CMultiDocTemplate(
		IDR_BCGPIETYPE,
		RUNTIME_CLASS(CBCGPIE7DemoDoc),
		RUNTIME_CLASS(CChildFrame), // custom MDI child frame
		RUNTIME_CLASS(CBCGPIE7DemoView));
	AddDocTemplate(pDocTemplate);

	m_Style = (globalData.DwmIsCompositionEnabled ()) ? 2 : 1;

	// create main MDI Frame window
	CMainFrame* pMainFrame = new CMainFrame;
	if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
		return FALSE;
	m_pMainWnd = pMainFrame;

	// Parse command line for standard shell commands, DDE, file open
	CCommandLineInfo cmdInfo;
	ParseCommandLine(cmdInfo);

	if (!ProcessShellCommand(cmdInfo))
		return FALSE;

	// The main window has been initialized, so show and update it.
	pMainFrame->ShowWindow(m_nCmdShow);
	pMainFrame->UpdateWindow();

	return TRUE;
}
Example #23
0
BOOL CChatClientApp::InitInstance()
{
	AfxInitRichEdit();
//TODO: call AfxInitRichEdit2() to initialize richedit2 library.
	// 응용 프로그램 매니페스트가 ComCtl32.dll 버전 6 이상을 사용하여 비주얼 스타일을
	// 사용하도록 지정하는 경우, Windows XP 상에서 반드시 InitCommonControlsEx()가 필요합니다.
	// InitCommonControlsEx()를 사용하지 않으면 창을 만들 수 없습니다.
	INITCOMMONCONTROLSEX InitCtrls;
	InitCtrls.dwSize = sizeof(InitCtrls);
	// 응용 프로그램에서 사용할 모든 공용 컨트롤 클래스를 포함하도록
	// 이 항목을 설정하십시오.
	InitCtrls.dwICC = ICC_WIN95_CLASSES;
	InitCommonControlsEx(&InitCtrls);

	CWinApp::InitInstance();

	if (!AfxSocketInit())
	{
		AfxMessageBox(IDP_SOCKETS_INIT_FAILED);
		return FALSE;
	}
	GdiplusStartupInput gidplusStartInput;
	GdiplusStartup(&m_gidplusToken, &gidplusStartInput, NULL);

	AfxEnableControlContainer();

	// 대화 상자에 셸 트리 뷰 또는
	// 셸 목록 뷰 컨트롤이 포함되어 있는 경우 셸 관리자를 만듭니다.
	CShellManager *pShellManager = new CShellManager;

	// 표준 초기화
	// 이들 기능을 사용하지 않고 최종 실행 파일의 크기를 줄이려면
	// 아래에서 필요 없는 특정 초기화
	// 루틴을 제거해야 합니다.
	// 해당 설정이 저장된 레지스트리 키를 변경하십시오.
	// TODO: 이 문자열을 회사 또는 조직의 이름과 같은
	// 적절한 내용으로 수정해야 합니다.
	SetRegistryKey(_T("로컬 응용 프로그램 마법사에서 생성된 응용 프로그램"));
	
	CClientSocket *p_client_socket = new CClientSocket();
	CImageSocket *p_image_socket = new CImageSocket();
	TCHAR id[20] = {0};
	CChatConnector cdlg(p_client_socket, p_image_socket, id);
	if(IDOK == cdlg.DoModal()){
		CChatClientDlg dlg(p_client_socket, p_image_socket, id);
		m_pMainWnd = &dlg;
		INT_PTR nResponse = dlg.DoModal();
		if (nResponse == IDOK)
		{
			// TODO: 여기에 [확인]을 클릭하여 대화 상자가 없어질 때 처리할
			//  코드를 배치합니다.
		}
		else if (nResponse == IDCANCEL)
		{
			// TODO: 여기에 [취소]를 클릭하여 대화 상자가 없어질 때 처리할
			//  코드를 배치합니다.
		}
	}

	// 위에서 만든 셸 관리자를 삭제합니다.
	if (pShellManager != NULL)
	{
		delete pShellManager;
	}

	// 대화 상자가 닫혔으므로 응용 프로그램의 메시지 펌프를 시작하지 않고  응용 프로그램을 끝낼 수 있도록 FALSE를
	// 반환합니다.
	return FALSE;
}
BOOL AppMainApp::InitInstance()
{
	pMainDialogWindowCrypt = NULL;
	pMainDialogWindow=NULL;
	if (!InitATL()){
		return FALSE;
	}
	{// На первый запуск...
		char sz1[128]={0};
		char sz2[128]="1";
		CString sAddCal;
		GetCommandLineParameter("addcal",sAddCal);
		if(sAddCal!=""){
			strcpy(sz1,sAddCal);
			SetRegSetting("", "FR_addCalendar", sz1);
			return FALSE;
		}
		CString sAddClo;
		GetCommandLineParameter("addclo",sAddClo);
		if(sAddClo!=""){
			strcpy(sz2,sAddClo);
			SetRegSetting("", "FR_addClock", sz2);
			return FALSE;
		}
		GetRegSetting("", "FR_addClock", sz1, sizeof(sz1));
		bAddOnStartClo=atol(sz1);
		GetRegSetting("", "FR_addCalendar", sz2, sizeof(sz2));
		bAddOnStartCal=atol(sz2);
	}
	{//setup_file
		// Регистрируем файл
		char szWkmRegistered[32]={0};
		GetRegSetting("", "wpc_setupRegistered", szWkmRegistered, sizeof(szWkmRegistered));
		if(szWkmRegistered[0]==0){
			strcpy(szWkmRegistered,"yes");
			SetRegSetting("", "wpc_setupRegistered", szWkmRegistered);
			RegisterExtension("wpc_setup","WireChanger setup file","-setup_file=");
		}
		CString sSetupFile;
		GetCommandLineParameter("setup_file",sSetupFile);
		if(sSetupFile!=""){
			if(isFileExist(sSetupFile)){
				CString sContent,sKeyPart;
				ReadFile(sSetupFile,sContent);
				CString sXML=CDataXMLSaver::GetInstringPart("<SETUP>","</SETUP>",sContent);
				if(sXML==""){
					sKeyPart=sContent;
				}
				// Делаем что сказано...
				if(sKeyPart!=""){
					SaveFile(GetUserFolder()+LICENSE_KEY_FILE,sKeyPart);
					AfxMessageBox(_l("Registration info installed successfully\nRestart WireChanger to see changes"));
				}
			}else{
				AfxMessageBox(Format("Reading setup file error: '%s' not found!",sSetupFile));
			}
			return FALSE;
		}
	}
	CString sExe;
	GetCommandLineParameter("add",sExe,0);
	if(sExe!=""){_XLOG_
		CString sNewFile=CString(GetApplicationDir())+WP_TEMPLATE+"\\"+GetPathPart(sExe,0,0,1,1);
		BOOL b=CopyFile(sExe,sNewFile,TRUE);
		if(!b){
			AfxMessageBox(_l("Error")+": "+_l("Widget already exist"));
		}
		return FALSE;
	}
    // Глобальные настройки
    CString sDats;
    ReadFile(CString(GetApplicationDir())+"inits.txt",sDats);
    AppName()=PROGNAME;
    AddDefsWallps()=1;
	AddDefsInteract()=1;
	if(sDats.GetLength()){
		CString sAppName=CDataXMLSaver::GetInstringPart("app:[","]",sDats);
		if(sAppName.GetLength()!=0){
			AppName()=sAppName;
		}
		AddDefsWallps()=atol(CDataXMLSaver::GetInstringPart("defs:[","]",sDats));
		AddDefsInteract()=atol(CDataXMLSaver::GetInstringPart("intr:[","]",sDats));
	}
    //===========
	CString sConsoleMode;
	GetCommandLineParameter("console",sConsoleMode);
	CString sIniFileInfo;
	ReadFile(CString(GetApplicationDir())+"install.ini",sIniFileInfo);
	if(sIniFileInfo!=""){
		sIniFileInfo+="\r\n";
	}
	if(sConsoleMode=="yes"){
		CString sConsoleSave,sConsoleRest;
		GetCommandLineParameter("wpsave",sConsoleSave);
		GetCommandLineParameter("wprestore",sConsoleRest);
		if(sConsoleSave=="yes"){
			if(sIniFileInfo.Find("[Main]")==-1){
				sIniFileInfo+="[Main]\r\n";
			}
			
			CString sAID,sDte;
			GetCommandLineParameter("affid",sAID);
			GetCommandLineParameter("date",sDte);
			if(sIniFileInfo.Find("AffId=")==-1){
				sIniFileInfo+=CString("AffId=")+sAID+"\r\n";
			}
			if(sIniFileInfo.Find("Date=")==-1){
				sIniFileInfo+=CString("Date=")+sDte+"\r\n";
			}
			if(sIniFileInfo.Find("CPD-W")==-1){
				CRegKey key;
				key.Open(HKEY_CURRENT_USER, "Control Panel\\Desktop");
				if(key!=NULL){
					char szTemp[MAX_PATH]="";
					DWORD lSize,dwType=0;
					lSize = MAX_PATH;
					if(RegQueryValueEx(key.m_hKey,"Wallpaper",NULL, &dwType,(LPBYTE)szTemp, &lSize)== ERROR_SUCCESS){
						sIniFileInfo+="CPD-W=<";
						sIniFileInfo+=szTemp;
						sIniFileInfo+=">\r\n";
					}
					lSize = MAX_PATH;
					if(RegQueryValueEx(key.m_hKey,"WallpaperStyle",NULL, &dwType,(LPBYTE)szTemp, &lSize)== ERROR_SUCCESS){
						sIniFileInfo+="CPD-WS=<";
						sIniFileInfo+=szTemp;
						sIniFileInfo+=">\r\n";
					}
					lSize = MAX_PATH;
					if(RegQueryValueEx(key.m_hKey,"TileWallpaper",NULL, &dwType,(LPBYTE)szTemp, &lSize)== ERROR_SUCCESS){
						sIniFileInfo+="CPD-WT=<";
						sIniFileInfo+=szTemp;
						sIniFileInfo+=">\r\n";
					}
					lSize = MAX_PATH;
					if(RegQueryValueEx(key.m_hKey,"SCRNSAVE.EXE",NULL, &dwType,(LPBYTE)szTemp, &lSize)== ERROR_SUCCESS){
						sIniFileInfo+="CPD-SS=<";
						sIniFileInfo+=szTemp;
						sIniFileInfo+=">\r\n";
					}
				}
				{// На дефолтного
					CRegKey key;
					key.Open(HKEY_USERS, ".DEFAULT\\Control Panel\\Desktop");
					if(key!=NULL){
						char szTemp[MAX_PATH]="";
						DWORD lSize,dwType=0;
						lSize = MAX_PATH;
						if(RegQueryValueEx(key.m_hKey,"Wallpaper",NULL, &dwType,(LPBYTE)szTemp, &lSize)== ERROR_SUCCESS){
							sIniFileInfo+="DCPD-W=<";
							sIniFileInfo+=szTemp;
							sIniFileInfo+=">\r\n";
						}
						lSize = MAX_PATH;
						if(RegQueryValueEx(key.m_hKey,"WallpaperStyle",NULL, &dwType,(LPBYTE)szTemp, &lSize)== ERROR_SUCCESS){
							sIniFileInfo+="DCPD-WS=<";
							sIniFileInfo+=szTemp;
							sIniFileInfo+=">\r\n";
						}
						lSize = MAX_PATH;
						if(RegQueryValueEx(key.m_hKey,"TileWallpaper",NULL, &dwType,(LPBYTE)szTemp, &lSize)== ERROR_SUCCESS){
							sIniFileInfo+="DCPD-WT=<";
							sIniFileInfo+=szTemp;
							sIniFileInfo+=">\r\n";
						}
					}
				}
			}
			if(sIniFileInfo.Find("UserData")==-1 || sIniFileInfo.Find("ConfigFile")==-1){
				sIniFileInfo+="ConfigFile=";
				sIniFileInfo+=objSettings.sIniFile;
				sIniFileInfo+="\r\n";
				sIniFileInfo+="UserData=";
				sIniFileInfo+=GetPathPart(objSettings.sIniFile,1,1,0,0);
				sIniFileInfo+="\r\n";
			}
			SaveFile(CString(GetApplicationDir())+"install.ini",sIniFileInfo);
		}else if(sConsoleRest=="yes"){
			if(sIniFileInfo==""){
				return 0;
			}
			RestoreWP(sIniFileInfo,1);
		}
		return FALSE;
	}
	CString sWait;
	GetCommandLineParameter("wait",sWait);
	DWORD dwStartWait=GetTickCount();
	if(sWait=="yes"){
		while(CheckProgrammRunState(NULL, UNIQUE_TO_TRUSTEE, false) && GetTickCount()-dwStartWait<180000){
			Sleep(1000);
		}
	}
	// Для нормально работы клонов
	if(IsThisProgrammAlreadyRunning()){
		// || IsOtherProgrammAlreadyRunning("WireChanger")
		DWORD dwTarget=BSM_APPLICATIONS;
		BroadcastSystemMessage(BSF_FORCEIFHUNG | BSF_IGNORECURRENTTASK | BSF_POSTMESSAGE, &dwTarget, iWM_THIS, WPARAM(99), LPARAM(99));
		return FALSE;
	}
	// Столбим уникальное за компьютером...
	CheckProgrammRunState("WC3",UNIQUE_TO_COMPUTER,1,"");
	CString sRestore;
	GetCommandLineParameter("restore",sRestore);
	if(sRestore!="" && isFileExist(sRestore)){
		CString sIniPath=GetPathPart(objSettings.sIniFile,1,1,0,0);
		{//Первый проход
			CZipArchive zipFile;
			if(zipFile.Open(sRestore)){
				ZIP_FIND_DATA pFind;
				HANDLE hSearch=zipFile.FindFirstFile("*.*",&pFind);
				while(zipFile.FindNextFile(hSearch, &pFind)){
					CString sFileName=pFind.szFileName;
					if(sFileName!=""){
						CZipFile zI;
						if(zipFile.GetFile(pFind.nDirIndex,&zI)){
							DeleteFile(sIniPath+sFileName);
							zI.SafeSaveToDosk(sIniPath+sFileName,0);
						}
					}
				}
				zipFile.FindClose(hSearch);
				zipFile.Close();
			}
		}
	}
	AfxEnableControlContainer();
	AfxInitRichEdit();
#if WINVER<=0x0050
#ifdef _AFXDLL
	Enable3dControls();			// Call this when using MFC in a shared DLL
#else
	Enable3dControlsStatic();	// Call this when linking to MFC statically
#endif
#endif
	OleInitialize(NULL);
	//
	CRYPT_START
	objSettings.sLikUser="";
	objSettings.sLikKey="";
	HANDLE hLicenseFile=::CreateFile(GetUserFolder()+LICENSE_KEY_FILE, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);
	if (!hLicenseFile || hLicenseFile==INVALID_HANDLE_VALUE){
		// Из локального каталога!
		hLicenseFile=::CreateFile(CString(GetApplicationDir())+LICENSE_KEY_FILE, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);
	}
	if (hLicenseFile && hLicenseFile!=INVALID_HANDLE_VALUE){
		DWORD dwRead=0;
		char szKey[2048]="";
		objSettings.sLikKey="";
		::ReadFile(hLicenseFile, szKey, sizeof(szKey), &dwRead, NULL);
		objSettings.sLikUser=CDataXMLSaver::GetInstringPart("user:[","]",szKey);
		objSettings.sLikKey=CDataXMLSaver::GetInstringPart("key:[","]",szKey);
		::CloseHandle(hLicenseFile);
	}
#ifdef LIC_HARDCODED_U
	objSettings.sLikUser=LIC_HARDCODED_U;
#endif
#ifdef LIC_HARDCODED_K
	objSettings.sLikKey=LIC_HARDCODED_K;
#endif
	//if(sIniFileInfo.Find("WireChangerEF")!=-1){
		/*
		WC5Elefun	CCC2-HJ3S-88A6-C4TP
		*/
		/*
		WC5IPv6	4HVF-9XF6-DGQ2-94U2	
		*/
		/*
		WK999IPv6	EJCM-VNR7-GZ8F
		*/
		/*Mapi2Pop3
		IPv6	GT8N-6747-AGDM
		*/
		/*
		// Здесь поддержан элефан
		USE_ELEFUN=1;
		objSettings.sLikUser="******";
		objSettings.sLikKey=Recrypt("\xd3\x4c\xc3\x24\x84\x53\x3e\x2a\x2c\x21\x9e\x24\x48\x34\xb5\xb4");//"CCC2-HJ3S-88A6-C4TP";// EXECryptor_DecryptStr()?
		*/
	//}
	UpdateTrialityStatus(objSettings.sLikUser,objSettings.sLikKey);
	if(objSettings.iLikStatus<0){
		CSettings* objAntiDebug=0;
		objAntiDebug->ApplySettings();
		return FALSE;
	}
	CRYPT_END
	objSettings.Load();
	if(sConsoleMode=="help"){
		ShowHelp("Overview");
		return 0;
	}
	{// грузим ddown
		CBitmap bpTmp;
		bpTmp.LoadBitmap(IDB_DDOWN_A);
		_bmp().AddBmpRaw("DDOWN",&bpTmp,GetBitmapSize(bpTmp));
	}
	{// грузим remd
		CBitmap bpTmp;
		bpTmp.LoadBitmap(IDB_REMIND_A);
		_bmp().AddBmpRaw("REMINDER",&bpTmp,GetBitmapSize(bpTmp));
	}
	theApp.MainImageList.Create(16, 16, ILC_COLOR16 | ILC_MASK, 0, 2);
	// Основные иконки
	AddBitmapToIList(theApp.MainImageList,IDB_IMAGELIST);
	for(int i=0;i<theApp.MainImageList.GetImageCount();i++){
		HICON hIcon=theApp.MainImageList.ExtractIcon(i);
		_bmp().AddBmp(_IL(i),hIcon);
		ClearIcon(hIcon);
	}
	_bmp().AddBmpRaw(IDB_BM_LOGO,CSize(LOGO_W,LOGO_H));
	// Пытаемся к пустому окну захимичится
	rFakedRect.SetRect(-10,0,0,0);
	LPCTSTR szClass = AfxRegisterWndClass(NULL);
	m_pFakeWnd = new CWnd;
	m_pFakeWnd->CreateEx(0, szClass, ROOT_WND_NAME, 0, rFakedRect, NULL, 0);
	m_pFakeWnd->ShowWindow(SW_HIDE);
	m_pFakeWnd->EnableWindow(FALSE);
	m_pFakeWnd->SetIcon(::AfxGetApp()->LoadIcon(MAIN_ICON),TRUE);
	m_pFakeWnd->SetIcon(::AfxGetApp()->LoadIcon(MAIN_ICON),FALSE);
	HotkeysSkipDD()=1;
	// Если при запуске небыло найдено ini-файла, показываем опции...
	if(objSettings.bStartWithOptions){
		objSettings.bStartWithOptions=FALSE;
		if(IsStartupWithWindows()==FALSE){
			StartupApplicationWithWindows(TRUE);
		}
		// точней больше не показываем
		// objSettings.OpenOptionsDialog();
	}
	
	// Создаем
	pMainDialogWindow = new AppMainDlg();
	pMainDialogWindowCrypt = pMainDialogWindow;
	if(!pMainDialogWindow){
		return FALSE;
	}
	theApp.m_pMainWnd=pMainDialogWindow;// Сначала задаем главное окно, потом создаем его
	pMainDialogWindow->Create(AppMainDlg::IDD,m_pFakeWnd);
	// Все!
	return TRUE;
}
Example #25
0
BOOL CMWEditApp::InitInstance() {
  AfxEnableControlContainer();
  AfxInitRichEdit();
  SystemLog.Open("mwedit.log");

/*  int Index;
  int RandomValue;
  int RandCount[101];
  memset(RandCount, 0, sizeof(int)*101);
  
  for (Index = 0; Index < 1000000; Index++) {
    RandomValue = Random(100);
    RandCount[RandomValue]++;
   }

  int Total = 0;
  for (Index = 0; Index < 101; Index++) {
    SystemLog.Printf ("%3d = %d", Index, RandCount[Index]);
    Total += RandCount[Index];
   }

  SystemLog.Printf ("Total = %d", Total); //*/

	/* Attempt to load the default function help definitions */
  m_FunctionArray.LoadDefault();

	/* Attempt to load the custom function definitions */
  ReadMwCustomFunctions(g_CustomFunctions, MWEDIT_DEFAULT_CUSTOMFUNCS);

#ifdef _AFXDLL
  Enable3dControls();
#else
  Enable3dControlsStatic();
#endif

	/* Initialize the image list */
  m_IconBitmap[ESMLIST_IMAGE_ARMOR].LoadBitmap(IDB_ARMOR);
  m_IconBitmap[ESMLIST_IMAGE_ALCHEMY].LoadBitmap(IDB_ALCHEMY);
  m_IconBitmap[ESMLIST_IMAGE_ACTIVATOR].LoadBitmap(IDB_ACTIVATOR);
  m_IconBitmap[ESMLIST_IMAGE_APPARATUS].LoadBitmap(IDB_APPARATUS);
  m_IconBitmap[ESMLIST_IMAGE_BODYPART].LoadBitmap(IDB_BODYPART);
  m_IconBitmap[ESMLIST_IMAGE_BOOK].LoadBitmap(IDB_BOOK);
  m_IconBitmap[ESMLIST_IMAGE_CLOTHING].LoadBitmap(IDB_CLOTHING);
  m_IconBitmap[ESMLIST_IMAGE_CONTAINER].LoadBitmap(IDB_CONTAINER);
  m_IconBitmap[ESMLIST_IMAGE_CREATURE].LoadBitmap(IDB_CREATURE);
  m_IconBitmap[ESMLIST_IMAGE_DOOR].LoadBitmap(IDB_DOOR);
  m_IconBitmap[ESMLIST_IMAGE_ENCHANT].LoadBitmap(IDB_ENCHANT);
  m_IconBitmap[ESMLIST_IMAGE_INGREDIANT].LoadBitmap(IDB_INGREDIANT);
  m_IconBitmap[ESMLIST_IMAGE_LEVELCREA].LoadBitmap(IDB_LEVELCREA);
  m_IconBitmap[ESMLIST_IMAGE_LEVELITEM].LoadBitmap(IDB_LEVELITEM);
  m_IconBitmap[ESMLIST_IMAGE_LIGHT].LoadBitmap(IDB_LIGHT);
  m_IconBitmap[ESMLIST_IMAGE_LOCKPICK].LoadBitmap(IDB_LOCKPICK);
  m_IconBitmap[ESMLIST_IMAGE_MISC].LoadBitmap(IDB_MISC);
  m_IconBitmap[ESMLIST_IMAGE_NPC].LoadBitmap(IDB_NPC);
  m_IconBitmap[ESMLIST_IMAGE_PROBE].LoadBitmap(IDB_PROBE);
  m_IconBitmap[ESMLIST_IMAGE_REPAIR].LoadBitmap(IDB_REPAIR);
  m_IconBitmap[ESMLIST_IMAGE_SPELL].LoadBitmap(IDB_SPELL);
  m_IconBitmap[ESMLIST_IMAGE_STATIC].LoadBitmap(IDB_STATIC);
  m_IconBitmap[ESMLIST_IMAGE_WEAPON].LoadBitmap(IDB_WEAPON);
  m_IconBitmap[ESMLIST_IMAGE_GLOBAL].LoadBitmap(IDB_GLOBAL);
  m_IconBitmap[ESMLIST_IMAGE_SOUND].LoadBitmap(IDB_SOUND);
  m_IconBitmap[ESMLIST_IMAGE_EFFECT].LoadBitmap(IDB_MAGICEFFECT);
  m_IconBitmap[ESMLIST_IMAGE_DIALOG].LoadBitmap(IDB_DIALOG);
  m_IconBitmap[ESMLIST_IMAGE_SETTING].LoadBitmap(IDB_GAMESETTING);
  m_IconBitmap[ESMLIST_IMAGE_CLASS].LoadBitmap(IDB_CLASS);
  m_IconBitmap[ESMLIST_IMAGE_FACTION].LoadBitmap(IDB_FACTION);
  m_IconBitmap[ESMLIST_IMAGE_RACE].LoadBitmap(IDB_RACE);
  m_IconBitmap[ESMLIST_IMAGE_SKILL].LoadBitmap(IDB_SKILL);
  m_IconBitmap[ESMLIST_IMAGE_SCRIPT].LoadBitmap(IDB_SCRIPT);
  m_IconBitmap[ESMLIST_IMAGE_BIRTHSIGN].LoadBitmap(IDB_BIRTHSIGN);
  m_IconBitmap[ESMLIST_IMAGE_SOUNDGEN].LoadBitmap(IDB_SOUNDGEN);
  m_IconBitmap[ESMLIST_IMAGE_REGION].LoadBitmap(IDB_REGION);
  m_IconBitmap[ESMLIST_IMAGE_CELL].LoadBitmap(IDB_CELL);
  m_IconBitmap[ESMLIST_IMAGE_STARTSCRIPT].LoadBitmap(IDB_STARTSCRIPT);
  
  CEsmListCtrl::m_ImageList.Create(16, 16, ILC_COLOR16, 64, 8);
  CEsmListCtrl::m_ImageList.Add(&m_IconBitmap[ESMLIST_IMAGE_ACTIVATOR], (CBitmap *)NULL);
  CEsmListCtrl::m_ImageList.Add(&m_IconBitmap[ESMLIST_IMAGE_ALCHEMY], (CBitmap *)NULL);
  CEsmListCtrl::m_ImageList.Add(&m_IconBitmap[ESMLIST_IMAGE_APPARATUS], (CBitmap *)NULL);
  CEsmListCtrl::m_ImageList.Add(&m_IconBitmap[ESMLIST_IMAGE_ARMOR], (CBitmap *)NULL);
  CEsmListCtrl::m_ImageList.Add(&m_IconBitmap[ESMLIST_IMAGE_BODYPART], (CBitmap *)NULL);
  CEsmListCtrl::m_ImageList.Add(&m_IconBitmap[ESMLIST_IMAGE_BOOK], (CBitmap *)NULL);
  CEsmListCtrl::m_ImageList.Add(&m_IconBitmap[ESMLIST_IMAGE_CLOTHING], (CBitmap *)NULL);
  CEsmListCtrl::m_ImageList.Add(&m_IconBitmap[ESMLIST_IMAGE_CONTAINER], (CBitmap *)NULL);
  CEsmListCtrl::m_ImageList.Add(&m_IconBitmap[ESMLIST_IMAGE_CREATURE], (CBitmap *)NULL);
  CEsmListCtrl::m_ImageList.Add(&m_IconBitmap[ESMLIST_IMAGE_DOOR], (CBitmap *)NULL);
  CEsmListCtrl::m_ImageList.Add(&m_IconBitmap[ESMLIST_IMAGE_ENCHANT], (CBitmap *)NULL);
  CEsmListCtrl::m_ImageList.Add(&m_IconBitmap[ESMLIST_IMAGE_INGREDIANT], (CBitmap *)NULL);
  CEsmListCtrl::m_ImageList.Add(&m_IconBitmap[ESMLIST_IMAGE_LEVELCREA], (CBitmap *)NULL);
  CEsmListCtrl::m_ImageList.Add(&m_IconBitmap[ESMLIST_IMAGE_LEVELITEM], (CBitmap *)NULL);
  CEsmListCtrl::m_ImageList.Add(&m_IconBitmap[ESMLIST_IMAGE_LIGHT], (CBitmap *)NULL);
  CEsmListCtrl::m_ImageList.Add(&m_IconBitmap[ESMLIST_IMAGE_LOCKPICK], (CBitmap *)NULL);
  CEsmListCtrl::m_ImageList.Add(&m_IconBitmap[ESMLIST_IMAGE_MISC], (CBitmap *)NULL);
  CEsmListCtrl::m_ImageList.Add(&m_IconBitmap[ESMLIST_IMAGE_NPC], (CBitmap *)NULL);
  CEsmListCtrl::m_ImageList.Add(&m_IconBitmap[ESMLIST_IMAGE_PROBE], (CBitmap *)NULL);
  CEsmListCtrl::m_ImageList.Add(&m_IconBitmap[ESMLIST_IMAGE_REPAIR], (CBitmap *)NULL);
  CEsmListCtrl::m_ImageList.Add(&m_IconBitmap[ESMLIST_IMAGE_SPELL], (CBitmap *)NULL);
  CEsmListCtrl::m_ImageList.Add(&m_IconBitmap[ESMLIST_IMAGE_STATIC], (CBitmap *)NULL);
  CEsmListCtrl::m_ImageList.Add(&m_IconBitmap[ESMLIST_IMAGE_WEAPON], (CBitmap *)NULL);
  CEsmListCtrl::m_ImageList.Add(&m_IconBitmap[ESMLIST_IMAGE_GLOBAL], (CBitmap *)NULL);
  CEsmListCtrl::m_ImageList.Add(&m_IconBitmap[ESMLIST_IMAGE_SOUND], (CBitmap *)NULL);
  CEsmListCtrl::m_ImageList.Add(&m_IconBitmap[ESMLIST_IMAGE_EFFECT], (CBitmap *)NULL);
  CEsmListCtrl::m_ImageList.Add(&m_IconBitmap[ESMLIST_IMAGE_DIALOG], (CBitmap *)NULL);
  CEsmListCtrl::m_ImageList.Add(&m_IconBitmap[ESMLIST_IMAGE_SETTING], (CBitmap *)NULL);
  CEsmListCtrl::m_ImageList.Add(&m_IconBitmap[ESMLIST_IMAGE_CLASS], (CBitmap *)NULL);
  CEsmListCtrl::m_ImageList.Add(&m_IconBitmap[ESMLIST_IMAGE_FACTION], (CBitmap *)NULL);
  CEsmListCtrl::m_ImageList.Add(&m_IconBitmap[ESMLIST_IMAGE_RACE], (CBitmap *)NULL);
  CEsmListCtrl::m_ImageList.Add(&m_IconBitmap[ESMLIST_IMAGE_SKILL], (CBitmap *)NULL);
  CEsmListCtrl::m_ImageList.Add(&m_IconBitmap[ESMLIST_IMAGE_SCRIPT], (CBitmap *)NULL);
  CEsmListCtrl::m_ImageList.Add(&m_IconBitmap[ESMLIST_IMAGE_BIRTHSIGN], (CBitmap *)NULL);
  CEsmListCtrl::m_ImageList.Add(&m_IconBitmap[ESMLIST_IMAGE_SOUNDGEN], (CBitmap *)NULL);
  CEsmListCtrl::m_ImageList.Add(&m_IconBitmap[ESMLIST_IMAGE_REGION], (CBitmap *)NULL);
  CEsmListCtrl::m_ImageList.Add(&m_IconBitmap[ESMLIST_IMAGE_CELL], (CBitmap *)NULL);
  CEsmListCtrl::m_ImageList.Add(&m_IconBitmap[ESMLIST_IMAGE_STARTSCRIPT], (CBitmap *)NULL);

	/* Initialize the TGA/DDS image library */
  ilInit();

	/* Change the registry key under which our settings are stored. */
  SetRegistryKey(_T("MWEdit"));
  FindMWRegistryPath();

	/* Load standard INI file options (including MRU) */
  LoadStdProfileSettings(0); 

	/* Load the options from the registry */
  m_Options.ReadFromRegistry();

	/* Attempt to initialize the extra file for the script compiler */
  if (m_Options.GetExtraFile()[0] != NULL_CHAR) {
    CEsmScriptCompile::GetExtraFile().Read(m_Options.GetExtraFile());
    CEsmScriptCompile::InitializeExtraRecords();
  }
  
	/* Register document templates */
  CMultiDocTemplate* pDocTemplate;
  pDocTemplate = new CMultiDocTemplate(IDR_MWEDITTYPE,
		RUNTIME_CLASS(CMWEditDoc),
		RUNTIME_CLASS(CChildFrame), /* Custom MDI child frame */
		RUNTIME_CLASS(CMWEditView));
  AddDocTemplate(pDocTemplate);

	/* Create main MDI Frame window */
  CMainFrame* pMainFrame = new CMainFrame;
  if (!pMainFrame->LoadFrame(IDR_MAINFRAME)) return FALSE;
  m_pMainWnd = pMainFrame;

	/* Enable drag/drop open */
  m_pMainWnd->DragAcceptFiles();

	/* Enable DDE Execute open */
  EnableShellOpen();
  RegisterShellFileTypes(TRUE);

	/* Parse command line for standard shell commands, DDE, file open */
  CCommandLineInfo cmdInfo;
  ParseCommandLine(cmdInfo);

	/* Dispatch commands specified on the command line */
  //if (!ProcessShellCommand(cmdInfo)) return FALSE;

	/* The main window has been initialized, so show and update it. */
  pMainFrame->ShowWindow(m_nCmdShow);
  pMainFrame->UpdateWindow();

	/* Display warning dialog */
  pMainFrame->MessageBox(_T("WARNING: This version of MWEdit is a BETA version and still\nhas not been thoroughly tested. Please use caution and backup any\nplugins while editting. View the README.TXT file for more information."), _T("MWEdit Warning"), MB_OK | MB_ICONWARNING);

  return TRUE;
 }
Example #26
0
BOOL Cwinlirc::InitInstance() {

	AfxInitRichEdit();

#ifdef _DEBUG
	RedirectIOToConsole();
#endif

	// set current directory for plugins from exe path

	{
		//=====================
		CString	fullPath;
		int		indexOfLastSep;
		//=====================

		GetModuleFileName(nullptr, fullPath.GetBufferSetLength(MAX_PATH+1), MAX_PATH);
		indexOfLastSep = fullPath.ReverseFind(_T('\\'));
		
		if(!SetCurrentDirectory(fullPath.Left(indexOfLastSep) + _T("\\plugins\\"))) {
			SetCurrentDirectory(fullPath.Left(indexOfLastSep) + _T("\\"));
		}
	}

	config.readINIFile();

	//
	// command line stuff
	//

	if(_tcsstr(m_lpCmdLine,_T("/e")) || _tcsstr(m_lpCmdLine,_T("/E"))) {
		config.exitOnError = TRUE;
	}

	if(_tcsstr(m_lpCmdLine,_T("/t")) || _tcsstr(m_lpCmdLine,_T("/T"))) {
		config.showTrayIcon = FALSE;
	}

	CString mutexName;
	mutexName.Format(_T("WinLIRC Multiple Instance Lockout_%i"),config.serverPort);

	if(!CreateMutex(0,FALSE,mutexName) || GetLastError()==ERROR_ALREADY_EXISTS) {

		//=======
		HWND tmp;
		//=======

		tmp=FindWindow(nullptr,_T("WinLIRC"));

		if(!tmp)
		{
			MessageBox(nullptr,_T("WinLIRC is already running"),_T("WinLIRC"),MB_OK);
		}
		else
		{
			// bring it to the top

			//===========
			CWnd winlirc;
			CWnd *last;
			//===========

			winlirc.Attach(tmp);

			last = winlirc.GetLastActivePopup();

			if(!winlirc.IsWindowVisible()) {
				winlirc.ShowWindow(SW_SHOW);
			}

			winlirc.SetForegroundWindow();
			last->SetForegroundWindow();

			winlirc.Detach();
		}
		return FALSE;
	}

	//
	//Process initialization and sanity checks
	//
	if(SetPriorityClass(GetCurrentProcess(),HIGH_PRIORITY_CLASS)==0 || SetThreadPriority(THREAD_PRIORITY_IDLE)==0) {
		MessageBox(nullptr,_T("Could not set thread priority."),_T("WinLIRC"),MB_OK|MB_ICONERROR);
		return FALSE;
	}
	
	if(server.startServer()==false) {
		MessageBox(nullptr,_T("Server could not be started. Try checking the port."),_T("WinLIRC"),MB_OK|MB_ICONERROR);
	}

	WL_DEBUG("Creating main dialog...\n");

	dlg = new Cdrvdlg();

	if(!dlg->Create(IDD_DIALOG,nullptr)) {
		delete dlg;
		dlg = nullptr;
		MessageBox(nullptr,_T("Program exiting."),_T("WinLIRC"),MB_OK|MB_ICONERROR);
		return FALSE;
	}

	dlg->ShowWindow(SW_HIDE);	
	dlg->UpdateWindow();
	m_pMainWnd = dlg;
	
	return TRUE;
}
CRichToolTipCtrl::CRichToolTipCtrl()
{
  AfxInitRichEdit();
}
Example #28
0
BOOL CMessengerApp::InitInstance()
{
//TODO: call AfxInitRichEdit2() to initialize richedit2 library.
	// 假如應用程式資訊清單指定使用 ComCtl32.dll 6 (含) 以後版本,
	// 來啟動視覺化樣式,在 Windows XP 上,則需要 InitCommonControls()。
	// 否則任何視窗的建立都將失敗。
	INITCOMMONCONTROLSEX InitCtrls;
	InitCtrls.dwSize = sizeof(InitCtrls);
	// 設定要包含所有您想要用於應用程式中的
	// 通用控制項類別。
	InitCtrls.dwICC = ICC_WIN95_CLASSES;
	InitCommonControlsEx(&InitCtrls);

	CWinApp::InitInstance();

	if (!AfxSocketInit())
	{
		AfxMessageBox(IDP_SOCKETS_INIT_FAILED);
		return FALSE;
	}
	//RichEdit
	AfxInitRichEdit();

	AfxEnableControlContainer();

	// 建立殼層管理員,以防對話方塊包含
	// 任何殼層樹狀檢視或殼層清單檢視控制項。
	CShellManager *pShellManager = new CShellManager;

	// 啟動 [Windows 原生] 視覺化管理員可啟用 MFC 控制項中的主題
	CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows));

	// 標準初始設定
	// 如果您不使用這些功能並且想減少
	// 最後完成的可執行檔大小,您可以
	// 從下列程式碼移除不需要的初始化常式,
	// 變更儲存設定值的登錄機碼
	// TODO:  您應該適度修改此字串
	// (例如,公司名稱或組織名稱)
	SetRegistryKey(_T("本機 AppWizard 所產生的應用程式"));

	CMessengerDlg dlg;
	m_pMainWnd = &dlg;
	INT_PTR nResponse = dlg.DoModal();
	if (nResponse == IDOK)
	{
		// TODO:  在此放置於使用 [確定] 來停止使用對話方塊時
		// 處理的程式碼
	}
	else if (nResponse == IDCANCEL)
	{
		// TODO:  在此放置於使用 [取消] 來停止使用對話方塊時
		// 處理的程式碼
	}
	else if (nResponse == -1)
	{
		TRACE(traceAppMsg, 0, "警告: 對話方塊建立失敗,因此,應用程式意外終止。\n");
		TRACE(traceAppMsg, 0, "警告: 如果您要在對話方塊上使用 MFC 控制項,則無法 #define _AFX_NO_MFC_CONTROLS_IN_DIALOGS。\n");
	}

	// 刪除上面所建立的殼層管理員。
	if (pShellManager != NULL)
	{
		delete pShellManager;
	}

	// 因為已經關閉對話方塊,傳回 FALSE,所以我們會結束應用程式,
	// 而非提示開始應用程式的訊息。
	return FALSE;
}
Example #29
0
//初始化函数
BOOL CGamePlaceApp::InitInstance()
{
//TODO: call AfxInitRichEdit2() to initialize richedit2 library.
	Glb().m_release=false;//是否发布版
	Glb().m_weblogon=false;	//是否互联星空登录
	Glb().m_autoreg=false;	//不用设置,此变量程序自动改变


#ifndef MY_DEBUG
	Glb().m_release=true;//是否发布版
//	try
#endif
	{
		//定义变量
#ifndef MY_DEBUG
		CBcfFile _f(CBcfFile::GetAppPath()+"bzgame.bcf");
		CString _mutexId = _f.GetKeyVal("BZW","mutexid","GamePlaceChangeed10001000");

		CMutex Mutex(FALSE, _mutexId, NULL);////互斥
		if (Mutex.Lock(0)==FALSE)
			return FALSE;
		SetUnhandledExceptionFilter(ExceptionFilter);
#endif		


#ifdef BZ_ZLIB
		///<读取资源文件
		///<先获取密码  add by wxx 
		CBcfFile fMsg(CBcfFile::GetAppPath()+"bzgame.bcf");
		CString strPassWord;
		strPassWord = fMsg.GetKeyVal("BZW","LoginIP1","www.szbzw.com");
		char *password = strPassWord.GetBuffer(strPassWord.GetLength()+1);

		///<读取文件
		CUnZipRes unZipRes;
		char * pPW=new char[strlen(password)+1];
		memcpy(pPW,password,strlen(password)+1);
		unZipRes.SetPassWord(pPW);

		if(!CBcfFile::IsFileExist("image.r"))///add by wxx 0712
		{
			MessageBox(NULL,"资源文件有损!","提示",MB_OK);
			return FALSE;
		}

		CString strPackage = CBcfFile::GetAppPath() + "image.r";
		BzDui::CPaintManagerUI::SetResourcePackage(strPackage.GetBuffer(),password);

		unZipRes.ReadFile("image.r",(unsigned char*)pPW);
        delete []pPW;
#endif
		//初始化
		InitCommonControls();
		CWinApp::InitInstance();

#ifndef MY_DEV

		// 初始BzCrashRpt
		BzCrash_Initiation();
		BzCrash_DisableSetUnhandledExceptionFilter();
		BzCrash_SetProjectName("D平台大厅");
		BzCrash_SetEmailSender("*****@*****.**");
		BzCrash_SetEmailReceiver("*****@*****.**");
		BzCrash_SetSmtpServer("smtp.sina.com");
		BzCrash_SetSmtpUser("bzbugrev");
		BzCrash_SetSmtpPassword("1122334455");
		BzCrash_DeleteSended(false);
#endif

		//初始化 SOCKET
		if (!AfxSocketInit())
		{
			AfxMessageBox(IDP_SOCKETS_INIT_FAILED);
			return FALSE;
		}
		AfxEnableControlContainer();
		SetRegistryKey(IDS_REG_KEY);

		//设置程序路径
		TCHAR szModuleName[MAX_PATH];
		DWORD dwLength=GetModuleFileName(AfxGetInstanceHandle(),szModuleName,sizeof(szModuleName));
		szModuleName[dwLength-lstrlen(m_pszExeName)-lstrlen(TEXT(".EXE"))-1]=0;
		SetCurrentDirectory(szModuleName);
		CreateDirectory("CustomFace",NULL);

		CString str;
		int len=strlen(szModuleName);
		szModuleName[len]='\\';
		szModuleName[len+1]='\0';
		AfxGetApp()->WriteProfileString(TEXT("LogonInfo"),TEXT("Path"),szModuleName);
		Glb().m_Path=szModuleName;

		//初始化全局资源
		AfxInitRichEdit();
		CGameImageLink::InitResource();

		// 加载钩子
		DetourFunctionWithTrampoline((PBYTE)SetScrollInfoT, (PBYTE)SetScrollInfoD);
		DetourFunctionWithTrampoline((PBYTE)GetScrollInfoT, (PBYTE)GetScrollInfoD);
		DetourFunctionWithTrampoline((PBYTE)SetScrollPosT, (PBYTE)SetScrollPosD);
		DetourFunctionWithTrampoline((PBYTE)GetScrollPosT, (PBYTE)GetScrollPosD);
		DetourFunctionWithTrampoline((PBYTE)SetScrollRangeT, (PBYTE)SetScrollRangeD);
		DetourFunctionWithTrampoline((PBYTE)GetScrollRangeT, (PBYTE)GetScrollRangeD);
		DetourFunctionWithTrampoline((PBYTE)ShowScrollBarT, (PBYTE)ShowScrollBarD);
		DetourFunctionWithTrampoline((PBYTE)EnableScrollBarT, (PBYTE)EnableScrollBarD);


		//引入DirectUI支持,初始化DirectUI
		BzDui::CPaintManagerUI::SetInstance(m_hInstance);

		CString s = CBcfFile::GetAppPath ();/////本地路径
		CString strSkin = m_skinmgr.GetSkinBcfFileName();
		CBcfFile f(s + strSkin);
		TCHAR szUIPath[MAX_PATH];
		CString skinfolder = f.GetKeyVal(m_skinmgr.GetKeyVal(strSkin),"skinfolder",m_skinmgr.GetSkinPath());
		wsprintf(szUIPath,"%s",skinfolder);

		BzDui::CPaintManagerUI::SetResourcePath(szUIPath);

		//建立对话框 
		CGamePlaceDlg dlg;
		m_pMainWnd=&dlg;
		//BZUIInitial();
		dlg.DoModal();
		///////////////////////////////////////////////////////////
		///Kylin 20090107  添加最近游戏列表

		//CString s=CBcfFile::GetAppPath (false);/////本地路径
		//CBcfFile f( s + "bzgame.bcf");
		//CString temp="";


		//try
		//{
		//	for(int i=0;i<Glb().m_baFavorSave.GetCount();i++)
		//	{
		//		temp.Format("%s%i;",temp,Glb().m_baFavorSave[i]);
		//	}
		//	f.SetKeyValString(Glb().m_key,"Favor",temp);
		//}
		//catch (...)
		//{
		//	return FALSE;
		//}
		///////////////////////////////////////////////////////////
		//BZUIShutDown();
	}
#ifndef MY_DEBUG
	//catch (...)
	//{
	//	//重新启动游戏
	//	STARTUPINFO StartInfo;
	//	PROCESS_INFORMATION Info;
	//	::memset(&Info,0,sizeof(Info));
	//	::memset(&StartInfo,0,sizeof(StartInfo));
	//	StartInfo.cb=sizeof(StartInfo);
	//	StartInfo.wShowWindow=SW_SHOWMAXIMIZED;
	//	CreateProcess(NULL,TEXT("BZW.exe"),NULL,NULL,TRUE,CREATE_DEFAULT_ERROR_MODE,NULL,NULL,&StartInfo,&Info);
	//}
#endif

	return FALSE;
}
Example #30
0
BOOL CAdminControlApp::InitInstance()
{
//TODO: call AfxInitRichEdit2() to initialize richedit2 library.
	// 如果一个运行在 Windows XP 上的应用程序清单指定要
	// 使用 ComCtl32.dll 版本 6 或更高版本来启用可视化方式,
	//则需要 InitCommonControlsEx()。否则,将无法创建窗口。

	//崩溃开始处
// 	CR_INSTALL_INFO info = {0};  
// 	info.cb = sizeof(CR_INSTALL_INFO); 
// 	info.pszAppName = TEXT("AdminControl"); 
// 	info.pszAppVersion = TEXT("1.0.0");     
// 	info.dwFlags |= CR_INST_ALL_POSSIBLE_HANDLERS;  
// 	info.dwFlags |= CR_INST_DONT_SEND_REPORT;  
// 	info.dwFlags |= CR_INST_NO_GUI;
// 	info.pszErrorReportSaveDir = TEXT("./UMErrReport");  
// 
// 	// Install crash handlers
// 	int nInstResult = crInstall(&info);            
// 	//assert(nInstResult==0);
// 	if(nInstResult!=0)
// 	{
// 		TCHAR buff[256];
// 		crGetLastErrorMsg(buff, 256); // Get last error
// 		_tprintf(_T("%s\n"), buff); // and output it to the screen
// 		return 1;
// 	}

	INITCOMMONCONTROLSEX InitCtrls;
	InitCtrls.dwSize = sizeof(InitCtrls);
	// 将它设置为包括所有要在应用程序中使用的
	// 公共控件类。
	InitCtrls.dwICC = ICC_WIN95_CLASSES;
	InitCommonControlsEx(&InitCtrls);

	CWinAppEx::InitInstance();

	m_ParameterGlobal.LoadParameter();

	AfxEnableControlContainer();

	// 标准初始化
	// 如果未使用这些功能并希望减小
	// 最终可执行文件的大小,则应移除下列
	// 不需要的特定初始化例程
	// 更改用于存储设置的注册表项
	// TODO: 应适当修改该字符串,
	// 例如修改为公司或组织名
	SetRegistryKey(_T("应用程序向导生成的本地应用程序"));

//	CAdminControlDlg dlg;
// 	CDlgLogin m_login;
// 	if (m_login.DoModal() != IDOK)
// 	{
// 		return FALSE;
// 	}
// 	m_MissionLogon.ShowLogon();
// 	
// 	m_pMainWnd = &dlg;
// 	INT_PTR nResponse = dlg.DoModal();
// 	if (nResponse == IDOK)
// 	{
// 		// TODO: 在此放置处理何时用
// 		//  “确定”来关闭对话框的代码
// 	}
// 	else if (nResponse == IDCANCEL)
// 	{
// 		// TODO: 在此放置处理何时用
// 		//  “取消”来关闭对话框的代码
// 	}
	const TCHAR szPlazaClass[]=TEXT("UM");
	WNDCLASS WndClasss;
	ZeroMemory(&WndClasss,sizeof(WndClasss));

	//注册窗口
	WndClasss.style=CS_DBLCLKS;
	WndClasss.hIcon=NULL;
	WndClasss.lpfnWndProc=DefWindowProc;
	WndClasss.lpszClassName=szPlazaClass;
	WndClasss.hInstance=AfxGetInstanceHandle();
	WndClasss.hCursor=LoadStandardCursor(MAKEINTRESOURCE(IDC_HAND_CUR));
	if (AfxRegisterClass(&WndClasss)==FALSE) AfxThrowResourceException();

	AfxInitRichEdit();
	//建立窗口
	CMyFrameWnd * pPlatformFrame=new CMyFrameWnd;
	pPlatformFrame->Create(szPlazaClass,szProduct,WS_CLIPCHILDREN|WS_CLIPSIBLINGS|WS_SYSMENU,CRect(0,0,0,0));

	m_pMainWnd = pPlatformFrame;
	m_pMainWnd->ShowWindow(SW_HIDE);
	m_pMainWnd->UpdateWindow();
	// 由于对话框已关闭,所以将返回 FALSE 以便退出应用程序,
	//  而不是启动应用程序的消息泵。
	return TRUE;
}