Find cause of error when calling CFrameWnd::Create()

Hello, in my application I had a call to CFrameWnd::Create() return 0 (which 
indicates an error), so my question is: Is there a function I can call to get 
a more detailed description of the error, maybe something mfc specific? I 
tried a simple ::GetLastError(), but it returned 0....
0
Lilja (1)
4/29/2007 10:12:01 PM
vc.mfc 33608 articles. 0 followers. Follow

7 Replies
1180 Views

Similar Articles

[PageSpeed] 15

Eric Lilja wrote:
> Hello, in my application I had a call to CFrameWnd::Create() return 0 (which 
> indicates an error), so my question is: Is there a function I can call to get 
> a more detailed description of the error, maybe something mfc specific? I 
> tried a simple ::GetLastError(), but it returned 0....

No, but you can single-step into the MFC code and see where it fails.

-- 
Scott McPhillips [VC++ MVP]

0
Scott
4/30/2007 2:15:43 AM

"Scott McPhillips [MVP]" wrote:

> Eric Lilja wrote:
> > Hello, in my application I had a call to CFrameWnd::Create() return 0 (which 
> > indicates an error), so my question is: Is there a function I can call to get 
> > a more detailed description of the error, maybe something mfc specific? I 
> > tried a simple ::GetLastError(), but it returned 0....
> 
> No, but you can single-step into the MFC code and see where it fails.
> 
> -- 
> Scott McPhillips [VC++ MVP]
> 
> 

Hi Scott and thanks for the reply! It turned to be a missing resource in the 
project that caused the call to fail- Since MFC uses raw Win32 under the hood 
(I presume), I guess it may be a good idea to check what GetLastError() 
returns when an mfc call, alongside good old debugging as you mention? Since 
there are no MFC specific error functions I can call, I mean.

Also, I found about the VERIFY macro last night, very useful to catch those 
should never happen bugs when you always need the side effect of the 
expression inside the macro.
0
EricLilja (1)
4/30/2007 11:06:01 AM
> returns when an mfc call, alongside good old debugging as you mention? Since 
                          ^^^
should be "when an mfc call fail"
0
4/30/2007 11:12:19 AM
I find myself single-stepping through MFC source a lot when this happens.  It is
unfortunate that the way MFC handles failures guarantees that GetLastError will always
return 0.
				joe

On Sun, 29 Apr 2007 15:12:01 -0700, Eric Lilja <Eric Lilja@discussions.microsoft.com>
wrote:

>Hello, in my application I had a call to CFrameWnd::Create() return 0 (which 
>indicates an error), so my question is: Is there a function I can call to get 
>a more detailed description of the error, maybe something mfc specific? I 
>tried a simple ::GetLastError(), but it returned 0....
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15975)
4/30/2007 4:03:54 PM
Ah, you didn't say that you were creating a CFormView.  Complete information is always
useful...had you actually said what you were doing, the "missing resource" is one of the
top candidates (failure to call AfxInitRichEdit[2] is another leader).

Unfortunately, MFC guarantees that if a failure occurs, the GetLastError value is
destroyed and is not available, which is why the single-stepping is usually required.  I
reported this as one of the many long-standing MFC bugs that ought to be fixed before new
features are added.
				joe

On Mon, 30 Apr 2007 04:06:01 -0700, Eric Lilja <EricLilja@discussions.microsoft.com>
wrote:

>
>
>"Scott McPhillips [MVP]" wrote:
>
>> Eric Lilja wrote:
>> > Hello, in my application I had a call to CFrameWnd::Create() return 0 (which 
>> > indicates an error), so my question is: Is there a function I can call to get 
>> > a more detailed description of the error, maybe something mfc specific? I 
>> > tried a simple ::GetLastError(), but it returned 0....
>> 
>> No, but you can single-step into the MFC code and see where it fails.
>> 
>> -- 
>> Scott McPhillips [VC++ MVP]
>> 
>> 
>
>Hi Scott and thanks for the reply! It turned to be a missing resource in the 
>project that caused the call to fail- Since MFC uses raw Win32 under the hood 
>(I presume), I guess it may be a good idea to check what GetLastError() 
>returns when an mfc call, alongside good old debugging as you mention? Since 
>there are no MFC specific error functions I can call, I mean.
>
>Also, I found about the VERIFY macro last night, very useful to catch those 
>should never happen bugs when you always need the side effect of the 
>expression inside the macro.
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15975)
4/30/2007 4:06:35 PM
I've had this problem too when I load recource DLLs and a resource is 
missing from the translated version.  Sometimes this happens if the source 
goes out for translation and the programmer adds resources to the main 
program in the mean time.  I've also had problems with some DLLs that call 
AfxSetResourceHandle() so as to replace the app's resources with their own 
(not intentionally of course).

Tom

"Joseph M. Newcomer" <newcomer@flounder.com> wrote in message 
news:vr4c3393u77aao4hge0mmm9vu4899jlhvq@4ax.com...
> Ah, you didn't say that you were creating a CFormView.  Complete 
> information is always
> useful...had you actually said what you were doing, the "missing resource" 
> is one of the
> top candidates (failure to call AfxInitRichEdit[2] is another leader).
>
> Unfortunately, MFC guarantees that if a failure occurs, the GetLastError 
> value is
> destroyed and is not available, which is why the single-stepping is 
> usually required.  I
> reported this as one of the many long-standing MFC bugs that ought to be 
> fixed before new
> features are added.
> joe
>

0
tom.nospam (3240)
4/30/2007 5:09:20 PM
Joseph M. Newcomer skrev:
> Ah, you didn't say that you were creating a CFormView.  Complete information is always
> useful...had you actually said what you were doing, the "missing resource" is one of the
> top candidates (failure to call AfxInitRichEdit[2] is another leader).

I agree that questions should be detailed. But I wasn't creating a 
CFormView, I was creating a CFrameWnd. Also, the actual problem with the 
missing resource was already solved when I posted my question, but I was 
still interested in hearing if there were any functions I could call to 
obtain a more detailed error description instead of just concluding that 
CFrameWnd::Create() returned 0.

> 
> Unfortunately, MFC guarantees that if a failure occurs, the GetLastError value is
> destroyed and is not available, which is why the single-stepping is usually required.  I
> reported this as one of the many long-standing MFC bugs that ought to be fixed before new
> features are added.
> 				joe
> 
> On Mon, 30 Apr 2007 04:06:01 -0700, Eric Lilja <EricLilja@discussions.microsoft.com>
> wrote:
> 
>>
>> "Scott McPhillips [MVP]" wrote:
>>
>>> Eric Lilja wrote:
>>>> Hello, in my application I had a call to CFrameWnd::Create() return 0 (which 
>>>> indicates an error), so my question is: Is there a function I can call to get 
>>>> a more detailed description of the error, maybe something mfc specific? I 
>>>> tried a simple ::GetLastError(), but it returned 0....
>>> No, but you can single-step into the MFC code and see where it fails.
>>>
>>> -- 
>>> Scott McPhillips [VC++ MVP]
>>>
>>>
>> Hi Scott and thanks for the reply! It turned to be a missing resource in the 
>> project that caused the call to fail- Since MFC uses raw Win32 under the hood 
>> (I presume), I guess it may be a good idea to check what GetLastError() 
>> returns when an mfc call, alongside good old debugging as you mention? Since 
>> there are no MFC specific error functions I can call, I mean.
>>
>> Also, I found about the VERIFY macro last night, very useful to catch those 
>> should never happen bugs when you always need the side effect of the 
>> expression inside the macro.
> Joseph M. Newcomer [MVP]
> email: newcomer@flounder.com
> Web: http://www.flounder.com
> MVP Tips: http://www.flounder.com/mvp_tips.htm
0
4/30/2007 5:19:18 PM
Reply:

Similar Artilces:

Problems with creating a newsletter
I chose the form "Newsletter - email". I have created a 3 page newsletter. Now, I have NO IDEA how to send it out as an email. I do not want to send it as an attachment. I cannot figure out which "save as" format or what I need to do so that i can email this newsletter. Is there a website that goes through how to do this? Am I correct when I say that it has to be html in order for me to send it as email? That is not one of the options. Any help you give me would be greatly appreciated. Thank you, Markis www.adreamforabetterworld.com ...

Business Portal Error-SQL server does not exist or access denied
Hi, We are running business portal 4.0 for one of our customer. It was running correctly, however, they have changed the SQL server port (previously it was set as default 1433). After that the business portal becomes very slow and while creating a new request (purchase requisition) if we open the item pop up; it is showing exception "SQL Server does not exist or access denied...." Can any body tell me how can I provide the new port number to business portal connection to the database. Thanks and Regards, Waliullah, Thanks for using the newsgroups. I have a...

crm 3.0 error 03-01-06
Hello, I'me getting this error while installing crm3.0 for SBS: "error writing to file microsoft.mshtml.dll verify that you have access to that directory" That file is in the C:\Program Files\Microsoft.NET\Primary Interop Assemblies directory. I (and 'everyone') has full access to that dir. What can I do about this?? kind regards, Thomas ...

VBA to creating autotext entries or quickparts in different catego
I have a VBA application that basically allows people to easily create autotext entiries, move them between machines and use them making comments on assignments. Currently it operates in EXACTLY the same way in Word 2003 and 2007 (using userforms) and I want to keep that as long as possible. You can see the application at http://emarking-assistant.baker-evans.com and either the screen image or the video demos will give you an idea of what I am doing Currently I store all the comments in a long list of autotext entries that is displayed in a field with the value of the entr...

Error in Outlook Today
Whenever I go to Outlook Today, I get a runtime error, line: 297 Error: Class Not Registered. Then I get the error two more times when I click 'Customize Outlook Today...' and the list 'Show Outlook Today In This Style' is empty, and the box under it has a broken image icon. What could be the cause of this? Sorry...forgot to say...I'm using Outlook 2003 Student and Teacher Edition on Windows XP. >-----Original Message----- >Whenever I go to Outlook Today, I get a runtime error, >line: 297 Error: Class Not Registered. Then I get the >error two more time...

Opening pub files created with older Publisher versions #2
I have just upgraded to Publisher 2003 from 2000 and am having trouble with pub files sent to me for our chuch newsletter which is using Publisher 97 The text is not wrapping around graphics boxes. Can I fix this? I really don't want to go back to Pub 200 Thank Richard this is caused by Publisher 97 not been printer independent. Even if you went back to Publisher 2000, unless you have the identical font versions and printer driver you would have issues with formatting. It sounds like the person sending you the file has a garbage HP inkjet printer. Get them to install the HP5P laser p...

Re: 'Uknown Error 0x800CCC97'
I just heard back from the folks with whom I filed this bug. They say the bug is fixed in cppop 5.4 - request that your ISP upgrade to that. -- Jeff Stephenson Outlook Development This posting is provided "AS IS" with no warranties, and confers no rights "Jeff Stephenson [MSFT]" <stephenson@online.microsoft.com> wrote in message news:... > See the attached reply to another similar question. Your ISP's POP3 server > has a bug, and they should get a fixed version of the server. > > -- > Jeff Stephenson > Outlook Development > This posting...

stop error defeating me
Hi, XP Pro PC. When I start the computer I can start in safe mode but when I try to start in normal mode it loads to the log on screen. I type the username and password in then it starts to load but stops after a few moments with a blue screen. The error is Stop: c000021a (fatal system error) The windows subsystem system process terminated unexpectedly with a status of 0xc0000005 (0x7c9106c3 0x0055f36c). Begininning dump of physical memory. I have uninstalled AVG, also taken out the graphics card and uninstalled all the drivers for it. I have also changed the RAM. I have also d...

