Alaska Software Inc. - Disabling the X close windows button
Username: Password:
AuthorTopic: Disabling the X close windows button
Juan GonzalezDisabling the X close windows button
on Sun, 24 Oct 2021 22:15:37 +0200
Hello,

I have an old clipper app migrated to Xbase 1.90.331, all working in character 
mode.

I want to know if there is a simple method to disable (or hide) the "X" button 
(close windows). The problem is that sometimes users close the application this 
way, and files could be left open or not commited.

I have searched the forum and found this code, but I don´t understand it and 
could not put it to work:

oCrt := XbpCrt() :new( oStatic,, {    0, 0 }, 43, 126 )
 *not allow to close "X"
   oCrt:close     := { | mp1, mp2, obj | NIL }
   oCrt:create()

Thank you very much.
Juan.
Juan GonzalezRe: Disabling the X close windows button
on Mon, 25 Oct 2021 17:03:24 +0200
Nevermind, finally I got it working with the following recipe:

#include "dll.ch"

hHndl  := DllCall( "USER32.DLL", DLL_STDCALL, "GetForegroundWindow"  )
hMenu  := DllCall( "USER32.DLL", DLL_STDCALL, "GetSystemMenu", hHndl, 0  )
DllCall( "USER32.DLL", DLL_STDCALL, "RemoveMenu", hMenu, 6, 1024 )
DllCall( "USER32.DLL", DLL_STDCALL, "DrawMenuBar", hHndl )


Juan Gonzalez wrote in message news:68e55f2e$311c960a$4a440@news.alaska-
software.com...
>Hello,
>
>I have an old clipper app migrated to Xbase 1.90.331, all working in character 
>mode.
>
>I want to know if there is a simple method to disable (or hide) the "X" button 
>(close windows). The problem is that sometimes users close the application 
this 
>way, and files could be left open or not commited.
>
>I have searched the forum and found this code, but I don´t understand it and 
>could not put it to work:
>
>oCrt := XbpCrt() :new( oStatic,, {    0, 0 }, 43, 126 )
> *not allow to close "X"
>   oCrt:close     := { | mp1, mp2, obj | NIL }
>   oCrt:create()
>
>Thank you very much.
>Juan.