SDI: Failed to create empty document

Hello:

I have SDI appl where CView has  CFormView as base class.

I didn't add even single line of code.

But after I deleted all menus I have message 
"Failed to create empty document" .


thank you,
dave



 
0
dave871 (680)
6/17/2005 5:49:03 PM
vc.mfc 33608 articles. 0 followers. Follow

6 Replies
771 Views

Similar Articles

[PageSpeed] 4

If  you are just getting started you may want to make it a dialog app 
instead if you don't want any menus or doc/view mode (I.E., only one 
FormView).  Otherwise, make sure you didn't delete the handlers for messages 
that do the file new stuff.

Tom

"dave" <dave@discussions.microsoft.com> wrote in message 
news:CF30668D-0BCE-458E-9970-050BD103CDD7@microsoft.com...
> Hello:
>
> I have SDI appl where CView has  CFormView as base class.
>
> I didn't add even single line of code.
>
> But after I deleted all menus I have message
> "Failed to create empty document" .


0
tserface (3861)
6/17/2005 5:54:36 PM
 
 I want to use SDI and I don't want to have menus.
 
 I didn't delete any handlers. 
 

"Tom Serface" wrote:

> If  you are just getting started you may want to make it a dialog app 
> instead if you don't want any menus or doc/view mode (I.E., only one 
> FormView).  Otherwise, make sure you didn't delete the handlers for messages 
> that do the file new stuff.
> 
> Tom
> 
> "dave" <dave@discussions.microsoft.com> wrote in message 
> news:CF30668D-0BCE-458E-9970-050BD103CDD7@microsoft.com...
> > Hello:
> >
> > I have SDI appl where CView has  CFormView as base class.
> >
> > I didn't add even single line of code.
> >
> > But after I deleted all menus I have message
> > "Failed to create empty document" .
> 
> 
> 
0
dave871 (680)
6/17/2005 6:11:02 PM
 Ok, I found the way to get rid of menus
 by twiking ".rc" file but i'm wondering 
 if it's the right way ?

 dave.
0
dave871 (680)
6/17/2005 8:13:04 PM
"dave" <dave@discussions.microsoft.com> wrote in message
news:CF30668D-0BCE-458E-9970-050BD103CDD7@microsoft.com...
> Hello:
>
> I have SDI appl where CView has  CFormView as base class.
>
> I didn't add even single line of code.
>
> But after I deleted all menus I have message
> "Failed to create empty document" .
>
>
> thank you,
> dave
>

Dave,

Your app has likely failed in the CFrameWnd::Create method because MFC is
expecting a Menu resource that has the IDR_MAINFRAME ID.  Since you deleted
it, then the call to LoadMenu in CFrameWnd::Create is going to fail (because
you deleted the menu...

One soultion would be to override CFrameWnd::Create, and pass a NULL as the
Menu resource ID.  Something like this:

/* ************************************ */
BOOL CMainFrame::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName,
                       DWORD dwStyle , const RECT& rect , CWnd* pParentWnd ,
                      LPCTSTR lpszMenuName ,
                      DWORD dwExStyle , CCreateContext* pContext)
{

LPCTSTR THIS_IS_A_NULL_MENU = 0;
return CFrameWnd::Create(lpszClassName, lpszWindowName,
                dwStyle, rect, pParentWnd,
                THIS_IS_A_NULL_MENU ,  // dont use the original value here
                dwExStyle, pContext);
}

/* ************************************ */

with this approach, you do not have to delete the menu resource; you just
dont have to use it!

regards
Roy Fine


0
rlfine8815 (162)
6/18/2005 1:06:27 AM
 Hi Roy,
 
 I tried it and it doesn't work . My menus are visible.

 So for right now i will keep my ".rc" file twicked. 

 Thank you,
 dave



"Roy Fine" wrote:

> 
> "dave" <dave@discussions.microsoft.com> wrote in message
> news:CF30668D-0BCE-458E-9970-050BD103CDD7@microsoft.com...
> > Hello:
> >
> > I have SDI appl where CView has  CFormView as base class.
> >
> > I didn't add even single line of code.
> >
> > But after I deleted all menus I have message
> > "Failed to create empty document" .
> >
> >
> > thank you,
> > dave
> >
> 
> Dave,
> 
> Your app has likely failed in the CFrameWnd::Create method because MFC is
> expecting a Menu resource that has the IDR_MAINFRAME ID.  Since you deleted
> it, then the call to LoadMenu in CFrameWnd::Create is going to fail (because
> you deleted the menu...
> 
> One soultion would be to override CFrameWnd::Create, and pass a NULL as the
> Menu resource ID.  Something like this:
> 
> /* ************************************ */
> BOOL CMainFrame::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName,
>                        DWORD dwStyle , const RECT& rect , CWnd* pParentWnd ,
>                       LPCTSTR lpszMenuName ,
>                       DWORD dwExStyle , CCreateContext* pContext)
> {
> 
> LPCTSTR THIS_IS_A_NULL_MENU = 0;
> return CFrameWnd::Create(lpszClassName, lpszWindowName,
>                 dwStyle, rect, pParentWnd,
>                 THIS_IS_A_NULL_MENU ,  // dont use the original value here
>                 dwExStyle, pContext);
> }
> 
> /* ************************************ */
> 
> with this approach, you do not have to delete the menu resource; you just
> dont have to use it!
> 
> regards
> Roy Fine
> 
> 
> 
0
dave871 (680)
6/20/2005 5:06:03 PM
dave

i frequently use this approach - it does work, and IMHO it's likely the
*right* way, and if not, then certainly a better way.

if you want to take the time, we can figure out why it does not work for
you.

regards
rlf

"dave" <dave@discussions.microsoft.com> wrote in message
news:5578925E-7C67-4B2E-BF28-A60C44C53CF9@microsoft.com...
>
>  Hi Roy,
>
>  I tried it and it doesn't work . My menus are visible.
>
>  So for right now i will keep my ".rc" file twicked.
>
>  Thank you,
>  dave
>
>
>
> "Roy Fine" wrote:
>
> >
> > "dave" <dave@discussions.microsoft.com> wrote in message
> > news:CF30668D-0BCE-458E-9970-050BD103CDD7@microsoft.com...
> > > Hello:
> > >
> > > I have SDI appl where CView has  CFormView as base class.
> > >
> > > I didn't add even single line of code.
> > >
> > > But after I deleted all menus I have message
> > > "Failed to create empty document" .
> > >
> > >
> > > thank you,
> > > dave
> > >
> >
> > Dave,
> >
> > Your app has likely failed in the CFrameWnd::Create method because MFC
is
> > expecting a Menu resource that has the IDR_MAINFRAME ID.  Since you
deleted
> > it, then the call to LoadMenu in CFrameWnd::Create is going to fail
(because
> > you deleted the menu...
> >
> > One soultion would be to override CFrameWnd::Create, and pass a NULL as
the
> > Menu resource ID.  Something like this:
> >
> > /* ************************************ */
> > BOOL CMainFrame::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName,
> >                        DWORD dwStyle , const RECT& rect , CWnd*
pParentWnd ,
> >                       LPCTSTR lpszMenuName ,
> >                       DWORD dwExStyle , CCreateContext* pContext)
> > {
> >
> > LPCTSTR THIS_IS_A_NULL_MENU = 0;
> > return CFrameWnd::Create(lpszClassName, lpszWindowName,
> >                 dwStyle, rect, pParentWnd,
> >                 THIS_IS_A_NULL_MENU ,  // dont use the original value
here
> >                 dwExStyle, pContext);
> > }
> >
> > /* ************************************ */
> >
> > with this approach, you do not have to delete the menu resource; you
just
> > dont have to use it!
> >
> > regards
> > Roy Fine
> >
> >
> >


0
rlfine8815 (162)
6/20/2005 10:27:36 PM
Reply:

Similar Artilces:

