Created
July 2, 2010 07:28
-
-
Save meklarian/461057 to your computer and use it in GitHub Desktop.
Splash Screen Example for http://stackoverflow.com/questions/3163241/cdialog-doesnt-show-in-task-bar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// HelperDlg.cpp : implementation file | |
// | |
#include "stdafx.h" | |
// NOTE: CWinApp Include goes here instead of WindowBits2.h | |
#include "WindowBits2.h" | |
#include "HelperDlg.h" | |
// NOTE: Not all versions of MFC have "afxdialogex.h" this present | |
#include "afxdialogex.h" | |
// CHelperDlg dialog | |
IMPLEMENT_DYNAMIC(CHelperDlg, CDialog) | |
CHelperDlg::CHelperDlg(CWnd* pParent /*=NULL*/) | |
: CDialog(CHelperDlg::IDD, pParent) | |
{ | |
} | |
CHelperDlg::~CHelperDlg() | |
{ | |
} | |
void CHelperDlg::DoDataExchange(CDataExchange* pDX) | |
{ | |
CDialog::DoDataExchange(pDX); | |
} | |
BEGIN_MESSAGE_MAP(CHelperDlg, CDialog) | |
END_MESSAGE_MAP() | |
// CHelperDlg message handlers | |
BOOL CHelperDlg::OnInitDialog() | |
{ | |
CDialog::OnInitDialog(); | |
// TODO: Add extra initialization here | |
return TRUE; // return TRUE unless you set the focus to a control | |
// EXCEPTION: OCX Property Pages should return FALSE | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// NOTE: Other Versions of VS / MFC have other includes here | |
#pragma once | |
// CHelperDlg dialog | |
class CHelperDlg : public CDialog | |
{ | |
DECLARE_DYNAMIC(CHelperDlg) | |
public: | |
CHelperDlg(CWnd* pParent = NULL); // standard constructor | |
virtual ~CHelperDlg(); | |
// Dialog Data | |
enum { IDD = IDD_HELPERDLG }; | |
protected: | |
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support | |
DECLARE_MESSAGE_MAP() | |
public: | |
virtual BOOL OnInitDialog(); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
REF: http://stackoverflow.com/questions/3163241/cdialog-doesnt-show-in-task-bar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// NOTE: Partial Snippet. This only contains CWindowBits2App::InitInstance() | |
// CWindowBits2App initialization | |
BOOL CWindowBits2App::InitInstance() | |
{ | |
// 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(); | |
EnableTaskbarInteraction(FALSE); | |
// AfxInitRichEdit2() is required to use RichEdit control | |
// AfxInitRichEdit2(); | |
// 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")); | |
LoadStdProfileSettings(4); // Load standard INI file options (including MRU) | |
InitContextMenuManager(); | |
InitKeyboardManager(); | |
InitTooltipManager(); | |
CMFCToolTipInfo ttParams; | |
ttParams.m_bVislManagerTheme = TRUE; | |
theApp.GetTooltipManager()->SetTooltipParams(AFX_TOOLTIP_TYPE_ALL, | |
RUNTIME_CLASS(CMFCToolTipCtrl), &ttParams); | |
// 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(CWindowBits2Doc), | |
RUNTIME_CLASS(CMainFrame), // main SDI frame window | |
RUNTIME_CLASS(CWindowBits2View)); | |
if (!pDocTemplate) | |
return FALSE; | |
AddDocTemplate(pDocTemplate); | |
// NOTE: Create Splash | |
CHelperDlg *dlg = new CHelperDlg(CWnd::GetDesktopWindow()); | |
INT_PTR nStatus = dlg->DoModal(); | |
delete dlg; | |
// NOTE: End Creation of Splash Window | |
// Parse command line for standard shell commands, DDE, file open | |
CCommandLineInfo cmdInfo; | |
ParseCommandLine(cmdInfo); | |
// Dispatch commands specified on the command line. Will return FALSE if | |
// app was launched with /RegServer, /Register, /Unregserver or /Unregister. | |
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(); | |
// call DragAcceptFiles only if there's a suffix | |
// In an SDI app, this should occur after ProcessShellCommand | |
return TRUE; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// NOTE: This snippet goes into the Dialog section of the .rc file | |
IDD_HELPERDLG DIALOGEX 0, 0, 320, 200 | |
STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | |
EXSTYLE WS_EX_APPWINDOW | |
FONT 8, "MS Shell Dlg", 0, 0, 0x1 | |
BEGIN | |
END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment