Closing a filepro application Window

Bob Rasmussen ras at anzio.com
Thu Sep 27 06:18:50 PDT 2007


On Wed, 26 Sep 2007, Don Coleman wrote:

> A while back I asked a question as to whether Windows could be configured to
> not allow a user to close said application window by clicking the "X" in the
> upper right corner.  Several contributors responded by saying they knew of
> no way to prohibit this within Windows.  Now I have two more questions:
> ... 

I don't recall the original question, but I'll address it now.

It is possible at a Windows level to disable the X box. You can even 
remove it, if you remove the minimize box and the zoom/restore box also. 
You can demonstrate this in Anzio. Go to Edit:Advanced Options:Screen. 
Uncheck "System menu, close box", and hit OK.

I don't know if filePro gives you access to the Windows API; someone else 
(Ken?) will have to answer that. If it doesn't, it might be possible to 
write a separate program that would act upon the filePro window. Here are 
the calls involved, assuming you have the window handle "H":

GetWindowLong(H, GWL_STYLE)
   returns the current style
SetWindowLong(H, new_style)
   sets the new style, where new_style is a 32-bit integer

GWL_STYLE is -16
WS_SYSMENU is hex 80000

So if you GetWindowLong, turn off bit 80000, and SetWindowLong, you'll 
remove the X box completely.

To disable only the X, do
   GetSystemMenu(H, false)
to get a handle to the system menu (call it hsys), then
   EnableMenuItem(hsys, SC_CLOSE, MF_BYCOMMAND or MF_GRAYED)
to gray it (and disable) the close box.

  SC_CLOSE = 61536;
  MF_BYCOMMAND = 0
  MF_GRAYED = 1


Regards,
....Bob Rasmussen,   President,   Rasmussen Software, Inc.

personal e-mail: ras at anzio.com
 company e-mail: rsi at anzio.com
          voice: (US) 503-624-0360 (9:00-6:00 Pacific Time)
            fax: (US) 503-624-0760
            web: http://www.anzio.com


More information about the Filepro-list mailing list