How do I export outlook folders to my documents?
My Outlook .pst file is too large to back up. How can I export folders and associated message to my documents? "Pamela Gates" <Pamela Gates@discussions.microsoft.com> wrote in message news:406CB645-870A-4096-99EE-6980B12A1017@microsoft.com... > My Outlook .pst file is too large to back up. How can I export folders and > associated message to my documents? No PST is ever too large to backup. Simply copy the PST to another location while Outlook is closed. Backup complete. -- Brian Tillman [MVP-Outlook] What version of Outlook are you using? What...

Creating Control Grid
Hi all, I would like to know as to how I should go about creating a control grid of my very own. I just need a bit of push (suggestions). Thanks In Advance Where are you getting stuck? Of course, if the grid isn't too large and most of the cells will have data, then you could simply use a two-dimensional array. For larger grids that will be sparsley populated, there are a couple of algorithms to consider. A simple one is to create a one-dimensional array that represents the rows (or columns), and have each item contain or reference a linked list for all items in that row (complete...

How to create a drop-down list
I am at a lost and can't figure out how to create a drop- down box with information such as dates or names. Can anyone help me? You can use Data>Validation. There are instructions in Excel's Help, and on the following web page: http://www.contextures.com/xlDataVal01.html Frank wrote: > I am at a lost and can't figure out how to create a drop- > down box with information such as dates or names. Can > anyone help me? -- Debra Dalgleish Excel FAQ, Tips & Book List http://www.contextures.com/tiptech.html ...

Expiration date to a printed document
This is what I'd like to do: When someone prints the document it displays an expiration date on the document. ie: Policy and Procedure hardcopy is only good for the day it was printed. thanks I'd suggest a PrintDate field - with the appropriate formatting and supporting boilerplate text. -- Cheers! Gordon Bentley-Mix Word MVP "Jessica" <Jessica@discussions.microsoft.com> wrote in message news:3F871D71-0A25-4E2F-8783-01E0A20456F8@microsoft.com... > This is what I'd like to do: > When someone prints the document it displays an expirati...

get empty data xml tag
Hi, All, I want to generate empty data xml tag, for example field name is Data1 but no data, when generating xml file, I need to generate <Data1 /> xml tag in xml file using Select Data1 from table for xml auto, elements query, can anyone help this out? Thanks, ...

Createing Quote sometimes make Error: 80070057
Hello NG, Today I found some funny problems. I create Quotes via the quote WebService from the CRM. This normally works fine, but now I have some quotes, which will get me an error, when I open it. This error is no normal error, I will get an white/yellow Page with ASPX Errorpage: Here the Message (sorry but I only have this error in German): Serverfehler in der Anwendung '/'. ---------------------------------------------------------------------------- ---- Falscher Parameter. Beschreibung: Beim Ausf�hren der aktuellen Webanforderung ist ein unverarbeiteter Fehler aufgetret...

Can you delete and empty an open email
Hi there Can you delete and empty an open email? I know I can delete and empty a closed email by holding down shift and then deleting, but have not been able to figure out how to delete and empty from an open email. Is this even possible? Thanks for your help. Kylie On Wed, 18 May 2005 20:01:03 -1000, Kylie B"" <KylieB@discussions.microsoft.com> wrote: > Hi there > > Can you delete and empty an open email? I know I can delete and empty a > closed email by holding down shift and then deleting, but have not been > able > to figure out how to delet...

AsyncFileUpload fails in hidden panel
Could someone help: I have the AsyncFileUpload controk within a <Panel> control that I toggle visibility True/False. For Example when the page loads pnlEdit.visible = False. Then when a user clicks on a detail record in a grid I display the panel with the AsyncFileControl ie: pnlEdit.Visible = True. Because the the AsyncFileUpload Control is not displayed on the page right away it errors when you try to upload a file. Would anyone know how I could preload the control or configure it to work in this configuration? ie: <asp:UpdatePanel ID="updEditDe...

