Parent Application Freezing
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Parent Application Freezing

  1. #1
    Join Date
    Jan 2008
    Posts
    2

    Lightbulb 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;
    }

  2. #2
    Join Date
    Apr 2009
    Location
    Cochin
    Posts
    83

    Lightbulb Re: Parent Application Freezing

    Did you tried to debug the application with a breakpoint?

    if no, then first debug your program by putting a breakpoint in the suspected area, and step through the code line by line.

    If yes, then what you've got result? In which line/part of the code does it get crashing... what are the values of different variables at that time? did you tried by adding watch to those variables and notice the values of variables at different times?

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
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center