我在做一个FTP管理端的时候程序启动时最小化到任务栏,当点击任务栏图标时弹出式菜单半天才有反应,原因是上传一个比较大的文件(可能会有100M),我也在程序里用了消息处理的方法却不行,请高手指点。代码如下。Procedure TUpLoadFrm.DoUploadDir(sDirName, sToDirName: String);
var
   hFindFile:Cardinal;
   t,tfile,DirPath:String;
   sCurDir:String[255];
   FindFileData:WIN32_FIND_DATA;
   StrValue:String;
   Info_temp :array[0..400] of char;
begin
    UploadInfoFrm.memo1.Lines.Append('进入上传函数 doUpLoadDir:');
    DirPath:='';
    sCurDir:=GetCurrentDir;
    ChDir(sDirName);
    hFindFile:=FindFirstFile('*.*',FindFileData);
   if hFindFile<>INVALID_HANDLE_VALUE then
     begin
       if not EnterDirectories(sToDirName) then
           begin
            if  sToDirName<>'' then
              CreateDirectories(sToDirName);
            end;
        repeat
             Application.ProcessMessages;*********此处在处理消息
              tfile:=FindFileData.cFileName;
              if (tfile='.') or (tfile='..') then //假如是顶级目录中断找下一个。
                  Continue;
              if ((FindFileData.dwFileAttributes and FILE_ATTRIBUTE_DIRECTORY) =FILE_ATTRIBUTE_DIRECTORY) then //是否是文件目录
               begin
                   t:=sToDirName+'/'+tfile; //给出其路径进入文件遍历的递归。
                   if sDirName[Length(sDirName)]<>'\' then
                      DoUploadDir(sDirName+'\'+tfile,t)
                   else
                      DoUploadDir(sDirName+tfile,sToDirName+tfile);
               end
               else
               begin
                   if sDirName[length(sDirName)]<>'\' then
                     t:=sDirName+'\'+tFile   //取文件的路径 开始出栈。
                   else
                     t:=sDirName+tFile;
                   try
                      if fileExists(t+'.TMP.~!#') thenUploadInfoFrm.memo1.Lines.Append('正在上传文件--->'+DirPath+'/'+tFile);
                      NetStatusTimer.Enabled:=TRUE;
                      CheckNetStatus:=FALSE;
                      idftp1.Put(t,sToDirName+'/'+tFile);
                      UploadInfoFrm.memo1.Lines.Append('CheckNetStatus='+boolToStr(CheckNetStatus));
                      UploadInfoFrm.memo1.Lines.Append('正在记录当前所传的文件记录--->UpLoadStatus.ini');
                      CurrStausInI.WriteString(GloablFileName,'上传文件',t);
                      DirPath:=copy(sToDirName,dirLen+2,length(StoDirName)-DirLen);
                      StrValue:='';
                      if Length(DirPath)>0 then
                        Strvalue:=DirPath+'/'+tFile+':'+inttostr((FindFileData.nFileSizeHigh * MAXDWORD)+FindFileData.nFileSizeLow)+':'+intToStr(fileAge(t))+':0'+#13+#10 //回车换行
                      else
                        Strvalue:=tFile+':'+inttostr((FindFileData.nFileSizeHigh * MAXDWORD)+ FindFileData.nFileSizeLow)+':'+intToStr(fileAge(t))+':0'+#13+#10;
                      if inttostr((FindFileData.nFileSizeHigh * MAXDWORD)+FindFileData.nFileSizeLow)<>'0'then
                      begin
                        UploadInfoFrm.memo1.Lines.Append('正在写文件记录--->'+tFile);
                        StrlCopy(info_temp,Pchar(StrValue),400);
                        TempFile.Write(info_temp,Length(Strvalue));  //写TXT文件
                        UploadInfoFrm.memo1.Lines.Append('写文件记录 结束');
                      end;
                  except
                      CheckNetStatus:=TRUE;
                      UploadInfoFrm.memo1.Lines.Append('上传文件: '+DirPath+'/'+tFile+'  异常');
                     // ShowMessage(t+'         zzzz '+sToDirName+'/'+tFile);
                     // ShowMessage('DoUploadDir');
                   end;
               end;
        until FindNextFile(hFindFile,FindFileData)=false;
   end
   else
   begin
        ChDir(sCurDir);
        exit;
   end;
   //回到原来的目录下
   ChDir(sCurDir);
end;