Subject Re: closing form with windows
From Mervyn Bick <invalid@invalid.invalid>
Date Sat, 23 Jan 2021 10:15:25 +0200
Newsgroups dbase.getting-started
Attachment(s) no_sys_close.wfm

On 2021/01/23 07:32, Cornelius wrote:
> Good morning.
> I would like to no hoe to prevent the closing of a active form with the windows red X on the top right hand side of the form.

There is code in miscapi.prg in the dUFLP which will do this for you.  A
little example is attached.  There is, however, a bug in dBASE which
prevents this from working if any of the Office application themes other
than Office1 and Office2 is selected.

Near the bottom of the article Killer Win32 API by Keith Chuvala in the
Advanced Topics of the knowledgebase you will find code by Gary White
which will allow you to toggle the red X button from within your form if

** END HEADER -- do not remove this line
// Generated on 2021-01-23
parameter bModal
local f
f = new no_sys_closeForm()
if (bModal)
   f.mdi = false // ensure not MDI

class no_sys_closeForm of FORM
   with (this)
      onOpen = class::FORM_ONOPEN
      height = 16.0
      left = 32.0
      top = 0.0455
      width = 40.0
      text = ""

   this.PUSHBUTTON1 = new PUSHBUTTON(this)
   with (this.PUSHBUTTON1)
      onClick = class::PUSHBUTTON1_ONCLICK
      height = 1.0909
      left = 13.2857
      top = 4.4091
      width = 15.2857
      text = "Close form"

   function PUSHBUTTON1_onClick()

   function form_onOpen()
      set procedure to :duflp:miscapi.prg