Error in database....
A user posted a batch in payables management. After posting, there was an error encountered. It displays that the table updating was interrupted, use batch recovery to continue the posting. But when I used the batch recovery, it was not successful to continue the update process. When I click the "More Details" button it displays, A save operation on table 'PM_Transaction_WORK' caused a sharing error. How can I resolve this issue? Thanks, John John, it is a db sharing violation. Have all users logout DELETE tempdb..DEX_LOCK DELETE tempd..DEX_SESSION DELETE dynami...

Creating Text Box in Publisher 2007 Crashes the Application
Hello, we have a clean install of Publisher 2007 under Windows XP SP2, and when we try to create a text box in a document, (both an existing document and a blank document), publisher crashes. Office is fully patched. I ran Office Diagnostics from the help menu and no problems were found and the issue persists. Any thoughts on how to resolve the issue? Thanks, Syd See if selecting a different printer as default helps. How to view error signatures if an Office program experiences a serious error and quits http://support.microsoft.com/kb/289508/en-us -- Mary Sauer MSFT MVP http://of...

Creating a Macro to Delete Commas #2
I have an excel file that the size will varry. I need a macro that will check all the fields for a comma. If there is one I would like to get rid of it. Does anyone have any idea how to do this? I have no idea and I have been assigned this task. Help --- Message posted from http://www.ExcelForum.com/ No macro required. ctrl-H for find/replace. find , replace nothing (leave the replace field blank). You can of course record that within a macro if you wish. Drabbacs >-----Original Message----- >I have an excel file that the size will varry. I need a macro that will >check ...

Create Exchange mailbox from command line
I'm writing a script using dsadd and I was wondering if it's possible to create an exchange mailbox from the command line. Donovan Maybe not exactly what you want but it may help: http://www.joeware.net/win/free/tools/exchmbx.htm -- Neil Hobson Exchange MVP For Exchange news, links, and tips, check: http://www.msexchangeblog.com "Donovan Linton" <DonovanLinton@discussions.microsoft.com> wrote in message news:D9C839EF-883D-4E2E-8BE9-57782582F043@microsoft.com... > I'm writing a script using dsadd and I was wondering if it's possible to > create an ...

error 553
The following error occurs when sending email from my business domain. It does not occur when sending through my roadrunner account. The following recipient(s) could not be reached: on 10/22/2003 2:05 PM 553 sorry, that domain isn't in my list of allowed rcpthosts (#5.7.1) What does this mean and how can it be fixed? ...

creating a backup on 2002 for Money 98
I am helping a friend who has 98. I need to make a backup of info on my 2002 for him to use on 98. Any suggestions as to how to do this? M98 can't read any file written by M02 besides .QIF import. M02 can't write any file readable by M98 except for .QIF export. Sounds like QIF export/import is your only choice. I suspect you will find this doesn't do what you want. "Carlotte" <Carlotta41@discussions.microsoft.com> wrote in message news:015b01c3d2fa$bbf8fd60$a101280a@phx.gbl... > I am helping a friend who has 98. I need to make a > backup of info on...

80070005 error #2
I am getting this error when trying to view public folder property from system manager. My issue is same as what you can find out from http://forums.msexchange.org/ultimatebb.cgi? ubb=get_topic;f=19;t=000114 Anyone has a clue? ...

How to use count for calls per hour
I am trying to create a pivot table and chart that will show me the # of calls per hour by day for a range of dates Aug 1 - Sept 19. My data looks like this where each line is the date and time of the call: How do I get a count of the # of the calls per hour by day? 8/1/08 12:48 AM 8/1/08 1:53 AM 8/1/08 2:36 AM 8/1/08 3:24 AM 8/1/08 3:37 AM 8/1/08 4:04 AM 8/1/08 4:44 AM 8/1/08 4:55 AM 8/1/08 4:58 AM 8/1/08 7:02 AM 8/1/08 7:28 AM 8/1/08 7:43 AM 8/1/08 7:47 AM 8/1/08 7:56 AM 8/1/08 7:58 AM 8/1/08 8:13 AM 8/1/08 8:33 AM 8/1/08 9:07 AM 8/1/08 10:28 AM 8/1/08 10:38 AM 8/1/08 10:44 AM 8/1/08 ...

