Exemple #1
0
LRESULT CMainFrame::OnCreate(LPCREATESTRUCT /*lParam*/)
{
	//
	// create command bar window
	//
	HWND hWndCmdBar = m_CmdBar.Create(
		m_hWnd,
		rcDefault,
		NULL,
		ATL_SIMPLE_CMDBAR_PANE_STYLE);

	// attach menu
	m_CmdBar.AttachMenu(GetMenu());
	// load command bar images
	m_CmdBar.SetImageSize(CSize(9,9));
	//	m_CmdBar.LoadImages(IDR_MAINFRAME);
	// remove old menu
	SetMenu(NULL);

	// set title
	WTL::CString strTitle;
	strTitle.LoadString( IDS_APPLICATION );
	SetWindowText(strTitle);

	//
	// setting up a tool bar
	//
	HWND hWndToolBar = CreateSimpleToolBarCtrl(
		m_hWnd, 
		IDR_MAINFRAME, 
		FALSE, 
		ATL_SIMPLE_TOOLBAR_PANE_STYLE | TBSTYLE_LIST);

	m_wndToolBar.Attach( hWndToolBar );
	m_wndToolBar.SetExtendedStyle( TBSTYLE_EX_MIXEDBUTTONS | TBSTYLE_EX_DRAWDDARROWS );

	//
	// patria:
	//
	// Some bitmaps are distorted when used with TB_ADDBITMAP
	// which is sent from CreateSimpleToolBarCtrl when the bitmap is not true color.
	// This is the case with IO-DATA's tool bar image.
	// As an workaround, we can directly create a image list directly
	// and replace the image list of the tool bar, which corrects such misbehaviors.
	//
	{
		CImageList imageList;
		WORD wWidth = 32; // we are using 32 x 32 buttons
		imageList.CreateFromImage(
			IDR_MAINFRAME, 
			wWidth, 
			1, 
			CLR_DEFAULT,
			IMAGE_BITMAP,
			LR_CREATEDIBSECTION | LR_DEFAULTSIZE);
		m_wndToolBar.SetImageList(imageList);
	}

	TBBUTTON tbButton = { 0 };
	TBBUTTONINFO tbButtonInfo = { 0 };
	TBREPLACEBITMAP replaceBitmap = { 0 };

	// Add strings to the tool bar
	m_wndToolBar.SetButtonStructSize(sizeof(TBBUTTON));
	for ( int i=0; i < m_wndToolBar.GetButtonCount(); i++ )
	{
		WTL::CString strCommand;

		m_wndToolBar.GetButton( i, &tbButton );
		tbButtonInfo.cbSize	= sizeof(TBBUTTONINFO);
		tbButtonInfo.dwMask = TBIF_STYLE;
		m_wndToolBar.GetButtonInfo( tbButton.idCommand, &tbButtonInfo );
		tbButtonInfo.dwMask = TBIF_TEXT | TBIF_STYLE;
		strCommand.LoadString( tbButton.idCommand );
		strCommand = strCommand.Right(
			strCommand.GetLength() - strCommand.Find('\n') - 1
			);
		tbButtonInfo.pszText = 
			const_cast<LPTSTR>(static_cast<LPCTSTR>(strCommand));
		tbButtonInfo.cchText = strCommand.GetLength();
		tbButtonInfo.fsStyle |= BTNS_SHOWTEXT | BTNS_AUTOSIZE;
		m_wndToolBar.AddString( tbButton.idCommand );
		m_wndToolBar.SetButtonInfo( tbButton.idCommand, &tbButtonInfo );
	}

#define ATL_CUSTOM_REBAR_STYLE \
	((ATL_SIMPLE_REBAR_STYLE & ~RBS_AUTOSIZE) | CCS_NODIVIDER)

	//
	// patria: reason to use ATL_CUSTOM_REBAR_STYLE
	//
	// ATL_SIMPLE_REBAR_STYLE (not a NO_BRODER style) has a problem
	// with theme-enabled Windows XP, 
	// rendering some transparent lines above the rebar.
	// 

	CreateSimpleReBar(ATL_CUSTOM_REBAR_STYLE);
	AddSimpleReBarBand(hWndCmdBar);
	AddSimpleReBarBand(m_wndToolBar.m_hWnd, NULL, TRUE);

	CReBarCtrl reBar = m_hWndToolBar;
	DWORD cBands = reBar.GetBandCount();
	for (DWORD i = 0; i < cBands; ++i)
	{
		REBARBANDINFO rbi = {0};
		rbi.cbSize = sizeof(REBARBANDINFO);
		rbi.fMask = RBBIM_STYLE;
		reBar.GetBandInfo(i, &rbi);
		rbi.fStyle |= RBBS_NOGRIPPER;
		reBar.SetBandInfo(i, &rbi);
	} 

// work on status bar, progress bar
	CreateSimpleStatusBar();

	RECT rectRefreshProgress;
	::GetClientRect(m_hWndStatusBar, &rectRefreshProgress);
	rectRefreshProgress.right = 300;
	m_wndRefreshProgress.Create(m_hWndStatusBar, &rectRefreshProgress, NULL, WS_CHILD | WS_VISIBLE);

	m_wndRefreshProgress.SetRange32(0, 100);
	m_wndRefreshProgress.SetPos(50);

	m_wndRefreshProgress.ShowWindow(SW_HIDE);

	m_viewTreeList.Create(
		*this, rcDefault, NULL,
		WS_BORDER | WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);


	m_viewTreeList.Initialize();

	m_hWndClient = m_viewTreeList;

	UIAddToolBar(m_wndToolBar);
	UISetCheck(ID_VIEW_TOOLBAR, 1);
	UISetCheck(ID_VIEW_STATUS_BAR, 1);

	// TODO : It will be better if we display splash window while
	//		the treeview is initialized

	PostMessage(WM_COMMAND, IDM_TOOL_REFRESH, 0);


	m_hEventCallback = 
		::NdasRegisterEventCallback(pNdasEventProc,m_hWnd);


	// register object for message filtering and idle updates
	CMessageLoop* pLoop = _Module.GetMessageLoop();
	ATLASSERT(pLoop != NULL);
	pLoop->AddMessageFilter(this);
	pLoop->AddIdleHandler(this);

	// FIXME : We need to remember the window size
	CRect rectResize;
	GetClientRect( rectResize );
	rectResize = CRect( rectResize.TopLeft(), CSize(500, 500) );
	ClientToScreen( rectResize );
	MoveWindow( rectResize );
	CenterWindow();
	return 0;
}
LRESULT CErrorReportDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{   
  // Mirror this window if RTL language is in use
  CString sRTL = Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("Settings"), _T("RTLReading"));
  if(sRTL.CompareNoCase(_T("1"))==0)
  {
    Utility::SetLayoutRTL(m_hWnd);
  }

  SetWindowText(Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("MainDlg"), _T("DlgCaption")));

	// Center the dialog on the screen
	CenterWindow();
	
  HICON hIcon = NULL;

  // Get custom icon
  hIcon = g_CrashInfo.GetCustomIcon();
  if(hIcon==NULL)
  {
    // Use default icon
    hIcon = ::LoadIcon(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDR_MAINFRAME));
  }

  // Set window icon
  SetIcon(hIcon, 0);

  // Get the first icon in the EXE image
  m_HeadingIcon = ExtractIcon(NULL, g_CrashInfo.GetReport(0).m_sImageName, 0);
  
  // If there is no icon in crashed EXE module, use IDI_APPLICATION system icon
  if(m_HeadingIcon == NULL)
  {
    m_HeadingIcon = ::LoadIcon(NULL, MAKEINTRESOURCE(IDI_APPLICATION));
  }  

  m_statSubHeader = GetDlgItem(IDC_SUBHEADER);
  
  m_link.SubclassWindow(GetDlgItem(IDC_LINK));   
  m_link.SetHyperLinkExtendedStyle(HLINK_COMMANDBUTTON);
  m_link.SetLabel(Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("MainDlg"), _T("WhatDoesReportContain")));
    
  m_linkMoreInfo.SubclassWindow(GetDlgItem(IDC_MOREINFO));
  m_linkMoreInfo.SetHyperLinkExtendedStyle(HLINK_COMMANDBUTTON);
  m_linkMoreInfo.SetLabel(Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("MainDlg"), _T("ProvideAdditionalInfo")));
    
  m_statEmail = GetDlgItem(IDC_STATMAIL);
  m_statEmail.SetWindowText(Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("MainDlg"), _T("YourEmail")));
  
  m_editEmail = GetDlgItem(IDC_EMAIL);
  
  m_statDesc = GetDlgItem(IDC_DESCRIBE);
  m_statDesc.SetWindowText(Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("MainDlg"), _T("DescribeProblem")));

  m_editDesc = GetDlgItem(IDC_DESCRIPTION);

  m_statIndent =  GetDlgItem(IDC_INDENT);
  
  m_chkRestart = GetDlgItem(IDC_RESTART);
  CString sCaption;
  sCaption.Format(Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("MainDlg"), _T("RestartApp")), g_CrashInfo.m_sAppName);
  m_chkRestart.SetWindowText(sCaption);
  m_chkRestart.SetCheck(BST_CHECKED);
  m_chkRestart.ShowWindow(g_CrashInfo.m_bAppRestart?SW_SHOW:SW_HIDE);

  m_statConsent = GetDlgItem(IDC_CONSENT);
  
  // Init font for consent string
  LOGFONT lf;
  memset(&lf, 0, sizeof(LOGFONT));
  lf.lfHeight = 11;
  lf.lfWeight = FW_NORMAL;
  lf.lfQuality = ANTIALIASED_QUALITY;
  _TCSCPY_S(lf.lfFaceName, 32, _T("Tahoma"));
  CFontHandle hConsentFont;
  hConsentFont.CreateFontIndirect(&lf);
  m_statConsent.SetFont(hConsentFont);

  if(g_CrashInfo.m_sPrivacyPolicyURL.IsEmpty())
    m_statConsent.SetWindowText(Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("MainDlg"), _T("MyConsent2")));
  else
    m_statConsent.SetWindowText(Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("MainDlg"), _T("MyConsent")));

  m_linkPrivacyPolicy.SubclassWindow(GetDlgItem(IDC_PRIVACYPOLICY));
  m_linkPrivacyPolicy.SetHyperLink(g_CrashInfo.m_sPrivacyPolicyURL);
  m_linkPrivacyPolicy.SetLabel(Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("MainDlg"), _T("PrivacyPolicy")));
  
  BOOL bShowPrivacyPolicy = !g_CrashInfo.m_sPrivacyPolicyURL.IsEmpty();  
  m_linkPrivacyPolicy.ShowWindow(bShowPrivacyPolicy?SW_SHOW:SW_HIDE);
  
  m_statCrashRpt = GetDlgItem(IDC_CRASHRPT);
  m_statHorzLine = GetDlgItem(IDC_HORZLINE);  

  m_btnOk = GetDlgItem(IDOK);
  m_btnOk.SetWindowText(Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("MainDlg"), _T("SendReport")));

  m_btnCancel = GetDlgItem(IDC_CANCEL);  
  if(g_CrashInfo.m_bQueueEnabled)
    m_btnCancel.SetWindowText(Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("MainDlg"), _T("OtherActions")));
  else
    m_btnCancel.SetWindowText(Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("MainDlg"), _T("CloseTheProgram")));

  // Init font for heading text
  memset(&lf, 0, sizeof(LOGFONT));
  lf.lfHeight = 25;
  lf.lfWeight = FW_NORMAL;
  lf.lfQuality = ANTIALIASED_QUALITY;
  _TCSCPY_S(lf.lfFaceName, 32, _T("Tahoma"));
  m_HeadingFont.CreateFontIndirect(&lf);

  m_Layout.SetContainerWnd(m_hWnd);
  m_Layout.Insert(m_linkMoreInfo);
  m_Layout.Insert(m_statIndent);
  m_Layout.Insert(m_statEmail, TRUE);
  m_Layout.Insert(m_editEmail, TRUE);
  m_Layout.Insert(m_statDesc, TRUE);
  m_Layout.Insert(m_editDesc, TRUE);
  m_Layout.Insert(m_chkRestart);
  m_Layout.Insert(m_statConsent);
  m_Layout.Insert(m_linkPrivacyPolicy);  
  m_Layout.Insert(m_statCrashRpt);
  m_Layout.Insert(m_statHorzLine, TRUE);
  m_Layout.Insert(m_btnOk);
  m_Layout.Insert(m_btnCancel, TRUE);

  ShowMoreInfo(FALSE);

  m_dlgProgress.Create(m_hWnd);
  m_dlgProgress.Start(TRUE);
  
	// register object for message filtering and idle updates
	CMessageLoop* pLoop = _Module.GetMessageLoop();
	ATLASSERT(pLoop != NULL);
	if(pLoop)
	{
	  pLoop->AddMessageFilter(this);
	  pLoop->AddIdleHandler(this);
	}

	UIAddChildWindowContainer(m_hWnd);

	return TRUE;
}
Exemple #3
0
LRESULT CMainFrame::OnCreate(UINT, WPARAM, LPARAM, BOOL&)
{
	PIXELFORMATDESCRIPTOR pfd =
	{
		sizeof(PIXELFORMATDESCRIPTOR), 1,
		PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER,
		PFD_TYPE_RGBA,
		32,// Color depth
		0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
		24,// Size of depth buffer
		0, 0,
		PFD_MAIN_PLANE,
		0, 0, 0, 0
	};

	UISetCheck(ID_VIEW_TOOLBAR, 1);
	UISetCheck(ID_VIEW_STATUS_BAR, 1);
	UISetCheck(ID_WINDOWS_CITYBLOCKS, 1);
	UISetCheck(ID_WINDOWS_PERIMETER, 1);
	UISetCheck(ID_WINDOWS_ATTRIBUTES, 1);
	UISetCheck(ID_WINDOWS_PROPERTIES, 1);
	UISetCheck(ID_VIEW_AUTO_CAMERA,     config.display.bAutoCenter);
	UISetCheck(ID_VIEW_WIREFRAME,       config.display.bWireframe);
	UISetCheck(ID_VIEW_TEST_PVS,        config.display.bTestPVS);
	UISetCheck(ID_VIEW_TEST_AI_CULLING, config.display.bTestAICulling);
	UISetCheck(ID_VIEW_RENDER_PSDL,     config.display.bRenderPSDL);
	UISetCheck(ID_VIEW_RENDER_BAI,      config.display.bRenderBAI);

	SetNumeral(config.display.eNumeral == ::Numeral::hex ? ID_VIEW_NUMERAL_HEX : ID_VIEW_NUMERAL_DEC);

	CreateSimpleToolBar();
	CToolBarCtrl tool = m_hWndToolBar;
	tool.SetStyle(tool.GetStyle() | TBSTYLE_FLAT);

	CreateSimpleStatusBar();

	UIAddMenuBar(m_hWnd);
	UIAddToolBar(m_hWndToolBar);

	SetMenuHandle(GetSubMenu(GetMenu(), 0));
	SetMaxEntries(16);
	SetMaxItemLength(20);

	while (!config.files.aRecentFiles.empty())
	{
		AddToList(config.files.aRecentFiles.top().c_str());
		config.files.aRecentFiles.pop();
	}

	m_hWndClient = m_view.Create(m_hWnd, rcDefault, NULL, WS_CHILD | WS_VISIBLE, WS_EX_CLIENTEDGE);
	m_view.SetDCPixelFormat(&pfd);
	m_view.SetFocus();

	// Initiate docking framework
	HWND hwndDock = m_dock.Create(m_hWnd, rcDefault);
	m_dock.SetClient(m_hWndClient);

	m_wndProps.Create    (m_hWnd, rcDefault, _T("Attribute Properties"), ATL_SIMPLE_DOCKVIEW_STYLE);
	m_wndAttribs.Create  (m_hWnd, rcDefault, _T("Block Attributes"),     ATL_SIMPLE_DOCKVIEW_STYLE);
	m_wndPerimeter.Create(m_hWnd, rcDefault, _T("Perimeter"),            ATL_SIMPLE_DOCKVIEW_STYLE);
	m_wndBlocks.Create   (m_hWnd, rcDefault, _T("City Blocks"),          ATL_SIMPLE_DOCKVIEW_STYLE);

	m_dock.AddWindow(m_wndProps);
	m_dock.AddWindow(m_wndAttribs);
	m_dock.AddWindow(m_wndPerimeter);
	m_dock.AddWindow(m_wndBlocks);
	m_dock.DockWindow(m_wndProps,	  DOCK_RIGHT);
	m_dock.DockWindow(m_wndAttribs,	  DOCK_RIGHT);
	m_dock.DockWindow(m_wndPerimeter, DOCK_LEFT);
	m_dock.DockWindow(m_wndBlocks,	  DOCK_LEFT);

	m_dock.SetPaneSize(DOCK_LEFT,  210);
	m_dock.SetPaneSize(DOCK_RIGHT, 210);

	m_hWndClient = hwndDock;

	m_psdlDoc.SetViews(&m_wndBlocks, &m_wndPerimeter, &m_wndAttribs, &m_wndProps);
	m_cpvsDoc.SetViews(&m_wndBlocks);
	m_psdlDoc.NewDocument();
	m_psdlDoc.UpdateViews();
	m_cpvsDoc.NewDocument();
	m_baiDoc.NewDocument();
	m_cpvsDoc.SetPSDL(m_psdlDoc.GetDocument());
	m_psdlDoc.GetView()->SetCPVS(m_cpvsDoc.GetDocument());

	SetEditingMode(ID_MODE_PSDL);
	UpdateCaption();

	// register object for message filtering and idle updates
	CMessageLoop* pLoop = _Module.GetMessageLoop();
	pLoop->AddMessageFilter(this);
	pLoop->AddIdleHandler(this);

	return 0;
}
Exemple #4
0
LRESULT CErrorReportDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{   	
	CErrorReportSender* pSender = CErrorReportSender::GetInstance();
	CCrashInfoReader* pCrashInfo = pSender->GetCrashInfo();

    // Mirror this window if RTL language is in use.
    CString sRTL = pSender->GetLangStr(_T("Settings"), _T("RTLReading"));
    if(sRTL.CompareNoCase(_T("1"))==0)
    {
        Utility::SetLayoutRTL(m_hWnd);
    }

	// Set dialog caption.
    SetWindowText(pSender->GetLangStr(_T("MainDlg"), _T("DlgCaption")));

    // Center the dialog on the screen.
    CenterWindow();

    HICON hIcon = NULL;

    // Get custom icon.
    hIcon = pCrashInfo->GetCustomIcon();
    if(hIcon==NULL)
    {
        // Use default icon, if custom icon is not provided.
        hIcon = ::LoadIcon(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDR_MAINFRAME));
    }

    // Set window icon.
    SetIcon(hIcon, 0);

    // Get the first icon in the EXE image and use it for header.
    m_HeadingIcon = ExtractIcon(NULL, pCrashInfo->GetReport(0)->GetImageName(), 0);

    // If there is no icon in crashed EXE module, use default IDI_APPLICATION system icon.
    if(m_HeadingIcon == NULL)
    {
        m_HeadingIcon = ::LoadIcon(NULL, MAKEINTRESOURCE(IDI_APPLICATION));
    }  

	// Init controls.

    m_statSubHeader = GetDlgItem(IDC_SUBHEADER);

    m_link.SubclassWindow(GetDlgItem(IDC_LINK));   
    m_link.SetHyperLinkExtendedStyle(HLINK_COMMANDBUTTON);
	m_link.SetLabel(pSender->GetLangStr(_T("MainDlg"), _T("WhatDoesReportContain")));

    m_linkMoreInfo.SubclassWindow(GetDlgItem(IDC_MOREINFO));
    m_linkMoreInfo.SetHyperLinkExtendedStyle(HLINK_COMMANDBUTTON);
	m_linkMoreInfo.SetLabel(pSender->GetLangStr(_T("MainDlg"), _T("ProvideAdditionalInfo")));

    m_statEmail = GetDlgItem(IDC_STATMAIL);
    m_statEmail.SetWindowText(pSender->GetLangStr(_T("MainDlg"), _T("YourEmail")));

    m_editEmail = GetDlgItem(IDC_EMAIL);
	m_editEmail.SetWindowText(pSender->GetCrashInfo()->GetPersistentUserEmail());

    m_statDesc = GetDlgItem(IDC_DESCRIBE);
    m_statDesc.SetWindowText(pSender->GetLangStr(_T("MainDlg"), _T("DescribeProblem")));

    m_editDesc = GetDlgItem(IDC_DESCRIPTION);

    m_statIndent =  GetDlgItem(IDC_INDENT);

    m_chkRestart = GetDlgItem(IDC_RESTART);
    CString sCaption;
    sCaption.Format(pSender->GetLangStr(_T("MainDlg"), _T("RestartApp")), pSender->GetCrashInfo()->m_sAppName);
    m_chkRestart.SetWindowText(sCaption);
    m_chkRestart.SetCheck(BST_CHECKED);
    m_chkRestart.ShowWindow(pSender->GetCrashInfo()->m_bAppRestart?SW_SHOW:SW_HIDE);

    m_statConsent = GetDlgItem(IDC_CONSENT);

    // Init font for consent string.
    LOGFONT lf;
    memset(&lf, 0, sizeof(LOGFONT));
    lf.lfHeight = 11;
    lf.lfWeight = FW_NORMAL;
    lf.lfQuality = ANTIALIASED_QUALITY;
    _TCSCPY_S(lf.lfFaceName, 32, _T("Tahoma"));
    CFontHandle hConsentFont;
    hConsentFont.CreateFontIndirect(&lf);
    m_statConsent.SetFont(hConsentFont);

	// Set text of the static
    if(pSender->GetCrashInfo()->m_sPrivacyPolicyURL.IsEmpty())
        m_statConsent.SetWindowText(pSender->GetLangStr(_T("MainDlg"), _T("MyConsent2")));
    else
        m_statConsent.SetWindowText(pSender->GetLangStr(_T("MainDlg"), _T("MyConsent")));

	// Init Privacy Policy link
    m_linkPrivacyPolicy.SubclassWindow(GetDlgItem(IDC_PRIVACYPOLICY));
    m_linkPrivacyPolicy.SetHyperLink(pSender->GetCrashInfo()->m_sPrivacyPolicyURL);
    m_linkPrivacyPolicy.SetLabel(pSender->GetLangStr(_T("MainDlg"), _T("PrivacyPolicy")));

    BOOL bShowPrivacyPolicy = !pSender->GetCrashInfo()->m_sPrivacyPolicyURL.IsEmpty();  
    m_linkPrivacyPolicy.ShowWindow(bShowPrivacyPolicy?SW_SHOW:SW_HIDE);

    m_statCrashRpt = GetDlgItem(IDC_CRASHRPT);
    m_statHorzLine = GetDlgItem(IDC_HORZLINE);  

	// Init OK button
    m_btnOk = GetDlgItem(IDOK);
    m_btnOk.SetWindowText(pSender->GetLangStr(_T("MainDlg"), _T("SendReport")));

	// Init Cancel button
    m_btnCancel = GetDlgItem(IDC_CANCEL);  
    if(pSender->GetCrashInfo()->m_bQueueEnabled)
        m_btnCancel.SetWindowText(pSender->GetLangStr(_T("MainDlg"), _T("OtherActions")));
    else
        m_btnCancel.SetWindowText(pSender->GetLangStr(_T("MainDlg"), _T("CloseTheProgram")));

	// If send procedure is mandatory...
	if(pSender->GetCrashInfo()->m_bSendMandatory) 
	{
		// Hide Cancel button
		m_btnCancel.ShowWindow(SW_HIDE);
		// Remove Close button
		SetWindowLong(GWL_STYLE, GetWindowLong(GWL_STYLE) & ~WS_SYSMENU);
	}

    // Init font for heading text
    memset(&lf, 0, sizeof(LOGFONT));
    lf.lfHeight = 25;
    lf.lfWeight = FW_NORMAL;
    lf.lfQuality = ANTIALIASED_QUALITY;
    _TCSCPY_S(lf.lfFaceName, 32, _T("Tahoma"));
    m_HeadingFont.CreateFontIndirect(&lf);

	// Init control positions
    m_Layout.SetContainerWnd(m_hWnd);
    m_Layout.Insert(m_linkMoreInfo);
    m_Layout.Insert(m_statIndent);
    m_Layout.Insert(m_statEmail, TRUE);
    m_Layout.Insert(m_editEmail, TRUE);
    m_Layout.Insert(m_statDesc, TRUE);
    m_Layout.Insert(m_editDesc, TRUE);
    m_Layout.Insert(m_chkRestart);
    m_Layout.Insert(m_statConsent);
    m_Layout.Insert(m_linkPrivacyPolicy);  
    m_Layout.Insert(m_statCrashRpt);
    m_Layout.Insert(m_statHorzLine, TRUE);
    m_Layout.Insert(m_btnOk);
    m_Layout.Insert(m_btnCancel, TRUE);

	// By default, hide the email & description fields.
	// But user may override the default.
	ShowMoreInfo(pSender->GetCrashInfo()->m_bShowAdditionalInfoFields);

	// Create progress dialog
    m_dlgProgress.Create(m_hWnd);
    m_dlgProgress.Start(TRUE);

    // register object for message filtering and idle updates
    CMessageLoop* pLoop = _Module.GetMessageLoop();
    ATLASSERT(pLoop != NULL);
    if(pLoop)
    {
        pLoop->AddMessageFilter(this);        
    }

    UIAddChildWindowContainer(m_hWnd);

    return TRUE;
}
Exemple #5
0
LRESULT CMainDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
	// center the dialog on the screen
	CenterWindow();

	// set icons
	HICON hIcon = (HICON)::LoadImage(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDR_MAINFRAME), 
		IMAGE_ICON, ::GetSystemMetrics(SM_CXICON), ::GetSystemMetrics(SM_CYICON), LR_DEFAULTCOLOR);
	SetIcon(hIcon, TRUE);
	HICON hIconSmall = (HICON)::LoadImage(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDR_MAINFRAME), 
		IMAGE_ICON, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR);
	SetIcon(hIconSmall, FALSE);

  int nItem = 0;

  m_cboThread = GetDlgItem(IDC_THREAD);

  nItem = m_cboThread.AddString(_T("Main thread"));
  m_cboThread.SetItemData(nItem, 0);
  
  nItem = m_cboThread.AddString(_T("Worker thread"));
  m_cboThread.SetItemData(nItem, 1);

  m_cboThread.SetCurSel(0);

  m_cboExcType = GetDlgItem(IDC_EXCTYPE);
  
  nItem = m_cboExcType.AddString(_T("SEH exception"));
  m_cboExcType.SetItemData(nItem, CR_SEH_EXCEPTION);

  nItem = m_cboExcType.AddString(_T("terminate"));
  m_cboExcType.SetItemData(nItem, CR_CPP_TERMINATE_CALL);

  nItem = m_cboExcType.AddString(_T("unexpected"));
  m_cboExcType.SetItemData(nItem, CR_CPP_UNEXPECTED_CALL);

  nItem = m_cboExcType.AddString(_T("pure virtual method call"));
  m_cboExcType.SetItemData(nItem, CR_CPP_PURE_CALL);

  nItem = m_cboExcType.AddString(_T("new operator fault"));
  m_cboExcType.SetItemData(nItem, CR_CPP_NEW_OPERATOR_ERROR);

  nItem = m_cboExcType.AddString(_T("buffer overrun"));
  m_cboExcType.SetItemData(nItem, CR_CPP_SECURITY_ERROR);

  nItem = m_cboExcType.AddString(_T("invalid parameter"));
  m_cboExcType.SetItemData(nItem, CR_CPP_INVALID_PARAMETER);

  nItem = m_cboExcType.AddString(_T("SIGABRT"));
  m_cboExcType.SetItemData(nItem, CR_CPP_SIGABRT);

  nItem = m_cboExcType.AddString(_T("SIGFPE"));
  m_cboExcType.SetItemData(nItem, CR_CPP_SIGFPE);

  nItem = m_cboExcType.AddString(_T("SIGILL"));
  m_cboExcType.SetItemData(nItem, CR_CPP_SIGILL);

  nItem = m_cboExcType.AddString(_T("SIGINT"));
  m_cboExcType.SetItemData(nItem, CR_CPP_SIGINT);

  nItem = m_cboExcType.AddString(_T("SIGSEGV"));
  m_cboExcType.SetItemData(nItem, CR_CPP_SIGSEGV);

  nItem = m_cboExcType.AddString(_T("SIGTERM"));
  m_cboExcType.SetItemData(nItem, CR_CPP_SIGTERM);

  nItem = m_cboExcType.AddString(_T("throw C++ typed exception"));
  m_cboExcType.SetItemData(nItem, CR_THROW);

  nItem = m_cboExcType.AddString(_T("Manual report"));
  m_cboExcType.SetItemData(nItem, MANUAL_REPORT);

  m_cboExcType.SetCurSel(0);

	// register object for message filtering and idle updates
	CMessageLoop* pLoop = _Module.GetMessageLoop();
	ATLASSERT(pLoop != NULL);
	pLoop->AddMessageFilter(this);
	pLoop->AddIdleHandler(this);

	UIAddChildWindowContainer(m_hWnd);

  if(m_bRestarted)
  {
    PostMessage(WM_POSTCREATE);    
  }

	return TRUE;
}
LRESULT CMainFrame::OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
    CreateSimpleToolBar();

    //	CreateSimpleStatusBar();
    // Create the multipane status bar and pass its handle to CUpdateUI.
    m_hWndStatusBar = m_wndStatusBar.Create ( *this );
    UIAddStatusBar ( m_hWndStatusBar );
    // Create the status bar panes.
    int anPanes[] = { ID_DEFAULT_PANE, IDPANE_SOURCE, IDPANE_SEARCH_TIME, IDPANE_DOWNLOADLIST, IDPANE_STATUS };

    m_wndStatusBar.SetPanes ( anPanes, 5, false );
    // Set the initial text for the status pane.
    UISetText( 1, _T("数据源:SIPO主服务器") );
    UISetText( 2, _T("检索时间:--") );
    //第三段要从数据库中读取
    UISetText( 4, _T(" 就绪 ") );

    UIAddToolBar(m_hWndToolBar);

    UISetCheck(ID_VIEW_TOOLBAR, 1);
    UISetCheck(ID_VIEW_STATUS_BAR, 1);
    // 数据库初始化
    if(LRunSql::InitConnectPtr()==false)		//初始化COM环境,进行数据库连接
        return false;

    const DWORD dwSplitStyle = WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS,
                dwSplitExStyle = WS_EX_CLIENTEDGE;

    GetClientRect( &rcDefault );
    m_hWndClient = m_wndVertSplitter.Create( m_hWnd, rcDefault, NULL, dwSplitStyle, dwSplitExStyle);
    m_wndVertSplitter.m_bFullDrag = true;

    /************************************************************************/
    /* 树形结构                                                             */
    /************************************************************************/
    m_wndVertSplitter.GetClientRect(&rcDefault);
    m_MenuTree.Create( m_wndVertSplitter, rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | TVS_HASLINES | TVS_LINESATROOT | TVS_SHOWSELALWAYS | TVS_HASBUTTONS | TVS_EDITLABELS | WS_EX_CLIENTEDGE,0,(HMENU)IDC_LEFT_TREEVIEW);
    InitLeftTreeView(&m_MenuTree);


    m_wndHorzSplitter.Create( m_wndVertSplitter, rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN );
    m_wndHorzSplitter.m_bFullDrag = true;
    m_wndVertSplitter.SetSplitterPanes( m_MenuTree, m_wndHorzSplitter );

    m_TopVertSplitter.Create( m_wndHorzSplitter, rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN );
    m_wndHorzSplitter.m_bFullDrag = true;
    m_BottomVertSplitter.Create( m_wndHorzSplitter, rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN );
    m_wndHorzSplitter.SetSplitterPanes( m_TopVertSplitter, m_BottomVertSplitter );
    m_wndHorzSplitter.SetSinglePaneMode( SPLIT_PANE_BOTTOM );

    /************************************************************************/
    /* 浏览器窗口                                                           */
    /************************************************************************/
    //Create the bottom pane(browser)
    const DWORD dwIEStyle = WS_CHILD|WS_VISIBLE|WS_CLIPCHILDREN|WS_HSCROLL|WS_HSCROLL,
                dwIEExStyle = WS_EX_CLIENTEDGE;

    // 获得当前路径
    TCHAR szFilePath[MAX_PATH + 1];
    GetModuleFileName(NULL, szFilePath, MAX_PATH);
    (_tcsrchr(szFilePath, _T('\\')))[1] = 0;

    currentPath = szFilePath;
    CString mainWebPath = currentPath + "home.htm";

    m_MainWebBrowser.Create( m_BottomVertSplitter, rcDefault, mainWebPath, dwIEStyle, dwIEExStyle );

    m_InfoWebBrowser.Create( m_BottomVertSplitter, rcDefault, L"http://www.baidu.com", dwIEStyle, dwIEExStyle );

    m_BottomVertSplitter.SetSplitterPanes( m_MainWebBrowser, m_InfoWebBrowser);
    m_BottomVertSplitter.SetSinglePaneMode( SPLIT_PANE_LEFT );

    m_infoListDlg.Create(m_TopVertSplitter, rcDefault);
    m_TopHorzSplitter.Create( m_TopVertSplitter, rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN );
    m_TopVertSplitter.SetSplitterPanes( m_infoListDlg, m_TopHorzSplitter );

    m_downloadListDlg.Create( m_TopHorzSplitter, rcDefault);
    m_searchListDlg.Create( m_TopHorzSplitter, rcDefault);
    m_TopHorzSplitter.SetSplitterPanes( m_downloadListDlg, m_searchListDlg);


    // register object for message filtering and idle updates
    CMessageLoop* pLoop = _Module.GetMessageLoop();
    ATLASSERT(pLoop != NULL);
    pLoop->AddMessageFilter(this);
    pLoop->AddIdleHandler(this);

    UpdateLayout();

    m_wndVertSplitter.m_cxyMin = 150;
    m_wndVertSplitter.SetSplitterPos(200);
    m_wndHorzSplitter.SetSplitterPos(200);
    m_TopVertSplitter.SetSplitterPos(200);
    m_TopHorzSplitter.SetSplitterPos(100);



