Solved

WinInet exception - help !

Posted on 1998-08-21
3
1,261 Views
Last Modified: 2013-11-20
I am programming an ActiveX control in which I call the WinInet class CInternetFile - see code below :

BOOL CWebctlCtrl::GetConfigData(LPCTSTR szURL)
{
// TODO: Add your dispatch handler code here
CInternetSession session("My FTP Session");
CInternetFile *pIF;
DCEDATA dce;
CFtpConnection* pConn = NULL;
char buf[30];

AfxMessageBox(szURL);
pConn = session.GetFtpConnection((LPSTR) szURL, NULL, NULL, 80  );//get the file
      
lstrcat((char *) szURL,"//dce-data.dat");
pIF = pConn->OpenFile((LPSTR) szURL); // defaults used
pIF->Read((DCEDATA *) &dce, sizeof(DCEDATA));
pIF->Close();

pConn->Close();
session.Close();

wsprintf(buf,"CDSServername is %s",dce.CDSServerName);
AfxMessageBox(buf);
wsprintf(buf,"CellName is %s",dce.CellName);

return TRUE;
}

When I invoke this method thru the ActiveX Control Test Container, it throws an CInternetException exception 12007 at the GetFtpSession call. This I see when I debug the control and supply the ActiveX Control Test Container as the executable to debug with.

The argument I supply in this case is "ftp://mycomputername". On my NT 4.0 Workstation I have peer web services which has the FTP Server running.

What could be the reason for this exception ? In fact, if anyone could point me how to look up this exception that'd be far better !

Thanks
fstab.
0
Comment
Question by:fstab
[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
  • 2
3 Comments
 
LVL 8

Accepted Solution

by:
Answers2000 earned 100 total points
ID: 1321142
I just typed in all...and got an error from Ex-Ex server.  Answer is in the comment below (retyping now)...
0
 
LVL 8

Expert Comment

by:Answers2000
ID: 1321143
I'll go for "if anyone could point me how to look up this exception that'd be far better !"

From the MSVC docs on CInternetException
(begin quote)
For a list of Win32 error codes, see Error Codes in the Win32 SDK. For a list of Internet-specific error codes, see the ActiveX SDK documentation.
(end quote)
There's a link to Win32 error codes (you've probably seen this) but not to Internet error codes,  therefore switch to text search...

From WININET.H (I found the header using the Find In Files option in MSVC)
(begin quote)
#define INTERNET_ERROR_BASE                     12000

#define ERROR_INTERNET_OUT_OF_HANDLES           (INTERNET_ERROR_BASE + 1)
#define ERROR_INTERNET_TIMEOUT                  (INTERNET_ERROR_BASE + 2)
#define ERROR_INTERNET_EXTENDED_ERROR           (INTERNET_ERROR_BASE + 3)
#define ERROR_INTERNET_INTERNAL_ERROR           (INTERNET_ERROR_BASE + 4)
#define ERROR_INTERNET_INVALID_URL              (INTERNET_ERROR_BASE + 5)
#define ERROR_INTERNET_UNRECOGNIZED_SCHEME      (INTERNET_ERROR_BASE + 6)
#define ERROR_INTERNET_NAME_NOT_RESOLVED        (INTERNET_ERROR_BASE + 7)
[tonnes more follow]
(end quote)


Therefore your error is (from ActiveX SDK)
(begin quote)
ERROR_INTERNET_NAME_NOT_RESOLVED
The server name could not be resolved.
(end quote)
0
 
LVL 1

Author Comment

by:fstab
ID: 1321144
Thanks for the look up. I was also looking for sample code to catch this exception programmatically. If that could be provided too it would help me in troubleshooting when this error occurs without doing it in the Debugger. I will rate your answer as excellent when you do that.

Thanks
fstab.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

734 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