Quote Originally Posted by nor1
my project have many view form
when open appplication it will show dialog like picture below , user must
select which form to opn
but i don't want this dialog...
The easiest way to remove this dialog is to edit the corresponding "document template string" in the string resources. You want to remove the third sub-string, which corresponds to the <fileNewName> sub-string, for all the document template strings, except for the one template that you want to use for the default view.

The "dialog template strings" are the string resources starting with IDR_xxxx. The format is described in MSDN at "Description of the format of the document template string" at http://support.microsoft.com/default...b;en-us;129095

Here's what I mean. In the VIEWEX sample, the CWinApp::InitInstance function registers five different document templates, each having a different IDR_xxx:
Code:
BOOL CViewExApp::InitInstance()
{
	// Standard initialization
	Enable3dControls();

	// This VIEWEX sample shows several techniques for creating CView
	//  derived classes.   All the views in this sample use the same
	//  CMainDoc class.  For simplicity the CMainDoc class does not
	//  support serialization, but has a very simple data model of
	//  a single string and an RGB color.  We register different
	//  document templates for each of the interesting view types.

	// simple text output view
	AddDocTemplate(new CMultiDocTemplate(IDR_TEXTTYPE,
			RUNTIME_CLASS(CMainDoc),
			RUNTIME_CLASS(CMDIChildWnd),
			RUNTIME_CLASS(CTextView)));

	// simple color output view
	//   a doc template with no 'fileNewName' so it is not a choice for FileNew
	AddDocTemplate(new CMultiDocTemplate(IDR_COLORTYPE,
			RUNTIME_CLASS(CMainDoc),
			RUNTIME_CLASS(CMDIChildWnd),
			RUNTIME_CLASS(CColorView)));

	// form view with input
	AddDocTemplate(new CMultiDocTemplate(IDR_INPUTTYPE,
			RUNTIME_CLASS(CMainDoc),
			RUNTIME_CLASS(CMDIChildWnd),
			RUNTIME_CLASS(CInputView)));

	// splitter frame with both simple text output and form input view
	AddDocTemplate(new CMultiDocTemplate(IDR_SPLIT2TYPE,
			RUNTIME_CLASS(CMainDoc),
			RUNTIME_CLASS(CSplitterFrame),
			RUNTIME_CLASS(CTextView)));

	// 3-way splitter frame with form input, text output and color output views
	AddDocTemplate(new CMultiDocTemplate(IDR_SPLIT3TYPE,
			RUNTIME_CLASS(CMainDoc),
			RUNTIME_CLASS(C3WaySplitterFrame),
			RUNTIME_CLASS(CInputView)));

	// create main MDI Frame window
	// Please note that for simple MDI Frame windows with no toolbar,
	//   status bar or other special behavior, the CMDIFrameWnd class
	//   can be used directly for the main frame window just as the
	//   CMDIChildWnd can be use for a document frame window.

	CMDIFrameWnd* pMainFrame = new CMDIFrameWnd;
	if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
		return FALSE;

	// Also in this example, there is only one menubar shared between
	//  all the views.  The automatic menu enabling support of MFC
	//  will disable the menu items that don't apply based on the
	//  currently active view.  The one MenuBar is used for all
	//  document types, including when there are no open documents.

	// Now finally show the main menu
	pMainFrame->ShowWindow(m_nCmdShow);
	pMainFrame->UpdateWindow();
	m_pMainWnd = pMainFrame;

	// command line arguments are ignored, create a new (empty) document
	OnFileNew();

	return TRUE;
}
So, there are five different doc template strings: IDR_TEXTTYPE, IDR_COLORTYPE, IDR_INPUTTYPE, IDR_SPLIT2TYPE and IDR_SPLIT3TYPE. Look at the string resources for these, and you'll see something like this:

IDR_SPLIT3TYPE: "\nTri\nThree-way Splitter Frame"

... which shows three substrings as follows:

first sub-string (which is the <windowTitle> substring): "" (i.e., blank)
second sub-string (the <docName>): "Tri"
third sub-string (the <fileNewName>): "Three-way Splitter Frame"

(In this case, only the first three sub-strings of the nine possible substrings are being used.)

The third substring is the string that's displayed in the File-New dialog that you want to get rid of. Just delete it, so that the string is

IDR_SPLIT3TYPE: "\nTri\n"

Delete the third substring for all except one of the IDR_xxxx's, which is the view that will open automatically for File->New

Mike