原来的? GetCaption(),我这里改用Label显示,以免窗口一闪即逝。现在可以看到标题文字的变化过程。功能跟原来是完全一样的。
授人以渔,不授人以鱼。
myForm1 = CREATEOBJECT("myForm") WITH myForm1 .Top = 50 .Left = 50 .Show WAIT WINDOW .SetCaption("") .Label1.Caption = "标题已置空" ENDWITH READ EVENTS RETURN DEFINE CLASS myForm AS Form PROTECTED Caption Caption = "被保护的窗口标题" ADD OBJECT Label1 AS Label WITH Caption = "", Top = 10, Left = 10, AutoSize = .T. FUNCTION GetCaption() AS Character RETURN This.Caption ENDFUNC PROCEDURE SetCaption(tcCaption AS Character) This.Caption = tcCaption ENDPROC PROCEDURE Destroy CLEAR EVENTS ENDPROC ENDDEFINE