Click here to Skip to main content
15,903,362 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: moving present MFC project to be part of a new workspace.HOW? Pin
_AnsHUMAN_ 17-Jan-06 1:56
_AnsHUMAN_ 17-Jan-06 1:56 
AnswerRe: moving present MFC project to be part of a new workspace.HOW? Pin
David Crow17-Jan-06 4:16
David Crow17-Jan-06 4:16 
QuestionProgress bar implementation for recursive directory deletion Pin
Chintoo72316-Jan-06 23:38
Chintoo72316-Jan-06 23:38 
AnswerRe: Progress bar implementation for recursive directory deletion Pin
David Crow17-Jan-06 4:21
David Crow17-Jan-06 4:21 
AnswerRe: Progress bar implementation for recursive directory deletion Pin
vallikumar17-Jan-06 19:27
vallikumar17-Jan-06 19:27 
QuestionIO Completion Ports socket error Pin
yani dzhurov16-Jan-06 22:40
yani dzhurov16-Jan-06 22:40 
AnswerRe: IO Completion Ports socket error Pin
__yb17-Jan-06 11:35
__yb17-Jan-06 11:35 
QuestionFTP directory listing Pin
Angel Kafazov16-Jan-06 21:43
Angel Kafazov16-Jan-06 21:43 
Hi,

I am making an asynchronous ftp connection and then I want to list all files in the current directory. Here is my function

BOOL
StatupController::StartupSyncSoftware( StationType _stType ) {

ClsArchive *UnZipper;
char pszZipFile[64];
char pszDestPath[64];
char pszRemoteFile[64];
char pszFtpServerAddress[64];
HINTERNET hConnection =NULL,
hFtpConnection =NULL,
hDir =NULL;
BOOL bResult;
HINSTANCE hOcx;
FARPROC lpfn;
WIN32_FIND_DATA Data;
BOOL bRes;
DWORD error;

UnZipper = new ClsArchive();

switch( _stType ) {
case SatelliteStation:
strcpy( pszZipFile, "C:\\Flightvision.zip" );
strcpy( pszDestPath, "C:\\" );
strcpy( pszRemoteFile, "Flightvision.zip" );
strcpy( pszFtpServerAddress, "192.168.1.38" );
// open ftp connection
hConnection = InternetOpen( "FVStartup", INTERNET_OPEN_TYPE_DIRECT,
NULL, NULL, INTERNET_FLAG_ASYNC );

InternetSetStatusCallback(hConnection,FtpCallback);
if( hConnection == NULL ) return FALSE;
hFtpConnection = InternetConnect( hConnection, pszFtpServerAddress, INTERNET_DEFAULT_FTP_PORT,
"anonymous", "pass", INTERNET_SERVICE_FTP, 0, 0 );
if(hFtpConnection == NULL) return FALSE;
// find latest version
//DisplayDir(hFtpConnection,INTERNET_FLAG_NEED_FILE);
hDir = FtpFindFirstFile(hFtpConnection, TEXT ("*.*"),
&Data,
INTERNET_FLAG_NEED_FILE,
0);

if(hDir!=NULL) {
do {
bRes = InternetFindNextFile(hDir,&Data);
} while((error=GetLastError())!=ERROR_NO_MORE_FILES); // ERROR_IO_PENDING 997
}

// close connection
InternetCloseHandle(hDir);
InternetCloseHandle(hFtpConnection);
InternetCloseHandle(hConnection);

case BaseStation:
case WorkStation:
case NotAssigned:
default:
return false;
}


the problem is that the InternetFindNextFile(..) function always returns FALSE and the last error that I gen with GetLastError() is ERROR_IO_PENDING. I did not start any lengthy operation before that, this is way it doesn't make much sence to me. I also noticed that the FtpCallback function is never called and, of course, I think this is OK since no operation has been started yet. Can somebody give more insight on this and help me figure out why the directory listing isn't working correctly?

Thank you very much in advance.

A. Kafazov
AnswerRe: FTP directory listing Pin
David Crow17-Jan-06 4:24
David Crow17-Jan-06 4:24 
GeneralRe: FTP directory listing Pin
Angel Kafazov17-Jan-06 4:30
Angel Kafazov17-Jan-06 4:30 
QuestionShare names Pin
kelprinc16-Jan-06 20:39
kelprinc16-Jan-06 20:39 
AnswerRe: Share names Pin
vallikumar16-Jan-06 21:36
vallikumar16-Jan-06 21:36 
GeneralRe: Share names Pin
kelprinc16-Jan-06 21:45
kelprinc16-Jan-06 21:45 
GeneralRe: Share names Pin
_AnsHUMAN_ 16-Jan-06 21:50
_AnsHUMAN_ 16-Jan-06 21:50 
QuestionRe: Share names Pin
kelprinc16-Jan-06 22:10
kelprinc16-Jan-06 22:10 
AnswerRe: Share names Pin
vallikumar16-Jan-06 22:23
vallikumar16-Jan-06 22:23 
QuestionRe: Share names Pin
kelprinc16-Jan-06 22:28
kelprinc16-Jan-06 22:28 
AnswerRe: Share names Pin
_AnsHUMAN_ 16-Jan-06 22:29
_AnsHUMAN_ 16-Jan-06 22:29 
QuestionRe: Share names Pin
kelprinc16-Jan-06 22:34
kelprinc16-Jan-06 22:34 
AnswerRe: Share names Pin
David Crow17-Jan-06 4:28
David Crow17-Jan-06 4:28 
QuestionQuery related to Worker Threads & GUI Window? Pin
dp_7616-Jan-06 20:28
dp_7616-Jan-06 20:28 
AnswerRe: Query related to Worker Threads & GUI Window? Pin
Roger Stoltz16-Jan-06 21:37
Roger Stoltz16-Jan-06 21:37 
Answer[Message Deleted] Pin
Stephen Hewitt16-Jan-06 21:47
Stephen Hewitt16-Jan-06 21:47 
AnswerRe: Query related to Worker Threads & GUI Window? Pin
Stephen Hewitt16-Jan-06 21:47
Stephen Hewitt16-Jan-06 21:47 
Questionhow to convert the HTML files output to the image like bitmap or jpg Pin
Hemant kulkarni16-Jan-06 20:26
Hemant kulkarni16-Jan-06 20:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.