?
Solved

How to use CInternetSession in a Regular DLL

Posted on 2003-02-26
3
Medium Priority
?
430 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
The SignAloud Glove is capable of translating American Sign Language signs into text and audio.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Six Sigma Control Plans

764 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