示例#1
0
文件: mfcapp.cpp 项目: dhmunro/yorick
static void
mfc_show()
{
  if (!(mfc_showing&1)) {
    CMDIFrameWnd *fw = (CMDIFrameWnd *)(the_boss.m_pMainWnd);
    fw->ShowWindow(the_boss.m_nCmdShow);
    fw->UpdateWindow();
    mfc_showing |= 1;
  }
}
示例#2
0
BOOL CSimpViewApp::InitInstance()
{
    RandomParam::init();

    CMDIFrameWnd* pFrame = new CMainFrame;
    m_pMainWnd = pFrame;

    // Create main MDI frame window
    if (!pFrame->LoadFrame(IDR_MAINFRAME))
        return FALSE;

    // Load shared MDI menus and accelerator table
    HINSTANCE hInst = AfxGetResourceHandle();
    m_hMDIMenu  = ::LoadMenu(hInst, MAKEINTRESOURCE(IDR_STEP1_VIEW));
    m_hMDIAccel = ::LoadAccelerators(hInst, MAKEINTRESOURCE(IDR_STEP1_VIEW));

    pFrame->ShowWindow(m_nCmdShow);
    pFrame->UpdateWindow();
    pFrame->PostMessage(WM_COMMAND, ID_FILE_NEW);

    return TRUE;
}
示例#3
0
BOOL CReClass2015App::InitInstance()
{
	INITCOMMONCONTROLSEX InitCtrls;
	InitCtrls.dwSize = sizeof(InitCtrls);
	InitCtrls.dwICC = ICC_STANDARD_CLASSES;
	InitCommonControlsEx(&InitCtrls);

	CWinAppEx::InitInstance();

	if (!AfxOleInit())
	{
		AfxMessageBox(IDP_OLE_INIT_FAILED);
		return FALSE;
	}

	AfxEnableControlContainer();
	SetRegistryKey(_T("ReClass 2015"));
	EnableTaskbarInteraction(FALSE);
	InitContextMenuManager();
	InitKeyboardManager();
	InitTooltipManager();

	CMFCToolTipInfo ttParams;
	ttParams.m_bVislManagerTheme = TRUE;
	theApp.GetTooltipManager()->SetTooltipParams(AFX_TOOLTIP_TYPE_ALL, RUNTIME_CLASS(CMFCToolTipCtrl), &ttParams);

	crBackground		= GetProfileInt("Colors", "crBackground", crBackground);
	crSelect			= GetProfileInt("Colors", "crSelect", crSelect);
	crHidden			= GetProfileInt("Colors", "crHidden", crHidden);
	crOffset			= GetProfileInt("Colors", "crOffset", crOffset);
	crAddress			= GetProfileInt("Colors", "crAddress", crAddress);
	crType				= GetProfileInt("Colors", "crType", crType);
	crName				= GetProfileInt("Colors", "crName", crName);
	crIndex				= GetProfileInt("Colors", "crIndex", crIndex);
	crValue				= GetProfileInt("Colors", "crValue", crValue);
	crComment			= GetProfileInt("Colors", "crComment", crComment);	  
	crVTable			= GetProfileInt("Colors", "crVTable", crVTable);
	crFunction			= GetProfileInt("Colors", "crFunction", crFunction);
	crChar				= GetProfileInt("Colors", "crChar", crChar);
	crCustom			= GetProfileInt("Colors", "crCustom", crCustom);
	crHex				= GetProfileInt("Colors", "crHex", crHex);
	gbOffset			= GetProfileInt("Display", "gbOffset", gbOffset) > 0 ? true : false;
	gbAddress			= GetProfileInt("Display", "gbAddress", gbAddress) > 0 ? true : false;
	gbText				= GetProfileInt("Display", "gbText", gbText) > 0 ? true : false;
	gbFloat				= GetProfileInt("Display", "gbFloat", gbFloat) > 0 ? true : false;
	gbInt				= GetProfileInt("Display", "gbInt", gbInt) > 0 ? true : false;
	gbString			= GetProfileInt("Display", "gbString", gbString) > 0 ? true : false;
	gbPointers			= GetProfileInt("Display", "gbPointers", gbPointers) > 0 ? true : false;
	gbClassBrowser		= GetProfileInt("Display", "gbClassBrowser", gbClassBrowser) > 0 ? true : false;
	gbFilterProcesses	= GetProfileInt("Display", "gbFilterProcesses", gbFilterProcesses) > 0 ? true : false;


	// make toggle
	gbTop = false; //GetProfileInt("Display","gbTop",gbTop) > 0 ? true : false;

	CMDIFrameWnd* pFrame = new CMainFrame();
	m_pMainWnd = pFrame;
	if(!pFrame) 
		return FALSE;
	if (!pFrame->LoadFrame(IDR_MAINFRAME))
		return FALSE;

	HINSTANCE hInst = AfxGetResourceHandle();
	m_hMDIMenu  = ::LoadMenu(hInst, MAKEINTRESOURCE(IDR_ReClass2015TYPE));
	m_hMDIAccel = ::LoadAccelerators(hInst, MAKEINTRESOURCE(IDR_ReClass2015TYPE));

	HICON icon;
	icon = ::LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON_OPEN));		Icons.push_back(icon);
	icon = ::LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON_CLOSED));		Icons.push_back(icon);
	icon = ::LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON_CLASS));		Icons.push_back(icon);
	icon = ::LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON_METHOD));		Icons.push_back(icon);
	icon = ::LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON_VTABLE));		Icons.push_back(icon);
	icon = ::LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON_DELETE));		Icons.push_back(icon);
	icon = ::LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON_ADD));		Icons.push_back(icon);
	icon = ::LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON_RANDOM));		Icons.push_back(icon);
	icon = ::LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON_DROPARROW));	Icons.push_back(icon);
	icon = ::LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON_POINTER));	Icons.push_back(icon);
	icon = ::LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON_ARRAY));		Icons.push_back(icon);
	icon = ::LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON_CUSTOM));		Icons.push_back(icon);
	icon = ::LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON_ENUM));		Icons.push_back(icon);
	icon = ::LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON_FLOAT));		Icons.push_back(icon);
	icon = ::LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON_LEFT));		Icons.push_back(icon);
	icon = ::LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON_RIGHT));		Icons.push_back(icon);
	icon = ::LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON_MATRIX));		Icons.push_back(icon);
	icon = ::LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON_INTEGER));	Icons.push_back(icon);
	icon = ::LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON_TEXT));		Icons.push_back(icon);
	icon = ::LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON_UNSIGNED));	Icons.push_back(icon);
	icon = ::LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON_VECTOR));		Icons.push_back(icon);
	icon = ::LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON_CHANGE));		Icons.push_back(icon);
	icon = ::LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON_CAMERA));		Icons.push_back(icon);

	//Font.CreatePointFont(80,"Terminal");
	////Font.CreateFont(16, 8, 0, 0, FW_NORMAL,FALSE, FALSE, FALSE, 0, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,   DEFAULT_QUALITY, FIXED_PITCH, "Terminal");
	//FontWidth = 16;
	//FontHeight = 16;
	//FontWidth = 8;
	//FontHeight = 8;

	Font.CreateFont(16, 8, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, 0, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FIXED_PITCH, "Terminal");
	FontWidth = 8;
	FontHeight = 14;

	//FontWidth = 8;
	//FontHeight = 16;
	//Font.CreateFont(FontHeight, FontWidth, 0, 0, FW_NORMAL,FALSE, FALSE, FALSE, 0, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,   DEFAULT_QUALITY, FIXED_PITCH, "Fixedsys");
	//FontHeight = 14;

	//SmallFont.CreateFont(12, 8, 0, 0, FW_NORMAL,FALSE, FALSE, FALSE, 0, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,   DEFAULT_QUALITY, FIXED_PITCH, "Terminal");

	//UpdateMemoryMap();
	//UpdateExports();

	// Initialize the editor
	if (!Scintilla_RegisterClasses(AfxGetApp()->m_hInstance))
	{	
		AfxMessageBox("Scintilla failed to initiailze");
		return FALSE;
	}

	pFrame->ShowWindow(m_nCmdShow);
	pFrame->UpdateWindow();

	getDebugPriv();

	return TRUE;
}
示例#4
0
BOOL CQueryBuilderApp::InitInstance()
{
	HRESULT hRes = _Module.Init(NULL, m_hInstance);
	ATLASSERT(SUCCEEDED(hRes));

#ifndef _DEBUG
	// Setup exception handler
	BT_SetAppName(_T("ECL IDE"));
	BT_SetSupportEMail(_T("*****@*****.**"));
	BT_SetFlags(BTF_DETAILEDMODE | BTF_EDITMAIL | BTF_ATTACHREPORT);
    BT_SetSupportURL(_T("http://hpccsystems.com/support"));

	// = BugTrapServer ===========================================
	//BT_SetSupportServer(_T("localhost"), 9999);
	// - or -
	//BT_SetSupportServer(_T("127.0.0.1"), 9999);

	// = BugTrapWebServer ========================================
	//BT_SetSupportServer(_T("http://localhost/BugTrapWebServer/RequestHandler.aspx"), BUGTRAP_HTTP_PORT);

	// required since VS 2005 SP1
	BT_InstallSehFilter();
#endif
	// 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);

	CWinAppEx::InitInstance();

	// Initialize OLE libraries
	if (!AfxOleInit())
	{
		AfxMessageBox(IDP_OLE_INIT_FAILED);
		return FALSE;
	}
	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
	// 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
	HINSTANCE hInstanceResources = ::LoadLibrary(_T("en_us.dll"));
	_Module.SetResourceInstance(hInstanceResources);
	AfxSetResourceHandle(hInstanceResources);

	SetApplicationName(_T("eclide.exe"));
	boost::filesystem::path iniPath;
	GetIniPath(iniPath);
	CComPtr<IConfig> ini = CreateIConfig(QUERYBUILDER_INI, iniPath);
	CComPtr<IConfig> config = CreateIConfig(QUERYBUILDER_CFG);

	if (!hGrid)
		hGrid = ::LoadLibrary(SGRID::CGridCtrl::GetLibraryName());

	std::_tstring majorVersion;
	GetAppMajorVersion(majorVersion);

	SetRegistryKey((boost::_tformat(_T("HPCC Systems\\Version%1%")) % majorVersion).str().c_str());
	LoadStdProfileSettings(0);  // Load standard INI file options

	InitContextMenuManager();

	InitKeyboardManager();

	InitTooltipManager();
	CMFCToolTipInfo ttParams;
	ttParams.m_bVislManagerTheme = TRUE;
	theApp.GetTooltipManager()->SetTooltipParams(AFX_TOOLTIP_TYPE_ALL, RUNTIME_CLASS(CMFCToolTipCtrl), &ttParams);
	theApp.EnableTaskbarInteraction(false);

	//const TCHAR * path = _tgetenv(_T("PATH"));
	//if (path)
	//{
	//	const TCHAR * hpccbin = _tgetenv(_T("HPCCBIN"));
	//	if (hpccbin)
	//	{
	//		boost::filesystem::wpath eclccPath = hpccbin;
	//		eclccPath /= _T("eclcc.exe");
	//		if (boost::filesystem::exists(eclccPath))
	//		{
	//			std::_tstring envVar = _T("PATH=");
	//			envVar += hpccbin;
	//			envVar += _T(";");
	//			envVar += path;
	//			_tputenv(envVar.c_str());
	//			ini->Set(GLOBAL_COMPILER_LOCATION, eclccPath.native_file_string());
	//		}

	//		boost::filesystem::wpath stdLibPath = hpccbin;
	//		stdLibPath /= _T("ecllib");
	//		if (boost::filesystem::exists(stdLibPath))
	//		{
	//			ini->Set(GLOBAL_COMPILER_STDLIB, stdLibPath.native_file_string());
	//		}
	//	}
	//}

	// To create the main window, this code creates a new frame window
	// object and then sets it as the application's main window object
	CMDIFrameWnd* pFrame = new CMainFrame;
	if (!pFrame)
		return FALSE;
	m_pMainWnd = pFrame;
	// create main MDI frame window
	if (!pFrame->LoadFrame(IDR_MAINFRAME))
		return FALSE;
	// try to load shared MDI menus and accelerator table
	//TODO: add additional member variables and load calls for
	//	additional menu types your application may need
	//HINSTANCE hInst = AfxGetResourceHandle();
	//m_hMDIMenu  = ::LoadMenu(hInst, MAKEINTRESOURCE(IDR_QueryBuilderTYPE));
	//m_hMDIAccel = ::LoadAccelerators(hInst, MAKEINTRESOURCE(IDR_QueryBuilderTYPE));

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

	return TRUE;
}
示例#5
0
文件: Reno.cpp 项目: m1h4/Reno
BOOL CRenoApp::InitInstance()
{
	// Set common controls standard classes
	INITCOMMONCONTROLSEX commonControls;
	commonControls.dwSize = sizeof(commonControls);
	commonControls.dwICC = ICC_WIN95_CLASSES;

	// Initialize common controls
	if(!InitCommonControlsEx(&commonControls))
	{
		AfxMessageBox(IDP_CONTROLS_INIT_FAILED);
		return FALSE;
	}

	// Initialize winsock
	if(!AfxSocketInit())
	{
		AfxMessageBox(IDP_SOCKETS_INIT_FAILED);
		return FALSE;
	}

	// Set settings registry key, if not set the ini file will be used
	//SetRegistryKey(TEXT("Miha Software"));

	// Get the current directory and add it to the ini path so the ini does not get stored into win.ini
	TCHAR directory[MAX_PATH];
	GetModuleFileName(NULL,directory,sizeof(directory)/sizeof(TCHAR));
	PathRemoveFileSpec(directory);
	PathAppend(directory,m_pszProfileName);
 
	// Store the ini file path
	free((LPVOID)m_pszProfileName);
	m_pszProfileName = _tcsdup(directory);	// String gets free'd by mfc on app exit

	// Initialize super
	if(!CRenoSocketApp::InitInstance())
		return FALSE;

	// Initialize fonts
	if(!InitFonts())
		return FALSE;

	// Create the main window
	CMDIFrameWnd* pFrame = new CRenoMainFrame;
	if(!pFrame)
		return FALSE;

	// Set our local member pointer to the frame instance
	m_pMainWnd = pFrame;

	// Create main MDI frame window
	if(!pFrame->LoadFrame(IDR_MAINFRAME))
		return FALSE;

	// Try to load shared MDI menus and accelerator table
	// TODO Add additional member variables and load calls for additional menu types your application may need

	m_hCommandMenu = ::LoadMenu(AfxGetResourceHandle(),MAKEINTRESOURCE(IDR_COMMANDFRAME));
	m_hCommandAccelerator = ::LoadAccelerators(AfxGetResourceHandle(),MAKEINTRESOURCE(IDR_COMMANDFRAME));

	m_hChatMenu = ::LoadMenu(AfxGetResourceHandle(),MAKEINTRESOURCE(IDR_CHATFRAME));
	m_hChatAccelerator = ::LoadAccelerators(AfxGetResourceHandle(),MAKEINTRESOURCE(IDR_CHATFRAME));

	// Load the settings
	LoadSettings();

	// TODO Load the previous window placement

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

	// Create a inital command window
	// TODO Make it an option
	OnFileNew();

	return TRUE;
}