//	logfile.open("mylog.txt");
//	DeleteDirectory(L"D:\\My\ Documents\\Visual\ Studio\ 2008\\PatentSearcher\\PatentSearcher\\Debug\\TempFolder\\CN03113273.1\\");
//	DeleteDirectory(L"C:\\test\\");

    return 0;
}
Exemple #7
0
LRESULT CMainFrame::OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
	// create command bar window
	HWND hWndCmdBar = m_CmdBar.Create(m_hWnd, rcDefault, NULL, ATL_SIMPLE_CMDBAR_PANE_STYLE);
	// attach menu
	m_CmdBar.AttachMenu(GetMenu());
	// load command bar images
	m_CmdBar.LoadImages(IDR_MAINFRAME);
	// remove old menu
	SetMenu(NULL);

	HWND hWndToolBar = CreateSimpleToolBarCtrl(m_hWnd, IDR_MAINFRAME, FALSE, ATL_SIMPLE_TOOLBAR_PANE_STYLE);

	CreateSimpleReBar(ATL_SIMPLE_REBAR_NOBORDER_STYLE);
	AddSimpleReBarBand(hWndCmdBar);
	AddSimpleReBarBand(hWndToolBar, NULL, TRUE);

	CreateSimpleStatusBar();
	m_status.SubclassWindow(m_hWndStatusBar);

	int arrPanes[] = { ID_DEFAULT_PANE, IDI_OFFSET, IDI_LENGTH };
	m_status.SetPanes(arrPanes, sizeof(arrPanes) / sizeof(int), false);

	// set status bar pane widths using local workaround
	int arrWidths[] = { 0, 150, 150 };
	SetPaneWidths(arrWidths, sizeof(arrWidths) / sizeof(int));

	// set the status bar pane icons
	m_status.SetPaneIcon(ID_DEFAULT_PANE, AtlLoadIconImage(IDI_DEFAULT, LR_DEFAULTCOLOR));
	//m_status.SetPaneIcon(IDI_OFFSET, AtlLoadIconImage(IDI_OFFSET, LR_DEFAULTCOLOR));
	//m_status.SetPaneIcon(IDI_LENGTH, AtlLoadIconImage(IDI_LENGTH, LR_DEFAULTCOLOR));

	killProgramSem = CreateSemaphore(NULL, 1, 1, NULL);

	CreateMDIClient();
	ModifyStyleEx(0, WS_EX_ACCEPTFILES);

	// If you want to only show MDI tabs when there's more than one window, uncomment the following
	//CTabbedMDIClient<TTabCtrl>::TTabOwner& tabOwner = m_tabbedClient.GetTabOwner();
	//tabOwner.SetMinTabCountForVisibleTabs(2);

	// If you want to adjust the scroll "speed", here's how you could do it:
	//TTabCtrl& tabControl = tabOwner.GetTabCtrl();
	//tabControl.SetScrollDelta(10);
	//tabControl.SetScrollRepeat(TTabCtrl::ectcScrollRepeat_Slow);

	// If you want to use the MDI child's document icon, uncomment the following:
	//m_tabbedClient.UseMDIChildIcon(TRUE);

	// If you want to only show MDI tabs when the MDI children
	// are maximized, uncomment the following:
	//m_tabbedClient.HideMDITabsWhenMDIChildNotMaximized(TRUE);

	m_tabbedClient.SetTabOwnerParent(m_hWnd);
	BOOL bSubclass = m_tabbedClient.SubclassWindow(m_hWndMDIClient);
	bSubclass; // avoid warning on level 4
	//m_CmdBar.UseMaxChildDocIconAndFrameCaptionButtons(true);
	m_CmdBar.UseMaxChildDocIconAndFrameCaptionButtons(false);
	m_CmdBar.SetMDIClient(m_hWndMDIClient);

	UIAddToolBar(hWndToolBar);
	UISetCheck(ID_VIEW_TOOLBAR, 1);
	UISetCheck(ID_VIEW_STATUS_BAR, 1);

	UIEnable(ID_FILE_SAVE, 0);
	UIEnable(ID_STOP, 0);
	UIEnable(ID_PAUSE, 0);
	UIEnable(ID_PLAY, 0);

	// register object for message filtering and idle updates
	CMessageLoop* pLoop = _Module.GetMessageLoop();
	ATLASSERT(pLoop != NULL);
	pLoop->AddMessageFilter(this);
	pLoop->AddIdleHandler(this);

	if (!musicplayer.Init(m_hWnd))
		PostQuitMessage(1);


	FileFrameVis = false;

	InitializeDockingFrame();
	InitializeDefaultPanes();




	winroot.Init();
	//winroot.SetWndPtrs(this);

	PostMessage(CWM_INITIALIZE);

	return 0;
}
Exemple #8
0
LRESULT CMainDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
	// center the dialog on the screen
	CenterWindow();
	
  // Set window icon
  SetIcon(::LoadIcon(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDR_MAINFRAME)), 0);

  // Load heading icon
  HMODULE hExeModule = LoadLibrary(m_sImageName);
  if(hExeModule)
  {
    // Use IDR_MAINFRAME icon which is the default one for the crashed application.
    m_HeadingIcon = ::LoadIcon(hExeModule, MAKEINTRESOURCE(IDR_MAINFRAME));
  }  

  // If there is no IDR_MAINFRAME icon in crashed EXE module, use IDI_APPLICATION system icon
  if(m_HeadingIcon == NULL)
  {
    m_HeadingIcon = ::LoadIcon(NULL, MAKEINTRESOURCE(IDI_APPLICATION));
  }  
 
  m_link.SubclassWindow(GetDlgItem(IDC_LINK));   
  m_link.SetHyperLinkExtendedStyle(HLINK_COMMANDBUTTON);

  m_linkMoreInfo.SubclassWindow(GetDlgItem(IDC_MOREINFO));
  m_linkMoreInfo.SetHyperLinkExtendedStyle(HLINK_COMMANDBUTTON);

  m_statEmail = GetDlgItem(IDC_STATMAIL);
  m_editEmail = GetDlgItem(IDC_EMAIL);
  m_statDesc = GetDlgItem(IDC_DESCRIBE);
  m_editDesc = GetDlgItem(IDC_DESCRIPTION);
  m_statCrashRpt = GetDlgItem(IDC_CRASHRPT);
  m_statHorzLine = GetDlgItem(IDC_HORZLINE);
  m_btnOk = GetDlgItem(IDOK);
  m_btnCancel = GetDlgItem(IDCANCEL);

  CRect rc1, rc2;
  m_linkMoreInfo.GetWindowRect(&rc1);
  m_statHorzLine.GetWindowRect(&rc2);
  m_nDeltaY = rc1.bottom+15-rc2.top;

  LOGFONT lf;
  memset(&lf, 0, sizeof(LOGFONT));
  lf.lfHeight = 25;
  lf.lfWeight = FW_NORMAL;
  lf.lfQuality = ANTIALIASED_QUALITY;
  _TCSCPY_S(lf.lfFaceName, 32, _T("Tahoma"));
  m_HeadingFont.CreateFontIndirect(&lf);

  ShowMoreInfo(FALSE);

  m_dlgProgress.Create(m_hWnd);

	// register object for message filtering and idle updates
	CMessageLoop* pLoop = _Module.GetMessageLoop();
	ATLASSERT(pLoop != NULL);
	pLoop->AddMessageFilter(this);
	pLoop->AddIdleHandler(this);

	UIAddChildWindowContainer(m_hWnd);

	return TRUE;
}
Exemple #9
0
LRESULT CLoginDlg::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
	
	DoDataExchange();

	::ZeroMemory(&m_RegInfo, sizeof(m_RegInfo));
	
	// TODO: Add your message handler code here and/or call default
	HICON hIcon= ::LoadIcon(_Module.GetModuleInstance(), MAKEINTRESOURCE(IDR_MAINFRAME));
	SetIcon(hIcon, FALSE);
	DeleteObject(hIcon);
	
	SetTimer(1,100,NULL);

	CenterWindow();
	m_cfg.m_FileName = System::GetProcessPathName() +  L"\\PSDemo.ini";

	CString ISIP = m_cfg.Get(L"Config", L"ISIP",L"Auto");
	CString UserName = m_cfg.Get(L"Config", L"UserName", L"ps_test");
	CString Password = m_cfg.Get(L"Config", L"Password", L"123123");
	int   AppID		= m_cfg.Get(L"Config", L"AppID",1)
		, SubID		= m_cfg.Get(L"Config", L"SubID",1)
		, MajorVer	= m_cfg.Get(L"Config", L"MajorVer",1)
		, SubVer	= m_cfg.Get(L"Config", L"SubVer",1);
	
	CComboBox box = GetDlgItem(IDC_COMBO1);
	struct ISServer{ wchar_t * server; } Servers[] = {
		L"tcp://60.28.222.89:7788",
		L"tcp://60.28.222.89:7789",
		L"tcp://127.0.0.1:7788",
		L"auto",
		L"tcp://192.168.1.252:7788",
		L"tcp://192.168.1.13:7788",
		NULL,
	};
	for(u_int a=0; a<sizeof(Servers)/sizeof(ISServer); a++)
	{
		box.InsertString(0,Servers[a].server);
	}
	box.SetWindowText(ISIP);

	CMessageLoop* pLoop = _Module.GetMessageLoop();
	ATLASSERT(pLoop != NULL);
	pLoop->AddMessageFilter(this);
	pLoop->AddIdleHandler(this);


	box = GetDlgItem(IDC_APPID);
	for(int a=0; a<10; a++)
	{
		CString s;
		s.Format(L"%d", a);
		int nItem = box.InsertString(a, s);
		box.SetItemData(nItem, a);
	}
	box.SetCurSel(AppID);
	box = GetDlgItem(IDC_SUBID);
	for(int a=0; a<10; a++)
	{
		CString s;
		s.Format(L"%d", a);
		int nItem = box.InsertString(a, s);
		box.SetItemData(nItem, a);
	}
	box.SetCurSel(SubID);
	
	GetFramework()->SetUIClient(this);
	
	SetDlgItemText(IDC_USERNAME, UserName);
	SetDlgItemText(IDC_PASSWORD, Password);



	CString s;
	s.Format(L"PS - %s %s", _T(__DATE__), _T(__TIME__) );
	SetWindowText(s);

	m_mbtn.SubclassWindow(GetDlgItem(IDC_Game));
	m_mbtn.SpecailMenu(IDR_LOGINOPT);

	UIAddChildWindowContainer(m_hWnd);