Excel creating tmp files
I have office 2007 installed on my new PC which has windows 7 and when I make a change to an excel file it wants to create a separate file labled with a tmp extension ie f5de4221.tmp. Why is it doing this and what can I do to stop it. Jim S Hi Jim, Have you solved this problem? I'm also facing the same problem but can't solve it. If you've found the solution please let me know steps to follow. Best regards, Gus "Big Jim" wrote: > I have office 2007 installed on my new PC which has windows 7 and when I > make a change to an excel file it...

My New 100-Million Dollar System is Creating Millionaires
Easy Daily Cash Ad IMAGINE GETTING NON STOP PAYMENTS OF $297! YOU CAN GET THESE PAYMENTS EVERY DAY. YOU CAN EASILY EARN $2970 A WEEK. SO ETHICAL THE OWNERS WANT YOU TO CALL THEM AND THEY POST THEIR PHONE NUMBER SO YOU CAN DO JUST THAT! http://4u2bn.com/cl32 ...

For security reasons DTD is prohibited in this XML document.
Hi; One of our customers is getting the following error in our software. This occurs in our code when we try to open and read it using the .NET XML classes. For security reasons DTD is prohibited in this XML document. To enable DTD processing set the ProhibitD... (Sorry, the rest of the rrror message is cut off in the screen shot they sent us.) What's going on here and what do we do to make this work? thanks - dave david@at-at-at@windward.dot.dot.net Windward Reports -- http://www.WindwardReports.com me -- http://dave.thielen.com Cubicle Wars - http://www.windwardreports.com/film.ht...

how to create new record automatically
Hi, I have a form a form to show the customer information and I button to create new order for him. The Order form has the following fields: OrderID>>>autonumber cutomerID employeeID …. Also, there is a subform that is bounded on the Order Details table which has the following fields: OrderID ProductID ….. What I want to do is once the Order form open, I want access to set the CustomerID value based on the customerID that is on customer form and generate a new OrderID in order to pick the Product ID from the subform. I try to set the value for the customer ID fie...

How to create a connection point in Excel
When I group autoshapes the group itself does not have connection points. A connector connects to one of the grouped shapes instead. So, the connector beginconnecedshape (or endconnectedshape) property contains the name of the contained shape and not the name of the group. Is there a way to create connection points for a group? Alternatively, is it possible to change a group into a single shape with connection points? ...

Document Access
On importing a Word document to an e-mail for sending (which opens fine from the desktop) and I try to open the file from the e-mail to check before sending, it will not open, giving messgae 'Word cannot open the document: user does not have access privileges' - however, I have no special security / privilges set. Ideas please? Thanks, Graham ...

Losing the Document in a SDI application
I have a fairly complicated SDI application which recently has had the problem that it, at times, looses the document. Basic architecture is SDI, with a splitter window. The Document has three views: View1 is always present in Pane(0,0) of the splitter. View2 and View3 are presented in Pane(0,1) of the splitter, with the Mainframe handling the switching between the two. The application has a serial connection to a piece of lab equipment. We have a threaded serial communication class, which posts a message when data is received. When the RECEIVED message is posted, the Mainframe rea...

