I'm putting the finishing touches on a utility for our package. This utility is a MFC9 SDI app with a CFormView and all is well except that now the boss wants it to run minimized to the "tray" at startup. I added she ShellNotify stuff (I've done this dozens of times but never on a Doc/view app) and that all works well. The only problem is when the app is first run, it flashes a ever-so-brief window on the screen before settling down into its "hidden" state. Several searches have turned up little, but a few (one from CodeGuru itself here:http://www.codeguru.com/cpp/controls...cle.php/c5309/ pointed to the CSingleDocTemplate class as the likely culprit and that it should be overridden with a custom class that implements:

Code:
virtual CDocument* OpenDocumentFile(LPCTSTR lpszPathName, BOOL bMakeVisible = TRUE);
Which you can see defaults to TRUE on the bMakeVisible variable. I tried this and it basically hangs the app before anything is shown (I think maybe because I'm using MFC9 with CFrameWndEx/CWinAppEx and the article that this came from was back in the VC6 days). Perhaps I'm doing something wrong with my override so I'll include it before someone asks:

Code:
//XSingleDocTemplate.h
#pragma once
#include "afxwin.h"

class CXSingleDocTemplate : public CSingleDocTemplate
{
public:
  CXSingleDocTemplate(UINT nIDResource, CRuntimeClass* pDocClass,
		CRuntimeClass* pFrameClass, CRuntimeClass* pViewClass);
  virtual ~CXSingleDocTemplate(void);
  virtual CDocument* OpenDocumentFile(LPCTSTR lpszPathName, BOOL bMakeVisible = TRUE);
};
Code:
//XSingleDocTemplate.cpp
#include "StdAfx.h"
#include "XSingleDocTemplate.h"

CXSingleDocTemplate::CXSingleDocTemplate(UINT nIDResource, CRuntimeClass* pDocClass,
		CRuntimeClass* pFrameClass, CRuntimeClass* pViewClass):
CSingleDocTemplate(nIDResource,pDocClass,pFrameClass,pViewClass)		
{
 
}

CXSingleDocTemplate::~CXSingleDocTemplate(void)
{
}

CDocument* CXSingleDocTemplate::OpenDocumentFile(LPCTSTR lpszPathName, BOOL bMakeVisible)
{
  return CSingleDocTemplate::OpenDocumentFile(lpszPathName,FALSE);
}
It's a minor distraction, but I would like to clear it up cleanly if possible.