//	logwin.Create(NULL,CWindow::rcDefault, L"LogWin");
	return TRUE;
}
Exemple #10
0
LRESULT CMainDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{ 
  CString sRTL = Utility::GetINIString(_T("Settings"), _T("RTLReading"));
  if(sRTL.CompareNoCase(_T("1"))==0)
  {
    Utility::SetLayoutRTL(m_hWnd);
  }

  SetWindowText(Utility::GetINIString(_T("MainDlg"), _T("DlgCaption")));

	// center the dialog on the screen
	CenterWindow();
	
  // Set window icon
  SetIcon(::LoadIcon(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDR_MAINFRAME)), 0);

  // Load heading icon
  HMODULE hExeModule = LoadLibrary(m_sImageName);
  if(hExeModule)
  {
    // Use IDR_MAINFRAME icon which is the default one for the crashed application.
    m_HeadingIcon = ::LoadIcon(hExeModule, MAKEINTRESOURCE(IDR_MAINFRAME));
  }  

  // If there is no IDR_MAINFRAME icon in crashed EXE module, use IDI_APPLICATION system icon
  if(m_HeadingIcon == NULL)
  {
    m_HeadingIcon = ::LoadIcon(NULL, MAKEINTRESOURCE(IDI_APPLICATION));
  }  

  CStatic statSubHeader = GetDlgItem(IDC_SUBHEADER);
  statSubHeader.SetWindowText(Utility::GetINIString(_T("MainDlg"), _T("SubHeaderText")));
 
  m_link.SubclassWindow(GetDlgItem(IDC_LINK));   
  m_link.SetHyperLinkExtendedStyle(HLINK_COMMANDBUTTON);
  m_link.SetLabel(Utility::GetINIString(_T("MainDlg"), _T("WhatDoesReportContain")));
  
  m_linkMoreInfo.SubclassWindow(GetDlgItem(IDC_MOREINFO));
  m_linkMoreInfo.SetHyperLinkExtendedStyle(HLINK_COMMANDBUTTON);
  m_linkMoreInfo.SetLabel(Utility::GetINIString(_T("MainDlg"), _T("ProvideAdditionalInfo")));
  
  m_linkPrivacyPolicy.SubclassWindow(GetDlgItem(IDC_PRIVACYPOLICY));
  m_linkPrivacyPolicy.SetHyperLink(m_sPrivacyPolicyURL);
  m_linkPrivacyPolicy.SetLabel(Utility::GetINIString(_T("MainDlg"), _T("PrivacyPolicy")));
  
  m_statEmail = GetDlgItem(IDC_STATMAIL);
  m_statEmail.SetWindowText(Utility::GetINIString(_T("MainDlg"), _T("YourEmail")));

  m_editEmail = GetDlgItem(IDC_EMAIL);
  
  m_statDesc = GetDlgItem(IDC_DESCRIBE);
  m_statDesc.SetWindowText(Utility::GetINIString(_T("MainDlg"), _T("DescribeProblem")));

  m_editDesc = GetDlgItem(IDC_DESCRIPTION);
  m_statCrashRpt = GetDlgItem(IDC_CRASHRPT);
  m_statHorzLine = GetDlgItem(IDC_HORZLINE);  
  
  m_btnOk = GetDlgItem(IDOK);
  m_btnOk.SetWindowText(Utility::GetINIString(_T("MainDlg"), _T("SendReport")));

  m_btnCancel = GetDlgItem(IDCANCEL);
  m_btnCancel.SetWindowText(Utility::GetINIString(_T("MainDlg"), _T("CloseTheProgram")));

  CRect rc1, rc2;
  m_linkMoreInfo.GetWindowRect(&rc1);
  m_statHorzLine.GetWindowRect(&rc2);
  m_nDeltaY = rc1.bottom+15-rc2.top;

  LOGFONT lf;
  memset(&lf, 0, sizeof(LOGFONT));
  lf.lfHeight = 25;
  lf.lfWeight = FW_NORMAL;
  lf.lfQuality = ANTIALIASED_QUALITY;
  _TCSCPY_S(lf.lfFaceName, 32, _T("Tahoma"));
  m_HeadingFont.CreateFontIndirect(&lf);

  ShowMoreInfo(FALSE);

  m_dlgProgress.Create(m_hWnd);

	// register object for message filtering and idle updates
	CMessageLoop* pLoop = _Module.GetMessageLoop();
	ATLASSERT(pLoop != NULL);
	pLoop->AddMessageFilter(this);
	pLoop->AddIdleHandler(this);

	UIAddChildWindowContainer(m_hWnd);

	return TRUE;
}
LRESULT CMainDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
	// center the dialog on the screen
	CenterWindow();

	// set icons
	HICON hIcon = (HICON)::LoadImage(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDR_MAINFRAME), 
		IMAGE_ICON, ::GetSystemMetrics(SM_CXICON), ::GetSystemMetrics(SM_CYICON), LR_DEFAULTCOLOR);
	SetIcon(hIcon, TRUE);
	HICON hIconSmall = (HICON)::LoadImage(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDR_MAINFRAME), 
		IMAGE_ICON, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR);
	SetIcon(hIconSmall, FALSE);

	// register object for message filtering and idle updates
	CMessageLoop* pLoop = _Module.GetMessageLoop();
	ATLASSERT(pLoop != NULL);
	pLoop->AddMessageFilter(this);
	pLoop->AddIdleHandler(this);

	UIAddChildWindowContainer(m_hWnd);

	gen1Frq = GetDlgItem(IDC_CAR_FREQ);
	gen1Atk = GetDlgItem(IDC_CAR_ATTACK);
	gen1Dec = GetDlgItem(IDC_CAR_DECAY);
	gen1Vol = GetDlgItem(IDC_CAR_VOLUME);
	gen1Sus = GetDlgItem(IDC_CAR_SUSTAIN);
	gen1Rel = GetDlgItem(IDC_CAR_RELEASE);
	gen1FrqEd = GetDlgItem(IDC_CFRQ_EDIT);
	gen1AtkEd = GetDlgItem(IDC_CATK_EDIT);
	gen1DecEd = GetDlgItem(IDC_CDEC_EDIT);
	gen1VolEd = GetDlgItem(IDC_CVOL_EDIT);
	gen1SusEd = GetDlgItem(IDC_CSUS_EDIT);
	gen1RelEd = GetDlgItem(IDC_CREL_EDIT);

	InitValue(gen1Frq, gen1FrqEd, 0, 120, 12);
	PutSetting(gen1Frq, gen1FrqEd, 48.0, 1, 120);
	InitValue(gen1Vol, gen1VolEd, 0, 100, 10);
	InitValue(gen1Sus, gen1SusEd, 0, 100, 10);
	InitValue(gen1Atk, gen1AtkEd, 0, 4000, 400);
	InitValue(gen1Dec, gen1DecEd, 0, 4000, 400);
	InitValue(gen1Rel, gen1RelEd, 0, 4000, 400);

	gen2Mul = GetDlgItem(IDC_MOD1_MULT);
	gen2Ndx = GetDlgItem(IDC_MOD1_START);
	gen2Atk = GetDlgItem(IDC_MOD1_ATTACK);
	gen2Pck = GetDlgItem(IDC_MOD1_PEAK);
	gen2Dec = GetDlgItem(IDC_MOD1_DECAY);
	gen2Sus = GetDlgItem(IDC_MOD1_SUSTAIN);
	gen2Rel = GetDlgItem(IDC_MOD1_RELEASE);
	gen2End = GetDlgItem(IDC_MOD1_END);
	gen2MulEd = GetDlgItem(IDC_M1M_EDIT);
	gen2NdxEd = GetDlgItem(IDC_M1I_EDIT);
	gen2AtkEd = GetDlgItem(IDC_M1A_EDIT);
	gen2PckEd = GetDlgItem(IDC_M1P_EDIT);
	gen2DecEd = GetDlgItem(IDC_M1D_EDIT);
	gen2SusEd = GetDlgItem(IDC_M1S_EDIT);
	gen2RelEd = GetDlgItem(IDC_M1R_EDIT);
	gen2EndEd = GetDlgItem(IDC_M1E_EDIT);

	InitValue(gen2Mul, gen2MulEd, 0,  100,  10);
	InitValue(gen2Ndx, gen2NdxEd, 0,  500,  50);
	InitValue(gen2Pck, gen2PckEd, 0,  500,  50);
	InitValue(gen2Sus, gen2SusEd, 0,  500,  50);
	InitValue(gen2End, gen2EndEd, 0,  500,  50);
	InitValue(gen2Atk, gen2AtkEd, 0, 4000, 400);
	InitValue(gen2Dec, gen2DecEd, 0, 4000, 400);
	InitValue(gen2Rel, gen2RelEd, 0, 4000, 400);

	gen3Mul = GetDlgItem(IDC_MOD2_MULT);
	gen3Ndx = GetDlgItem(IDC_MOD2_START);
	gen3Atk = GetDlgItem(IDC_MOD2_ATTACK);
	gen3Pck = GetDlgItem(IDC_MOD2_PEAK);
	gen3Dec = GetDlgItem(IDC_MOD2_DECAY);
	gen3Sus = GetDlgItem(IDC_MOD2_SUSTAIN);
	gen3Rel = GetDlgItem(IDC_MOD2_RELEASE);
	gen3End = GetDlgItem(IDC_MOD2_END);
	gen3MulEd = GetDlgItem(IDC_M2M_EDIT);
	gen3NdxEd = GetDlgItem(IDC_M2I_EDIT);
	gen3AtkEd = GetDlgItem(IDC_M2A_EDIT);
	gen3PckEd = GetDlgItem(IDC_M2P_EDIT);
	gen3DecEd = GetDlgItem(IDC_M2D_EDIT);
	gen3SusEd = GetDlgItem(IDC_M2S_EDIT);
	gen3RelEd = GetDlgItem(IDC_M2R_EDIT);
	gen3EndEd = GetDlgItem(IDC_M2E_EDIT);

	InitValue(gen3Mul, gen3MulEd, 0,  100,  10);
	InitValue(gen3Ndx, gen3NdxEd, 0,  500,  50);
	InitValue(gen3Pck, gen3PckEd, 0,  500,  50);
	InitValue(gen3Sus, gen3SusEd, 0,  500,  50);
	InitValue(gen3End, gen3EndEd, 0,  500,  50);
	InitValue(gen3Atk, gen3AtkEd, 0, 4000, 400);
	InitValue(gen3Dec, gen3DecEd, 0, 4000, 400);
	InitValue(gen3Rel, gen3RelEd, 0, 4000, 400);

	durValEd = GetDlgItem(IDC_DUR_EDIT);
	durValEd.SetWindowText("4.0");
	volValEd = GetDlgItem(IDC_VOL);
	volValEd.SetWindowText("0.707");

	btnPlay = GetDlgItem(IDC_PLAY);
	btnLoop = GetDlgItem(IDC_LOOP);
	btnStop = GetDlgItem(IDC_STOP);
	RECT btnrc;
	btnPlay.GetClientRect(&btnrc);
	int cxy;
	if ((btnrc.bottom - btnrc.top) < 30)
		cxy = 16;
	else
		cxy = 32;
	hIcon = (HICON) ::LoadImage(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDI_PLAY), IMAGE_ICON, cxy, cxy, LR_DEFAULTCOLOR);
	btnPlay.SetIcon(hIcon);
	hIcon = (HICON) ::LoadImage(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDI_LOOP), IMAGE_ICON, cxy, cxy, LR_DEFAULTCOLOR);
	btnLoop.SetIcon(hIcon);
	hIcon = (HICON) ::LoadImage(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDI_STOP), IMAGE_ICON, cxy, cxy, LR_DEFAULTCOLOR);
	btnStop.SetIcon(hIcon);
	btnStop.EnableWindow(FALSE);

	CButton btnStyle;
	HBITMAP bm;

	btnStyle = GetDlgItem(IDC_STACK);
	bm = (HBITMAP) ::LoadImage(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDB_STACK), IMAGE_BITMAP, 48, 48, LR_DEFAULTCOLOR);
	btnStyle.SetBitmap(bm);
	btnStyle.SetCheck(BST_CHECKED);
	btnStyle = GetDlgItem(IDC_STACK2);
	bm = (HBITMAP) ::LoadImage(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDB_STACK2), IMAGE_BITMAP, 48, 48, LR_DEFAULTCOLOR);
	btnStyle.SetBitmap(bm);
	btnStyle = GetDlgItem(IDC_WYE);
	bm = (HBITMAP) ::LoadImage(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDB_WYE), IMAGE_BITMAP, 48, 48, LR_DEFAULTCOLOR);
	btnStyle.SetBitmap(bm);
	btnStyle = GetDlgItem(IDC_DELTA);
	bm = (HBITMAP) ::LoadImage(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDB_DELTA), IMAGE_BITMAP, 48, 48, LR_DEFAULTCOLOR);
	btnStyle.SetBitmap(bm);

	btnStyle = GetDlgItem(IDC_COPY_CLIP);
	hIcon = (HICON) ::LoadImage(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDI_COPY), IMAGE_ICON, cxy, cxy, LR_DEFAULTCOLOR);
	btnStyle.SetIcon(hIcon);
	btnStyle = GetDlgItem(IDC_SAVE);
	hIcon = (HICON) ::LoadImage(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDI_WVFILE), IMAGE_ICON, cxy, cxy, LR_DEFAULTCOLOR);
	btnStyle.SetIcon(hIcon);
	btnStyle = GetDlgItem(IDC_HELP2);
	hIcon = (HICON) ::LoadImage(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDI_HELP2), IMAGE_ICON, cxy, cxy, LR_DEFAULTCOLOR);
	btnStyle.SetIcon(hIcon);

	SetPreset(&resetParams);

	return TRUE;
}
Exemple #12
0
LRESULT CNoteDlg::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
	BOOL bRet;
	HWND hWnd;
	DWORD dwStyle;

	// Create the brush 
	m_brBkgnd.CreateSolidBrush(GetNoteColor());
	
	// Set the sizing border width/height
	m_nSizeFrame = GetSystemMetrics(SM_CXSIZEFRAME);
	
	// Center the dialog on the screen
	CenterWindow();
	
	// Retrieve the coordinates of a dialog's client area
	CRect rectDlg; 
	GetClientRect(&rectDlg);
	
	// Subclass the static control displaying current date and time and 
	// attach it to the CStaticDateTime object
	bRet = m_wndStaticDateTime.SubclassWindow(GetDlgItem(IDC_STATIC_TIME));
	ATLASSERT(bRet);
	// Set the size and position of the control
	m_wndStaticDateTime.MoveWindow(5, rectDlg.Height() - 14, rectDlg.Width() / 2, 14);
	// Set the current date and time
	m_wndStaticDateTime.SetCurrentDateTime(GetTimestamp());
	// Set the background color
	m_wndStaticDateTime.SetBkgndColor(GetNoteColor());
	
	// Subclass the bar static control and attach it to the CGradientStatic object
	bRet = m_wndStaticBar.SubclassWindow(GetDlgItem(IDC_STATIC_BAR));
	ATLASSERT(bRet);
	// Set the size and position of the control
	m_wndStaticBar.MoveWindow(42, 2, rectDlg.Width() - 66, 16);
	// Change the font
	m_wndStaticBar.ChangeFont();
	// Set the note's title
	m_wndStaticBar.SetWindowText(GetNoteTitle().c_str());

	// Subclass the edit control and attach it to the CNoteEdit object
	bRet = m_wndEdit.SubclassWindow(GetDlgItem(IDC_EDIT));
	ATLASSERT(bRet);
	// Set the ENM_LINK mask for a rich edit control to receive 
	// EN_LINK notifications
	m_wndEdit.SetEventMask(ENM_LINK);		
	// Enable automatic detection of URLs by a rich edit control
	m_wndEdit.SetAutoURLDetect();
	// Set the edit control's background color
	m_wndEdit.SetBackgroundColor(GetNoteColor());
	// Sets the initial character formatting attributes
	m_wndEdit.SetDefaultFont();
	// Set the edit control's text
	if (GetNoteRTF().length() != 0)
		m_wndEdit.SetRTF(GetNoteRTF().c_str());
	else
		m_wndEdit.SetWindowText(GetNoteText().c_str());
	// Set the size and position of the control
	m_wndEdit.MoveWindow(5, 20, rectDlg.Width() - 10, rectDlg.Height() - 40);
	
	// Create the static control holding the 'Note' bitmap
	CRect rectStatic(1, 2, 17, 18);
	hWnd = m_wndStaticNote.Create(m_hWnd, rectStatic, NULL,
		WS_CHILD|WS_VISIBLE|SS_BITMAP|SS_CENTERIMAGE|SS_NOTIFY);
	ATLASSERT(hWnd);
	
	// Create the button with the 'Close' bitmap
	rectStatic.SetRect(rectDlg.right - 21, 1, rectDlg.right - 1, 20);
	hWnd = m_wndBtnClose.Create(m_hWnd, rectStatic, NULL, 0, 0);
	ATLASSERT(hWnd);

	m_hFontClose = ::CreateFont(15, 0, 0, 0, FW_SEMIBOLD, 0, 0, 0, 1, 0, 0, 4, 
					FF_DONTCARE, _T("Marlett"));
	ATLASSERT(m_hFontClose);
	m_wndBtnClose.SetFont(m_hFontClose);
	m_wndBtnClose.SetTextColor(BLACK);
	m_wndBtnClose.SetColor(GetNoteColor());
	m_wndBtnClose.SetWindowText((TCHAR*)"\x72");		// 'x' sign
	m_wndBtnClose.SetToolTipText(_T("Close the note"));

	// Create the button with the 'Pin' bitmap
	rectStatic.SetRect(19, 1, 39, 21);
	hWnd = m_wndBtnPin.Create(m_hWnd, rectStatic, NULL, 0, 0);
	ATLASSERT(hWnd);
	// Change the button extended style
	dwStyle = BMPBTN_AUTOSIZE | BMPBTN_AUTO3D_SINGLE | BMPBTN_HOVER | BTNEX_CHECKBUTTON;
	m_wndBtnPin.SetBitmapButtonExtendedStyle(dwStyle);

	// Load the 'Pinopen' bitmap from the application's resources
	HBITMAP hBmpTemp2 = ::LoadBitmap(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDB_PINOPEN));
	ATLASSERT(hBmpTemp2);
	// Load the 'Pinclose' bitmap from the application's resources
	HBITMAP hBmpTemp3 = ::LoadBitmap(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDB_PINCLOSE));
	ATLASSERT(hBmpTemp3);
	// Load the 'Pinhoover' bitmap from the application's resources
	HBITMAP hBmpTemp4 = ::LoadBitmap(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDB_PINHOOVER));
	ATLASSERT(hBmpTemp4);
	
	// Replace the white background color with the saved or default (yellow) note's color
	m_hBmpPinopen = ReplaceColor(hBmpTemp2, WHITE, GetNoteColor());
	ATLASSERT(m_hBmpPinopen);
	// Replace the white background color with the saved or default (yellow) note's color
	m_hBmpPinclose = ReplaceColor(hBmpTemp3, WHITE, GetNoteColor());
	ATLASSERT(m_hBmpPinclose);
	// Replace the white background color with the saved or default (yellow) note's color
	m_hBmpPinhoover = ReplaceColor(hBmpTemp4, WHITE, GetNoteColor());
	ATLASSERT(m_hBmpPinhoover);
	
	// Create the pin button's imagelist
	m_wndBtnPin.m_ImageList.Create(20, 20, ILC_COLORDDB | ILC_MASK, 3, 1);
	// Add images to the image list.
	m_wndBtnPin.m_ImageList.Add(m_hBmpPinopen);
	m_wndBtnPin.m_ImageList.Add(m_hBmpPinclose);
	m_wndBtnPin.m_ImageList.Add(m_hBmpPinhoover);
	// Set normal, pressed and hover images
	m_wndBtnPin.SetImages(0, 1, 2);
	// ToolTip text
	m_wndBtnPin.SetToolTipText(_T("Keep the Note Visible"));

	// Load the 'Note' bitmap from the application's resources
	HBITMAP hBmpTemp1 = ::LoadBitmap(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDB_NOTE));
	ATLASSERT(hBmpTemp1);

	// Replace the white background color with the saved or default (yellow) note's color
	m_hBmpNote = ReplaceColor(hBmpTemp1, WHITE, GetNoteColor());
	ATLASSERT(m_hBmpNote);

	// Delete the original bitmaps
	DeleteObject(hBmpTemp1);
	DeleteObject(hBmpTemp2);
	DeleteObject(hBmpTemp3);
	DeleteObject(hBmpTemp4);

	// Draw the 'Note' bitmap in the static control
	m_wndStaticNote.SetBitmap(m_hBmpNote);
	
	// To support a transparency try to get a SetLayeredWindowAttributes function address
	// and set WS_EX_LAYERED style
	HMODULE hUser32 = GetModuleHandle(_T("User32.dll"));
	if (hUser32)
	{
		m_pfSetLayeredWindowAttributes = 
			(PFUNCSETLAYEREDWINDOWATTR)::GetProcAddress(hUser32, "SetLayeredWindowAttributes");
		if (m_pfSetLayeredWindowAttributes)
		{
			::SetWindowLong(m_hWnd, GWL_EXSTYLE, GetWindowLong(GWL_EXSTYLE)^WS_EX_LAYERED);
			// After the SetWindowLong call, the layered window will not become visible 
			// until the SetLayeredWindowAttributes function has been called for this window
			m_pfSetLayeredWindowAttributes(m_hWnd, 0, (BYTE)255, LWA_ALPHA);

			// Set the transparency of the note dialog
			MakeTransparent(GetNoteAlpha());
		}
	}

	// Register object for message filtering and idle updates
	CMessageLoop* pLoop = _Module.GetMessageLoop();
	ATLASSERT(pLoop != NULL);
	pLoop->AddMessageFilter(this);
	pLoop->AddIdleHandler(this);

	return TRUE;
}
Exemple #13
0
//ピクチャボックスにアイコンを指定
LRESULT CConfigDlgAssociation::OnInitDialog(HWND hWnd, LPARAM lParam)
{
    // メッセージループにメッセージフィルタとアイドルハンドラを追加
    CMessageLoop* pLoop = _Module.GetMessageLoop();
    pLoop->AddMessageFilter(this);

    // 関連付けのShellOpenCommandを算出
    {
        TCHAR szModule[_MAX_PATH+1];
        GetModuleFileName(GetModuleHandle(NULL), szModule, _MAX_PATH);	//本体のパス取得
        CPath fullPath;
        UtilGetCompletePathName(fullPath,szModule);	//パスを正規化
        fullPath.QuoteSpaces();
        m_strAssocDesired=(LPCTSTR)fullPath;
        //m_strAssocDesired.MakeLower();	//小文字に正規化
        m_strAssocDesired+=_T(" /m \"%1\"");	//パラメータ
        TRACE(_T("ShellOpenCommand_Desired=%s\n"),m_strAssocDesired);
    }

    // システムデフォルトアイコンを取得
    if(Icon_SystemDefault.IsNull()) {
        TCHAR Path[_MAX_PATH+1];
        FILL_ZERO(Path);
        GetSystemDirectory(Path,_MAX_PATH);
        PathAppend(Path,_T("shell32.dll"));
        Icon_SystemDefault.ExtractIcon(Path,0);
    }

    // 関連付け情報をチェック
    LOAD_ASSOC_AND_SET_ICON(LZH,	_T(".lzh"),	0,	0);
    LOAD_ASSOC_AND_SET_ICON(LZS,	_T(".lzs"),	0,	22);
    LOAD_ASSOC_AND_SET_ICON(LHA,	_T(".lha"),	0,	23);
    LOAD_ASSOC_AND_SET_ICON(ZIP,	_T(".zip"),	1,	1);
    LOAD_ASSOC_AND_SET_ICON(JAR,	_T(".jar"),	2,	2);
    LOAD_ASSOC_AND_SET_ICON(CAB,	_T(".cab"),	3,	3);
    LOAD_ASSOC_AND_SET_ICON(7Z,		_T(".7z"),	4,	4);
    LOAD_ASSOC_AND_SET_ICON(ARJ,	_T(".arj"),	14,	14);
    LOAD_ASSOC_AND_SET_ICON(RAR,	_T(".rar"),	5,	5);
    LOAD_ASSOC_AND_SET_ICON(JAK,	_T(".jak"),	10,	10);
    LOAD_ASSOC_AND_SET_ICON(GCA,	_T(".gca"),	6,	6);
    LOAD_ASSOC_AND_SET_ICON(IMP,	_T(".imp"),	17,	17);
    LOAD_ASSOC_AND_SET_ICON(ACE,	_T(".ace"),	13,	13);
    LOAD_ASSOC_AND_SET_ICON(YZ1,	_T(".yz1"),	12,	12);
    LOAD_ASSOC_AND_SET_ICON(HKI,	_T(".hki"),	11,	11);
    LOAD_ASSOC_AND_SET_ICON(BZA,	_T(".bza"),	15,	15);
    LOAD_ASSOC_AND_SET_ICON(GZA,	_T(".gza"),	16,	16);
    LOAD_ASSOC_AND_SET_ICON(ISH,	_T(".ish"),	18,	18);
    LOAD_ASSOC_AND_SET_ICON(UUE,	_T(".uue"),	19,	19);
    LOAD_ASSOC_AND_SET_ICON(BEL,	_T(".bel"),	20,	20);

    LOAD_ASSOC_AND_SET_ICON(TAR,	_T(".tar"),	7,	24);
    LOAD_ASSOC_AND_SET_ICON(GZ,		_T(".gz"),	7,	25);
    LOAD_ASSOC_AND_SET_ICON(TGZ,	_T(".tgz"),	7,	26);
    LOAD_ASSOC_AND_SET_ICON(BZ2,	_T(".bz2"),	7,	27);
    LOAD_ASSOC_AND_SET_ICON(TBZ,	_T(".tbz"),	7,	28);
    LOAD_ASSOC_AND_SET_ICON(XZ,		_T(".xz"),	7,	36);
    LOAD_ASSOC_AND_SET_ICON(TAR_XZ,	_T(".txz"),	7,	37);
    LOAD_ASSOC_AND_SET_ICON(LZMA,	_T(".lzma"),7,	38);
    LOAD_ASSOC_AND_SET_ICON(TAR_LZMA,_T(".tlz"),7,	39);
    LOAD_ASSOC_AND_SET_ICON(Z,		_T(".z"),	7,	29);
    LOAD_ASSOC_AND_SET_ICON(TAZ,	_T(".taz"),	7,	30);
    LOAD_ASSOC_AND_SET_ICON(CPIO,	_T(".cpio"),7,	31);
    LOAD_ASSOC_AND_SET_ICON(A,		_T(".a"),	7,	32);
    LOAD_ASSOC_AND_SET_ICON(LIB,	_T(".lib"),	9,	9);
    LOAD_ASSOC_AND_SET_ICON(RPM,	_T(".rpm"),	8,	33);
    LOAD_ASSOC_AND_SET_ICON(DEB,	_T(".deb"),	8,	34);
    LOAD_ASSOC_AND_SET_ICON(ISO,	_T(".iso"),	8,	35);
    return TRUE;
}
Exemple #14
0
LRESULT CMainFrame::OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
	// Check if Common Controls 6.0 are used. If yes, use 32-bit (alpha) images
	// for the toolbar and command bar. If not, use the old, 4-bit images.
	UINT uResID = IDR_MAINFRAME_OLD;
	DWORD dwMajor = 0;
	DWORD dwMinor = 0;
	HRESULT hRet = AtlGetCommCtrlVersion(&dwMajor, &dwMinor);
	if(SUCCEEDED(hRet) && dwMajor >= 6)
		uResID = IDR_MAINFRAME;

	// Set values to be displayed in the view window
	m_view.m_dwCommCtrlMajor = dwMajor;
	m_view.m_dwCommCtrlMinor = dwMinor;
	m_view.m_bAlpha = (uResID == IDR_MAINFRAME);

	// create command bar window
	HWND hWndCmdBar = m_CmdBar.Create(m_hWnd, rcDefault, NULL, ATL_SIMPLE_CMDBAR_PANE_STYLE);
	// attach menu
	m_CmdBar.AttachMenu(GetMenu());
	// load command bar images
	m_CmdBar.LoadImages(uResID);
	// remove old menu
	SetMenu(NULL);

	HWND hWndToolBar = CreateSimpleToolBarCtrl(m_hWnd, uResID, FALSE, ATL_SIMPLE_TOOLBAR_PANE_STYLE);
	

	CreateSimpleReBar(ATL_SIMPLE_REBAR_NOBORDER_STYLE);
	AddSimpleReBarBand(hWndCmdBar);
	AddSimpleReBarBand(hWndToolBar, NULL, TRUE);
	CreateSimpleStatusBar();

	//
	//m_hWndClient = m_view.Create(m_hWnd, rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, WS_EX_CLIENTEDGE);
	{

		m_hWndClient = m_wndSplitter.Create(m_hWnd, rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN);

		HWND hWndFolderTree = m_wndFolderTree.Create(m_wndSplitter, _T("Folders"), WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN);
		RECT rc = { 50, 0, 300, 100 };
		m_wndCombo.Create(hWndFolderTree, rc, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBS_DROPDOWN | CBS_AUTOHSCROLL);

		m_wndTreeView.Create(m_wndFolderTree, rcDefault, NULL, 
			WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | 
			TVS_HASLINES | TVS_LINESATROOT | TVS_HASBUTTONS | TVS_SHOWSELALWAYS, 
			WS_EX_CLIENTEDGE);

		m_wndFolderTree.SetClient(m_wndTreeView);

		m_wndListView.Create(m_wndSplitter, rcDefault, NULL, 
			WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | 
			LVS_REPORT | LVS_AUTOARRANGE | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS,
			WS_EX_CLIENTEDGE);
		m_wndListView.SetExtendedListViewStyle(LVS_EX_TRACKSELECT | LVS_EX_ONECLICKACTIVATE | LVS_EX_UNDERLINEHOT);

		InitViews();

		UpdateLayout();

		m_wndSplitter.SetSplitterPanes(m_wndFolderTree, m_wndListView);

		RECT rect;
		GetClientRect(&rect);
		m_wndSplitter.SetSplitterPos((rect.right - rect.left) / 4);
	}
	UIAddToolBar(hWndToolBar);
	UISetCheck(ID_VIEW_TOOLBAR, 1);
	UISetCheck(ID_VIEW_STATUS_BAR, 1);

	// register object for message filtering and idle updates
	CMessageLoop* pLoop = _Module.GetMessageLoop();
	ATLASSERT(pLoop != NULL);
	pLoop->AddMessageFilter(this);
	pLoop->AddIdleHandler(this);

	UIEnable(ID_EDIT_PASTE, FALSE);

	//
	_canvas = NULL;
	//_canvas = new Canvas(m_hWndClient);
	//_canvas = new Canvas(m_hWndClient);
	
	//
	return 0;
}
Exemple #15
0
LRESULT CMainDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
	// center the dialog on the screen
	//DlgResize_Init();
	
	//InitResizing(TRUE, TRUE, WS_THICKFRAME | WS_CLIPCHILDREN);
	CenterWindow();
	// set icons
	HICON hIcon = (HICON)::LoadImage(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDI_TRIEXPORTER), 
		IMAGE_ICON, ::GetSystemMetrics(SM_CXICON), ::GetSystemMetrics(SM_CYICON), LR_DEFAULTCOLOR);
	SetIcon(hIcon, TRUE);
	HICON hIconSmall = (HICON)::LoadImage(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDI_SMALL), 
		IMAGE_ICON, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR);
	SetIcon(hIconSmall, FALSE);
	file = new TriFile;
	// register object for message filtering and idle updates
	loaded = false;
	CMessageLoop* pLoop = _Module.GetMessageLoop();
	ATLASSERT(pLoop != NULL);
	pLoop->AddMessageFilter(this);
	pLoop->AddIdleHandler(this);
	//UIAddChildWindowContainer(m_hWnd);
	menu.Attach(GetMenu());
	m_Tree = GetDlgItem(IDC_TREE);
	il.Create(16,16, ILC_COLOR32,0,0);
	HANDLE bmp = LoadImage(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDB_ICONS),IMAGE_BITMAP,0,0,LR_LOADTRANSPARENT);
	il.Add((HBITMAP)bmp);
	DeleteObject(bmp);
	m_Tree.SetImageList(il, TVSIL_NORMAL);
	m_p3d.SubclassWindow(GetDlgItem(IDC_PREVIEW));
	m_Scale.Attach(GetDlgItem(IDC_SCALE));
	m_Light.Attach(GetDlgItem(IDC_LIGHT));
	m_Fps.Attach(GetDlgItem(IDC_FPS));
	m_eScale.Attach(GetDlgItem(IDC_ESCALE));
	m_Texture.Attach(GetDlgItem(IDC_TEXTURE));
	m_VSize.Attach(GetDlgItem(IDC_VSIZE));
	m_TriVersion.Attach(GetDlgItem(IDC_TRIVERSION));
	m_VCount.Attach(GetDlgItem(IDC_VCOUNT));
	m_BoxMax.Attach(GetDlgItem(IDC_BOXMAX));
	m_BoxMin.Attach(GetDlgItem(IDC_BOXMIN));
	m_SurType.Attach(GetDlgItem(IDC_SURTYPE));
	m_SurCount.Attach(GetDlgItem(IDC_SURCOUNT));
	m_Textures.Attach(GetDlgItem(IDC_TEXTURES));
	m_Add.Attach(GetDlgItem(IDC_ADD));
	m_Remove.Attach(GetDlgItem(IDC_REMOVE));
	m_Select.Attach(GetDlgItem(IDC_SELECT));
	// Attach all 10 Checkboxes
	for(int i=0; i<10; i++)
		m_ChkSurfaces[i].Attach(GetDlgItem(IDC_SURFACE1+i));
	m_Scale.SetRange(0, 19);
	m_Scale.SetPageSize(5);
	m_UpDown.Attach(GetDlgItem(IDC_UPDOWN));
	m_Light.SetRange(0, 360);
	m_Light.SetPageSize(1);
	m_Light.SetPos(100);
	m_p3d.alight = 100/(180/D3DX_PI);
	CRegKey rk;
	if(rk.Open(HKEY_CURRENT_USER, "Software\\TriExporter") == ERROR_SUCCESS)
	{
		ULONG g=256;
		TCHAR path[256];
		rk.QueryStringValue("EVE", path, &g);
		rk.Close();
		if (sc.LoadDir(path))
			FillTree();
	}
	m_p3d.Render();
	EnableAll(FALSE);
	return TRUE;
}