cerrar ejectutable solamente con salir
Posted:
Wed Sep 20, 2023 6:11 pm
by postinelli
Estimados
tengo el siguiente tema, que tal vez sea una pavada, pero no he logrado solucionarlo
en mi programada defino
DEFINE WINDOW oWnd NOSYSMENU TITLE "Sistema Generico " MENU BuildMenu()
>>>
>>>
ACTIVATE WINDOW oWnd MAXIMIZED VALID MsgYesNo("Seguro de Salir del Sistema ?", "Sistema Generico")
con esto logro que no aparezca ni el minimizar, ni maximizar ni la cruz para cerrar
ahora bien, en el menu tengo el boton Salir que busco que sea la unica forma de cerrar el programa
pero si en la barra de tareas de windows le doy boton derecho del mouse, aparece cerrar ventana y asi sin mas me la cierra
hay alguna forma de evitarlo? y que si o si salgan por el boton salir ??
gracias de antemano
Re: cerrar ejectutable solamente con salir
Posted:
Thu Sep 21, 2023 8:44 am
by paquitohm
Hola,
"pero si en la barra de tareas de windows le doy boton derecho del mouse, aparece cerrar ventana y asi sin mas me la cierra"
Me parece a mi que eso funciona como el administrador de tareas que permite finalizar tarea y no pasa por el bucle de eventos de la aplicacion y cierra sin contemplaciones
Salu2
Re: cerrar ejectutable solamente con salir
Posted:
Thu Sep 21, 2023 12:49 pm
by postinelli
paquitohm wrote:Hola,
"pero si en la barra de tareas de windows le doy boton derecho del mouse, aparece cerrar ventana y asi sin mas me la cierra"
Me parece a mi que eso funciona como el administrador de tareas que permite finalizar tarea y no pasa por el bucle de eventos de la aplicacion y cierra sin contemplaciones
Salu2
Exactamente, se cierra sin mas
estoy buscando que no sea asi
Re: cerrar ejectutable solamente con salir
Posted:
Thu Sep 21, 2023 12:53 pm
by postinelli
estimada Karina
si bien hago algo similar en mi boton salir, esto NO evita que se pueda cerrar el ejecutable desde la barra de tareas con cerrar ventana
y ahi no hace el proceso de cierre SIERRA_TODO()
karinha wrote:- Code: Select all Expand view
// C:\FWH..\SAMPLES\TUTOR09.PRG#Include "FiveWin.ch"STATIC oWnd
FUNCTION Main
() LOCAL obar, oBmp, oIco
DEFINE ICON oIco FILE
"..\icons\fax.ico" // DEFINE WINDOW oWnd NOSYSMENU TITLE "Sistema Generico " ; DEFINE WINDOW oWnd
FROM 1,
1 TO 22,
75 TITLE "Sistema Generico " ;
MENU BuildMenu
() ICON oIco NOSYSMENU
// NOZOOM NOMINIMIZE BORDER NONE NOICONIZE DEFINE BUTTONBAR oBar _3D
SIZE 40,
40 OF oWnd
2015 oBar:
bRClicked :=
{ ||
( NIL ) } // Mouse Direito oBar:
bLClicked :=
{ ||
( NIL ) } // Mouse Esquerdo oBar:
nClrText := CLR_BLACK
oBar:
Adjust() DEFINE BUTTON OF oBar FILENAME
"..\bitmaps\16x16\new.bmp" FLAT ;
ACTION MsgInfo( "New" ) ;
TOOLTIP
"Creates a new document" PROMPT "New" GROUP
DEFINE BUTTON OF oBar FILENAME
"..\bitmaps\16x16\open.bmp" FLAT ;
ACTION MsgInfo( cGetFile
( "*.*",
"Select a document to open" ) ) ;
TOOLTIP
"Opens a document" WHEN .f.
PROMPT "Open" GROUP
DEFINE BUTTON OF oBar FILENAME
"..\bitmaps\16x16\floppy.bmp" FLAT ;
ACTION MsgInfo( Time
() ) TOOLTIP
"Saves this document" PROMPT "Doc" GROUP
DEFINE BUTTON OF oBar FILENAME
"..\bitmaps\16x16\printer.bmp" FLAT ;
ACTION MsgInfo( "Prints this document" ) TOOLTIP
"Print this document" ;
GROUP
PROMPT "Print" DEFINE BUTTON OF oBar FILENAME
"..\bitmaps\16x16\prop.bmp" FLAT ;
ACTION PrinterSetup
() TOOLTIP
"Setup the printer" PROMPT "Prop" GROUP
DEFINE BUTTON OF oBar FILENAME
"..\bitmaps\16x16\HelpInd.bmp" FLAT ;
ACTION MsgInfo( Version
() ) TOOLTIP
"A multiple lines" + ;
Chr
( 13 ) + Chr
( 10 ) +
"tooltip!" GROUP
PROMPT "Help" DEFINE BUTTON OF oBar FILENAME
"..\bitmaps\16x16\Help.bmp" FLAT ;
ACTION MsgInfo( "fivewin power!" ) TOOLTIP
"fivewin power!" ;
PROMPT "Power" GROUP
DEFINE BUTTON OF oBar FILENAME
"..\bitmaps\16x16\Exit.bmp" FLAT ;
ACTION( oWnd:
End(), SIERRA_TODO
() ) TOOLTIP
"Exit this app" GROUP ;
PROMPT "Exit" SET
MESSAGE OF oWnd
TO "© kapiabafwh@gmail.com" NOINSET CLOCK DATE KEYBOARD
COLOR CLR_HBLUE, CLR_WHITE
2015 DEFINE BITMAP oBmp FILENAME
"..\bitmaps\visual.bmp" oWnd:
bPainted =
{ | hDC | BmpTiled
( hDC, oWnd, oBmp
) } ACTIVATE WINDOW oWnd
MAXIMIZEDRETURN NILFUNCTION BuildMenu
() local oMenu
MENU oMenu
MENUITEM "Information" MENU MENUITEM "&About..." ;
ACTION MsgInfo( FWDESCRIPTION
) ;
FILENAME
"..\bitmaps\16x16\info.bmp" SEPARATOR MENUITEM "&End..." ;
ACTION( oWnd:
End(), SIERRA_TODO
() ) ;
FILENAME
"..\bitmaps\16x16\exit.bmp" ENDMENU MENUITEM "&Clients" MENU MENUITEM "&New..." ;
ACTION ( MsgStop
( "New Clients" ),;
oWnd:
Say( 5,
5,
"New Clients...",
"GR+/G" ) ) ;
FILENAME
"..\bitmaps\16x16\faces.bmp" MENUITEM "&Modify..." ACTION MsgInfo( "Modif. Clients" ) ;
FILENAME
"..\bitmaps\edit.bmp" MENUITEM "&Delete..." ACTION MsgAlert
( "Del Clients" ) ;
FILENAME
"..\bitmaps\16x16\delete.bmp" SEPARATOR MENUITEM "&Browse..." ACTION MsgInfo( "Browse Clients" ) ;
FILENAME
"..\bitmaps\16x16\browse.bmp" ENDMENU MENUITEM "&Utilities" MENU MENUITEM "&Calculator..." ACTION WinExec
( "Calc" ) ;
FILENAME
"..\bitmaps\16x16\calc.bmp" MENUITEM "&Internet..." ;
ACTION WinExec
( "start iexplore http://www.fivetech.com",
0 ) ;
FILENAME
"..\bitmaps\16x16\explorer.bmp" ENDMENU ENDMENURETURN( oMenu
)FUNCTION SIERRA_TODO
() IF FILE
( "TUTOR09.LOG" ) DELETEFILE
( "TUTOR09.LOG" ) ENDIF DbCommitAll
() DbUnLockAll
() DbCloseAll
() FreeResources
() Release All
SysRefresh
() HB_GCALL
( .T.
) CLEAR MEMORY
PostQuitMessage
( 0 ) QUIT
RETURN NILSTATIC FUNCTION BmpTiled
( hDC, oWnd, oBmp
) local nWidth := oWnd:
nWidth(), nHeight := oWnd:
nHeight() local nRow :=
0, nCol :=
0, n
local nBmpWidth := oBmp:
nWidth(), nBmpHeight := oBmp:
nHeight() if oBmp:
hBitmap ==
0 return nil endif while nRow < nHeight
nCol =
0 while nCol < nWidth
PalBmpDraw
( hDC, nRow, nCol, oBmp:
hBitmap ) nCol += nBmpWidth
end
nRow += nBmpHeight
end
RETURN NIL// FIN / END - kapiabafwh@gmail.com
Regards, saludos.
Re: cerrar ejectutable solamente con salir
Posted:
Fri Sep 22, 2023 11:31 am
by postinelli
nageswaragunupudi wrote:- Code: Select all Expand view
#include "fivewin.ch"
function Main()
local oWnd, oBar
local lExit := .f.
DEFINE WINDOW oWnd
DEFINE BUTTONBAR oBar OF oWnd SIZE 60,40
DEFINE BUTTON PROMPT "Exit" OF oBar ACTION ( lExit := .t., oWnd:End() )
ACTIVATE WINDOW oWnd CENTERED VALID lExit
return nil
Funcionó prefecto, muchas gracias