-
April 23rd, 2009, 06:24 AM
#1
Parent Application Freezing
I'm creating a C++ Plugin for FileMaker and I'm using the Chilkat FTP Library.
I am showing a progress dialog in a new thread and performing the FTP Download asynchronously but the application still freezes and shows as not responding, but with my progress dialog showing the download is actually working.
I have seen all of the discusions about using while ( PeekMessage ( &msg, NULL, 0, 0, PM_REMOVE ) etc, but that doesn't seem to help.
If anyone has any suggestions I would be very grateful.
Here is my code:
Code:
success = ftp.AsyncGetFileStart(sRemote,sLocal2);
if (success != true) {
//Error
return err;
}
if (bProgress)
{
hThread = CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)ThreadFTPProgress,NULL,0,(LPDWORD)&iID);
}
while (ftp.get_AsyncFinished() != true)
{
if (bProgress)
{
int iPercent = int( 100.0 * ftp.get_AsyncBytesReceived() / fileSize);
if ((iPercent > 0) && (iPercent < 101))
{
SendMessage(pgHWNDFTP, (UINT)PBM_SETPOS, (WPARAM)iPercent,0);
}
}
DoEvents();
ftp.SleepMs(500);
}
if (bProgress)
{
EndDialog(pbHWNDFTP,0);
}
if (ftp.get_AsyncSuccess() == true) {
//Download Successful
}
}
ftp.Disconnect();
long WINAPI ThreadFTPProgress(long lparam)
{
DialogBox((HINSTANCE)(gFMX_ExternCallPtr->instanceID),MAKEINTRESOURCE(DLG_PROGRESS),FMWnd,FTPProgressDialogProc);
return 0;
}
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|