?
Solved

How to use CInternetSession in a Regular DLL

Posted on 2003-02-26
3
Medium Priority
?
455 Views
Last Modified: 2012-06-21
Hi,
   I created a Regular DLL Using shared MFC DLL. In the dll i used the CInternetSession class in a function GetItems(). i am not getting any compile time errors. but when i am
accessing the dll from visual basic/VC++. i am firing with the following error.
 
"Degug Assertion Failed
 
 Program c:\Program Files\Microsoft Visual Studio\vb98\vb6.exe
 File: afxwin1.inl
 line: 27

 For Information on how your program can cause an assertion failue, see the
 Visual C++ documentation on asserts".

 i tried a lot but couldn't able to overcome from this.

 please anyone help me to solve this problem.

 this is the code i used in my dll

 CString GetAnchorPage(CString stUrl)
 {
          CString st;
          try
          {
               CInternetSession sess;
               CInternetFile *file;
               file=(CInternetFile *) sess.OpenURL(_T(stUrl),1,INTERNET_FLAG_RELOAD|INTERNET_FLAG_TRANSFER_ASCII,NULL,0);
               if (file)
               {
                     CString somecode;
                    while (file->ReadString(somecode) != NULL)
                    {
                         st = st + somecode+"\n";
                    }
                    file->Close();
                    delete file;
               }
             }
          catch(CInternetException *exp)
          {
                    exp->Delete();
          }
        return st;
}
unsigned short _declspec(dllexport) __stdcall GetItems(char * far cpsource)
{
     CString source;
     source=GetAnchorPage(_T("http://wwww.alltheweb.com"));
     cpsource=source.GetBuffer(source.GetLength());
     return 0;
}

 
 thanks in advance.
 sirisha.

0
Comment
Question by:sirisha2003
2 Comments
 
LVL 1

Accepted Solution

by:
ZhenyaS earned 200 total points
ID: 8053263
You return local variable CString st.
0
 

Expert Comment

by:CleanupPing
ID: 9447474
sirisha2003:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
What do responsible coders do? They don't take detrimental shortcuts. They do take reasonable security precautions, create important automation, implement sufficient logging, fix things they break, and care about users.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Progress

612 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question