有时会碰到无法访问某磁盘。程序退出后,再做,又可以了
我现在做的程序相当庞大。最近,碰到一个很劳心的问题。在WIN2008(64位)环境,VFP9 SP2(梅)中,程序运行过程,有时会碰到无法访问某磁盘。程序退出后,再做,又可以了。原因不明呵。我怀疑是内存溢出造成的,我有近100个按钮功能,按登录的用户出现,不用的按钮不展现。有没有办法在SCX中对此用户的没用的按钮自动释放空间。
** test.prg * do form of = CREATEOBJECT("_Form") of.Show(1) CLEAR ALL RETURN DEFINE CLASS MyCommand as CommandButton Width = 80 Height = 25 Visible = .T. PROCEDURE Init(nTop, nLeft) this.Top = nTop this.Left = nLeft ENDPROC PROCEDURE Click MESSAGEBOX("点击按钮"+this.Caption) ENDPROC ENDDEFINE ** end test.prg ** 表单 DEFINE CLASS _Form AS Form AutoCenter = .T. ADD OBJECT Command1 as CommandButton WITH Top=10,Left=10,Height=22,Caption="创建按钮" ADD OBJECT Command2 as CommandButton WITH Top=10,Left=120,Height=22,Caption="释放按钮" PROCEDURE Command1.Click IF (VARTYPE(thisform.Cmd1) != "O") thisform.AddObject("Cmd1", "MyCommand", 50, 10) ENDIF IF VARTYPE(thisform.Cmd2) != "O" thisform.AddObject("Cmd2", "MyCommand", 80, 10) ENDIF ENDPROC PROCEDURE Command2.Click IF VARTYPE(thisform.Cmd1) == "O" thisform.RemoveObject("Cmd1") ENDIF IF VARTYPE(thisform.Cmd2) == "O" thisform.RemoveObject("Cmd2") ENDIF ENDPROC ENDDEFINE ** end 表单