Ejemplo n.º 1
0
BOOL CMDIApp::InitInstance()
{
	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("Foss") );


	// 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;
	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_MDITYPE));
	m_hMDIAccel = ::LoadAccelerators(hInst, MAKEINTRESOURCE(IDR_MDITYPE));

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

	// window placement persistence
	pFrame->ActivateFrame( m_nCmdShow );

	return TRUE;
}
Ejemplo n.º 2
0
BOOL
mfc_boss::InitInstance()
{
  if (!AfxOleInit()) {  /* all this for richedit... */
    AfxMessageBox(IDP_OLE_INIT_FAILED);
    return 0;
  }

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

  SetRegistryKey(m_pszAppName); // AFX_IDS_APP_TITLE, considered IDR_MAINFRAME
  LoadStdProfileSettings(10); // Load standard INI file options (including MRU)

  mfc_template =
    new CMultiDocTemplate(IDR_EDITFRAME,
                          RUNTIME_CLASS(mfc_edit_doc),
                          RUNTIME_CLASS(mfc_edit_child),
                          RUNTIME_CLASS(mfc_edit_view));
  AddDocTemplate(mfc_template);

  /* create the main window, but don't show it until
   * the terminal window or a graphics child window is created
   * -- MFC Run method kills process if no main window */
  CMDIFrameWnd* fw = new mfc_frame_wnd;
  if (!fw->LoadFrame(IDR_MAINFRAME)) return 0;
  m_pMainWnd = fw;
  m_pMainWnd->DragAcceptFiles();

  EnableShellOpen();
  RegisterShellFileTypes(0);  /* do not register for printing */

  /* some command line stuff needs to be merged with w_init... */
  CCommandLineInfo cmd_info;
  ParseCommandLine(cmd_info);
  /* prevent opening an empty untitled document at startup */
  if (cmd_info.m_nShellCommand == CCommandLineInfo::FileNew)
    cmd_info.m_nShellCommand = CCommandLineInfo::FileNothing;
  if (!ProcessShellCommand(cmd_info)) return 0;

  the_worker=
    AfxBeginThread(RUNTIME_CLASS(mfc_worker), THREAD_PRIORITY_BELOW_NORMAL);
  return 1;
}
Ejemplo n.º 3
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;
}
Ejemplo n.º 4
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;
}
Ejemplo n.º 5
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;
}
Ejemplo n.º 6
0
Archivo: Reno.cpp Proyecto: 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;
}