CInternetSession Assertion Failure #2

Hi!

I'm a biginner c++ programmer that needs help. Here is my code:


#include <AfxInet.h>
int main()
{
CInternetSession mySession;
return 0;
}


This program compiles fine but ouputs the following output error:
"Debug Assertion Failed!
Program: C:\WebSearcher\Debug\play_around1.exe
File: afxwin1.inl
Line: 27

When I take a look at afxwin1.inl, the problem originates from the
following lines:

// Inlines for AFXWIN.H (part 1)
#ifdef _AFXWIN_INLINE
// Global helper functions
_AFXWIN_INLINE LPCTSTR AFXAPI AfxGetAppName()
        { ASSERT(afxCurrentAppName != NULL); return afxCurrentAppName;
}


So two question: What IS an assertion error , and why am I
getting this error?

0
etayluz (2)
10/27/2005 11:35:19 PM
vc.mfc 33608 articles. 0 followers. Follow

1 Replies
1011 Views

Similar Articles

[PageSpeed] 8

Etayki wrote:
> Hi!
> 
> I'm a biginner c++ programmer that needs help. Here is my code:
> 
> 
> #include <AfxInet.h>
> int main()
> {
> CInternetSession mySession;
> return 0;
> }
> 
> 
> This program compiles fine but ouputs the following output error:
> "Debug Assertion Failed!
> Program: C:\WebSearcher\Debug\play_around1.exe
> File: afxwin1.inl
> Line: 27
> 
> When I take a look at afxwin1.inl, the problem originates from the
> following lines:
> 
> // Inlines for AFXWIN.H (part 1)
> #ifdef _AFXWIN_INLINE
> // Global helper functions
> _AFXWIN_INLINE LPCTSTR AFXAPI AfxGetAppName()
>         { ASSERT(afxCurrentAppName != NULL); return afxCurrentAppName;
> }
> 
> 
> So two question: What IS an assertion error , and why am I
> getting this error?
> 

Assertion errors happen only in debug builds.  They are caused by run 
time checks that were put into the code by the programmer.  They are 
meant to warn you, the next programmer, that something the code assumes 
has been violated.

In your example, it looks like CInternetSession needs an MFC 
environment, and you have not created an MFC environment.  (You don't 
have a CWinApp-derived object.)

-- 
Scott McPhillips [VC++ MVP]

0
Scott
10/28/2005 3:06:04 AM
Reply:

Similar Artilces:

Help with CInternetSession
Hey everyone, hoping someone can give me a hand here as this seems a little backwards to me. Basically I am writing an application that uploads a file to my webserver (a static IP) using CInternetSessions and CFtpConnection. Now I've included the code I'm using below to illustrate what seems wrong to me (and probably is :( ). Basically I don't know/understand when I'm supposed to delete my sessions and connections (seems like I never call ::Close() probably not a good thing). If anyone can see what I'm doing wrong (remember I'm calling this chunk of code about every ...

Lost messages from outside #2
We have several domains that are unable to send messages to us. I don't see them in the message tracker, they dont appear to ever reach the exchange server. we do receive messages from the outside, i have a hotmail, yahoo, and personal account that messages always are received from. We have two mx records, the primary is obsolete (and will be removed), but the secondary should be able to be located. We do not get our mail from our isp, mail should hit our external gateway, then the firewall and then get redirected to the mail server. we use a pix firewall Exchange 2003. Where...

Saving an Excel file #2
Version: 2008 Operating System: Mac OS X 10.5 (Leopard) Processor: intel I cannot save an Excel file to my hard drive. I get a message that reads "...Cannot access the file "Macintosh HD" with various reasons. Have you tried repairing disk permissions? Have you udated to Office 12.0.1? Are you running OS X 10.5 or 10.5.2? It would help to know specifically *what* reasons are given in the error messages - "various" tells us absolutely nothing. In fact, the content you're omitting is the most important part. -- Regards |:>) Bob Jones [MVP] Office:Mac <fr...

recall #2
We have recalled an email that was sent out and it appears that there is sometype of a reoccurring loop that it continues to recall the email and is actually closing outlook on the other computer. Does any body have an ssugestions on how to stop this? Thank you ...

CRM client will not go back online #2
I have a user who has gone offline and now will not go back online. I have CRM3.0 with the rollup in place. The user is at a remote branch. I turned the firewall right off. I can ping the CRM server and the webbrowser version works fine. the only information in the event viewer is as follows: "SQL Server has encountered 1 occurence(s) of cachestore flush for the 'Bound trees' cachestore (part of plan cache) due to some database maintenance or reconfigure operations. Does anybody have any suggestions? Thanks, I don't know if it is what happened to me, but it sound...

HELP ! Exchange Server 2003 Failure
Our Exchange Server is totally dead due to drive failure. This was the only Exchange Server in our single 2003 AD Domain. I probably won't be able to resurrect this server because the drive has failed, so I'm wondering what the next steps are ? I do have a recent backup of the System State and also the Information Store. I would like to keep the same IP address and hostname of the Exchange Server. thanks for any help. chrism Hi Chrism If you have a backup the solution is pretty simple. If you have a Full system backup you could simply install Windows and restore your ful...

Problem with Outlook sending attachments endlessly #2
One of my PCs is having a problem sending attachments through Outloo XP. When sending attachments of even moderate size (~750kb), th attachment is sent and then queued again and then sent and then .... Outlook endlessly sends the attachment, flooding my poor recipients. I have tried two completely different SMTP servers with the sam result. The odd thing is that my other PC, also with Outlook X installed, has no problems sending attachments. Any ideas on this one? After queuing an email with an attachment thi morning, I came back from lunch and found that it had sent the sam email 78 tim...

formula ? #2
I have conditional formatting now working in a spreadsheet where I have the months going across columns c5:i5 and grand totals in column j5. I have the conditional formatting working as follows to highlight drops in revenues =(d5<c5) and it works great, but also highlights cells that are blank, what can I add to make only cells with #'s highlighted. Thanks in advance. Hi! Try this: =AND(D5<>"",C5<>"",D5<C5) Biff >-----Original Message----- >I have conditional formatting now working in a spreadsheet >where I have the months going...

2 Entities in 1 View?
Is there any way (without creating a report) to show data from two related entities (eg Account & Contact) in one view? Sorry, there's no out-of.the-box solution to do it. The views are automatically generated and always use one table as their primary input. You can write a custom callout collecting the required data from other objects and add them redundantly to an entity, which will allow you to view them, but you would also need to take care about the opposite: the redundant fields must be updated when a field in the referenced items is modified. So it is possible, but yo...

Page Setup #2
I have Pub2K and I'd like to print an address book of some 30 pages, so the A names go on the first page, the B names go on the second page, the C names - on the 3rd page, the D names - on the 4th page and so on. I'd like to print it on both sides of a page. Each page is 3.5x6.5 inches, so I can fit six pages on a letter size (8.5x11) sheet of paper. But how do I set up a page? Using a trifold will mess-up the alphabetical order, printing one page at a time will waist 75% of paper... Is there a way to print a small size (3.5x6.5) publication on a standard letter size paper? ---------- ...

Exchange Server and Outlook #2
Hi all Does anyone have information of a site or documentation that is like a Exchange Server for new users Thanks cds Go to WWW.MSEXCHANGE.ORG there are very easy tutorials to start for new users. /shan "cds" wrote: > Hi all > > Does anyone have information of a site or documentation that is like a > Exchange Server for new users > Thanks > cds > > > ...

assertion problem in Mixed mode DLL
Pardon the cross post, but I'm not sure where exactly to post this question. We have MFC application using many MFC extention DLL's. We started using a new MFC extention DLL that is mixed mode so we could use some .Net components we have built. We are getting an assertion in ~CCmdTarget when exiting our app when after making a call to Windows Forms MessageBox. On line 48, m_dwRef is 2 for some reason. Offending line - System::Windows::Forms::MessageBox::Show("Test"); Is there some function I need to call to release something that I am missing? Any ideas? Thanks... Craig...

xl 2007 how to validate that cell 1 invalid if cell 2 not blank
microsoft office 2007 xl - how do you validate a cell such that you cannot enter a value in cell 1 if a value has been entered in cell 2? ...

Hyphenation #2
I don't like it, and I don't want to install it. But Publisher won't leave me alone about it now. How do I get it to stop telling my about installing hyphenation? Microst Publisher 2000 SR-1 Windows XP Pro. -- _________________________ Bill DeShawn bdeshawn@nospamsterling.net http://my.sterling.net/~bdeshawn Have you tried a detect and repair found under help? Have you turned off hyphenation in Options? -- Mary Sauer MSFT MVP http://office.microsoft.com/ http://msauer.mvps.org/ news://msnews.microsoft.com "Bill DeShawn" <bdeshawn@nospamsterling.net>...

Can I print 2 A5 side by side on A4 landscape
Using Publisher , how can i produce two identical A5 text layouts , side-by-side on a sheet of A4 landscape paper Setup your printer first, select A4. In page setup select custom, landscape, input 14.8cm width and 20.997cm height. The dialogue on the page setup will say "Prints 2 copies per sheet, 2 columns of 1." -- Mary Sauer MSFT MVP http://office.microsoft.com/ http://msauer.mvps.org/ news://msnews.microsoft.com "Molly" <Molly@discussions.microsoft.com> wrote in message news:12E49428-863F-4657-92FE-0263BBA164C2@microsoft.com... > Using Publisher , how c...

Web Access #2
Hey guys, I cannot user Outlook Web Access anymore, where can I troubleshoot this? You haven't said what version, and given very little information to go on, so this reply may be way off. You could start with the OWA troubleshooting guide: http://www.microsoft.com/technet/prodtechnol/exchange/2000/support/troubowa.mspx -- Neil Hobson Exchange MVP For Exchange news, links and tips, check: http://www.msexchangeblog.com "Melvin" <mrodriguez@nyas.org> wrote in message news:eh61ZzrWEHA.808@tk2msftngp13.phx.gbl... > Hey guys, I cannot user Outlook Web Access anymore,...

Login Failure Following Reinstall
I had a hard drive failure a couple of weeks ago, and after reinstalling Money 2004 and restoring my documents (thank goodness for the external HDD backup!), I'm having trouble logging into Money. I opened the existing Money file, and everything seemed ok; it remembered my Passport ID just fine. However, it's not accepting my password. Tells me "The sign-in attempt for <<my passport>> was unsuccessful. Please try your sign-in name and password again." I know I'm entering my password correctly, since I use it routinely in Hotmail. Is there some tri...

message is infected with Virus.MSWord.Marker.kl virus #2
Our files are stored on a windows server and a few weeks ago it crashed and burned. Since they restored it we have had problems with the files. The latest problem is I sent a word file to somebody and it bounced back with the following message: Received: 554 Sorry, message is infected with Virus.MSWord.Marker.kl virus. I looked for info on the virus but it shows cures for windows but not for Macs. For the last few days whenever I open a word document it now asks whether I want to disable the macros. Never had to do this before. How can I tell if I am infected and how do I get rid of it?...

E-mail failures
Help! I'm running Outlook 2000 with all latest critical Updates I have 6 E-mail services setup within Outlook. Two are "sleepers" with only the occasional message, one of the others is my ISP's e-mail account, and the other three are on a separate domain. The problem is that on the four "active" mailboxes the system won't seem to complete the download of messages, failing with the "connection lost"... contact your ISP" message. This happens whether I do the boxes individually of on one Send/Receive. It usually succeeds in the first few messages...

shapes #2
in publisher 2003, when I insert a shape it moves the text over. I want the shape to go around the text. Send the object to the back. (Arrange menu). Or select the text box, on the picture toolbar, click the dog icon, click none. -- Mary Sauer MSFT MVP http://office.microsoft.com/ http://msauer.mvps.org/ news://msnews.microsoft.com "school girl" <schoolgirl@discussions.microsoft.com> wrote in message news:6AB5DF10-A2E1-4BE3-AD64-0C85BD6BBCA8@microsoft.com... > in publisher 2003, when I insert a shape it moves the text over. I want the > shape to go around the text...

CRM 1.2 -> 3.0 Upgrade failure
Hi, I am trying to get an install of CRM 1.2 upgraded to 3.0 but am running in to some issues when I try to. The installer fails with the following warnings and errors: Warning: The indexes on the Microsoft CRM database are not consistent with Microsoft CRM 1.2 indexes. Warning: Discrepancies were found in the read-only metadata. Error: Microsoft CRM 1.2 database export failed. The installer log files has the following line: 14:09:13| Error| Check ExportXmlValidator : Failure: Microsoft CRM 1.2 database export failed. We have previously been able to upgrade 1.2 to 3.0 successfully in ...

CInternetSession #2
Hello! For two days now, Iam strugling with some dificulties using CInternetSession.OpenURL() function. Iam writing simple code for separate thread function such as: while(true) { CInternetSession csiSession; CStdioFile* MyFile = csiSession.OpenURL(_T("http://www.someurl.com")); // working on retrieved data MyFile->Close(); delete MyFile; } Iam using VC2k5 and while building solution Ive received warning: First-chance exception at 0x7c90eb74 in Project1.exe: 0xC0000008: An invalid handle was specified. Warning is poiting to "OpenURL", but I don&#...

scientific notation hassle #2
Hi Frank, I tried your recommendation, but it's still forcing the scientifi notation. :( I am also separating the id from the rest of the URL by doing "text t columns" (usually we are working with hundreds of ids). Any othe ideas? Thanks -- irisheyes9 ----------------------------------------------------------------------- irisheyes99's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=737 View this thread: http://www.excelforum.com/showthread.php?threadid=26655 ...

Import Failures
Hi , I am trying to import about 3000 records in CRM 3, however the contact import fails for lots of them , when I try a smaller batch , the success rate is higher (it imports successfully for the records which failed when tried upon in higher number of record import). Any clue why it happens like this ? Is there something I am missing here ? Thanks a lot for any inputs or suggestions . Kishore It seems that the Import tool likes to have the rightmost field/column in the import be populated, so try rearranging your import file that way. Lee Adler Kishore wrote: > Hi , > >...

HtmlHelp Assertion Failures
Hey, I'm trying to implement context-sensitive help into my program using HtmlHelp. Everything seems to be running fine except for one thing. When you bring up the context sensitive help in the program (which works fine), then click *outside* the yellow text box to get rid of it, the program dies with a debug assertion failure. You can however 'ignore' the assertion failure and the program still runs fine, but obviously there is something not quite right, and I want to fix it. The code I used for the bringing up of the context sensitive help: BOOL COptionsDlg::OnHelpI...