Viewing an Excel sheet w/out all the empty fields...
How do you create a spreadsheet that only shows the fileds with data in them? -How do you get rid of all the empty rows/columns, to ease viewing for those who are easily confused by excel spreadsheets? (I don't know how else to emaplin my question... I just don't want the extra columns & rows there, if that's possible...) Please help... Hi! >I just don't want the extra columns & rows there, if that's possible... Just hide them! Suppose the last column in your sheet that contains data is column H. You can hide columns I:IV so that after column H all you ...

Macro to create a Pivot Table
Does anyone have an example of a macro that automatically creates a Pivot Table from raw data or automatically updates that Pivot Table with the raw data? You'll get a macro that's specific to your workbook if you turn on the macro recorder as you manually create and refresh a pivot table. Attach the macro to a toolbar button, and run it when required. David McRitchie has information on getting started with macros: http://www.mvps.org/dmcritchie/excel/getstarted.htm Chris wrote: > Does anyone have an example of a macro that automatically > creates a Pivot Table from r...

Convert any documents(Word, Excel) into BMP, GIF, JPEG, PNG and TIFF image
Website: http://www.joyprinter.com Joy Image Printer is a high-performance virtual printer which enables you to convert any printable document into standard BMP, GIF, JPEG, PNG and TIFF image, and keep the exact look and feel of the original document. Since the converted image has the complete information from the original file without altering characters or fonts, you don't need to install the original software to view the document. Key Features: (1) Installs as a standard Windows printer, works for all Windows applications directly It is designed to integrate legacy windows-based devi...

Creating Multiple summary sheets
Hi I seem to be struggling to find a macro that will work in previous threads. In sheet 1 is a list of data in columns A:N and the number of rows will vary. It is a list of sales with each sale record ocuppying one row. The salesperson's name is in column C and each salesperson will have multiple entries. What I am trying to do is create a seperate summary sheet in the workbook for each salesperson. Therefore sheets 2 to 20 are templates that already exist with a different salesperson's name entered into cell C3 on each of them. I am trying to find a macro that ...

[Create ERD in Visio] Reverse Engineer Wizard
I'm trying to create an ERD in Visio from exported tables from MySQL. I exported each table to Excel. I am on Windows XP 2002 Professional. I have Visio Professional 2007. I have Excel 2007 however I saved the sheets as Excel 97-2003. In the reverse engineer dialog box it looks like it accepts Excel 97-2000? I think I have Visio connected to one of the sheets as a datasource using the generic odbc driver for Excel. Each sheet is one table. When I keep going through the dialogs I don't see any field names in the windows where it says select tables/ views there is nothing to selec...

System State Backup Fails repeatedly
This is happening on a SBS 2003 Premium Server (SP2 installed). This has been an ongoing issue since a Raid 1 Array / Controller (Promise TX2300) has been added to the system. THe old RAID 1 array (Silicon Image) is still in the system, but the drive letters where changed to higher letters for the sake of having the ability to copy data from old to new. THe server appears to function normally other than this problem. The OS and data was restored to the new new raid array using Windows Backup. The same original drive letters are still there, just now mapping to the volumes o...

user created shapes non printing
I started have a problem with vision 2002 that I have not noticed before. When I create a new shape, by default, it assumes the non-printing properly under FORMAT � BEHAVIOR. Also if I group a set of "printing" shapes the group will become non-printing. Can I change this behavior? How are you creating the new shape? Also are you using layers in your document? -- Mark Nelson Microsoft Corporation This posting is provided "AS IS" with no warranties, and confers no rights. "Robert" <hammer_757@hotmail.com> wrote in message news:9ec427f7.0409231005.576...

Copying and Pasting Between Published Documents
Hi I have created a 132 Document in Publisher 2007 I needed to make a highly customised and intelligent Index so I created a second document and typed the index in that, having both documents open on extended Windows Pages I thought it would be easy to move the index from the second document into the first document containing the text It does not appear possbible to copy and paste table pages between the two publisher documents Is there any way I can accomplish this task without retyping the Index in the first document Roger Stenson Roger, 1. Create on your 132 page document a bla...

"All users" "Programs" create/modify shortcut from app...
Hi all, I've created two shortcuts into "Programs" folder for "All Users" It lets me to get them available for all user. The problem: Application running in "User" context needs to delete and re-create such links but it fails due to an "access denied" ... Settings correct permission to such links it starts working as well I've created links using the IShellLink/IPersistFile sehll interfaces. So, I actually need to have link under "programs" for "All Users" which might be modified by application running in "Users"...

Emptying 'Deleted Items' folder on exit
I am running WLM version 2009 (Build 14.0.8089.0726) on Windows 7 with all the latest updates. I have 'Empty messages from the Deleted Items folder on exit' checked under Maintenance, but they're all still there when I exit and restart WLM. Is there another setting I should be looking at to make this work? TIA, -- SC Tom Tom, I experienced the same thing earlier today. I'm new to WLM and found that if you "checked" the ''Empty messages from the Deleted Items folder on > exit' after there were items in the Deleted Items folder, it ...