Start macro creating a mail with contact data and autotext
Hallo, I am working with an user form. The developing of that form started with Outlook XP with a lot of code inside for different buttons. I changed to Outlook 2007 and unfortunately the code of the form was not longer displayed. What I learned about this is that MS does not support to much code in the form (or maybe a bug). They also do not support any longer. I was sending this form to MS support but they told it is do much code inside and they do not know, why the code is not displayed. In Outlook 2003 the code is displayed as in Outlook XP. Because I do not know real...

find data and autopaste when found
Hi, Can someone help me how to do this : For checken the backorders of our customers we can extract a list fro our SAP system. this list is always different and shows us ever product per customer in Back order. ex. Customer A has product 1 en in backorder. This gives 2 lines in the xls file. can excel put th name of the customer on a form and it's backorders automatically. Ca it create for each customer showing in the list a new form? thanks koenraa -- Message posted from http://www.ExcelForum.com ...

find instance of IE for server socket in activex component
Hi I have an activex component that has a server socket (using casyncsocket class) ..The problem is that when I have multiple instances of the IE open only the first instance (created first) recieves the messages the rest do not recieve the message. Is there a way to solve this problem .(i want the server send the reply to that instance of ie that sent the message) .Do I need to pass something like a pointer of hte javascript object .If so how Thanks When you say "server socket", that suggests a socket that does a Listen followed by an Accept. Otherwise it is a client socke...

XML Mapping: Creating a "non-repeating schema element" in VS2005
Question regarding XML mapping in Excel. XML Mapping in Excel allows you to map "non-repeating schema elements" to an individual cell while "repeating schema elements" automatically get handled as an Excel "list". I want a table(XML/XSD) exported from a VS2005 dataset to be CELL mappable rather than LIST mappable. Is there a way to make Excel interpret the native dataset XML/XSD as non-repeating? Said differently, what makes a schema element "repeating" versus "non-repeating"? Is it a unique XPATH statement? If my underlying table has...

CRM Error
Hello When a user replies to an CRM email, clicks the "reply" button or the "reply all" button, clicks in the body of the email message and clicks "insert template", this error appears. This does not happen every time, and happens to various users. Does anyone know why we would get this error? ...

smtp authentification errors
Hello, I just installed Exchange 2003. It all works fine. I=B4m now=20 retrieving the emails via pop-con and pop3. However I=20 cannot send any authenticicated emails, because the=20 exchange server sends a wrong authentification account to=20 the mail provider, despite the fact, that the right one to=20 be used is enterd. The mail provider tells me that he recives a smtp call,=20 but it=B4s aborted by his server. We do not have a static IP but a dynamic IP, that changes=20 every 24 hours. If a messages is sent to an existing hotmail account the=20 following error message is displayed in the ...

#error in the calculated field
Hello, I locked the data entered for some users, because their role is just to input the date of invoice for approval by Prj.Manager. My qeustion is, is it the reason we see the "# error" in the VAT checking field??. I tried to ck formula in the qrid query, nothing wrong Thanks for your explanation -- H. Frank Situmorang On Tue, 15 Jan 2008 23:33:01 -0800, Frank Situmorang <hfsitumo2001@yahoo.com> wrote: >Hello, > >I locked the data entered for some users, because their role is just to >input the date of invoice for approval by Prj.Manager. > >My q...

How Do I Create A Personal Address Book In Outlook 2002
Hi: I'm new to Outlook 2002 and would like to know how do i go about creating a personal address book. Thanks in advance. Lisa wrote: > Hi: > > I'm new to Outlook 2002 and would like to know how do i go > about creating a personal address book. > > Thanks in advance. You have a contacts folder ...that's what you should use. "Personal Address Book" means .pab file - it's an old legacy thing, not what you want or need. Enter all your contacts/addresses in your Contacts folder. If it isn't showing up as an address book when you click the TO bu...

Error when changing average perpetual
I Have the following error in Microsoft Dynamics GP on the screen of average perpetual "Message #10577 Missing" somebody knows about this??? Thankļæ½s. Gabriela Martinez. ...