新手提问.

 所属目录:Java   |   类型:技术问答   |   时间:2007-05-21
 问题:

请问各位前辈,怎样才能在statusbar中显示程序执行进度?就像ie中那样         谢谢

· 网友精彩回答:

发表者:sdrcxzy

还要有一个progressbar  
  用api函数setparent把它放进statusbar里面。  
   
  需要一个form\timer\commandbutton\progressbar\statusbar  
   
  option   explicit  
   
   
  private   declare   function   setparent   lib   "user32"   (byval   hwndchild   as   long,   byval   hwndnewparent   as   long)   as   long  
  private   declare   function   sendmessage   lib   "user32"   alias   "sendmessagea"   (byval   hwnd   as   long,   byval   wmsg   as   long,   byval   wparam   as   long,   lparam   as   any)   as   long  
  private   const   wm_user   =   &h400  
  private   const   sb_getrect   =   (wm_user   +   10)  
  private   type   rect  
          left   as   long  
            as   long  
          right   as   long  
          bottom   as   long  
  end   type  
   
  private   sub   command1_click()  
   
          showprogressinstatusbar   true  
          timer1.enabled   =   true  
   
   
  end   sub  
  private   sub   showprogressinstatusbar(byval   bshowprogressbar   as   boolean)  
   
          dim   trc   as   rect  
   
          if   bshowprogressbar   then  
   
                  sendmessage   statusbar1.hwnd,   sb_getrect,   1,   trc  
                  with   trc  
                          .   =   (.   *   screen.twipsperpixely)   -   5  
                          .left   =   (.left   *   screen.twipsperpixelx)  
                          .bottom   =   (.bottom   *   screen.twipsperpixely)   -   .   -   10  
                          .right   =   (.right   *   screen.twipsperpixelx)   -   .left  
                  end   with  
   
                  with   progressbar1  
                          setparent   .hwnd,   statusbar1.hwnd  
                          .move   trc.left,   trc.,   trc.right,   trc.bottom  
                          .visible   =   true  
                          .value   =   1  
                  end   with  
   
          else  
                  setparent   progressbar1.hwnd,   me.hwnd  
                  progressbar1.visible   =   false  
          end   if  
   
  end   sub  
   
  private   sub   form_load()  
   
          with   timer1  
                  .enabled   =   false  
                  .interval   =   10  
          end   with  
   
  end   sub  
   
  private   sub   timer1_timer()  
   
          if   progressbar1.value   =   100   then  
                  timer1.enabled   =   false  
                  showprogressinstatusbar   false  
          else  
                  progressbar1.value   =   progressbar1.value   +   1  
          end   if  
  end   sub  
   
 

.
处理 SSI 文件时出错
© 2006-2008 All Rights Reserved