Hola a todos,
Quisiera saber si se puede hacer que el botón cerrar ventana, aparezca inhabilitado.
Un saludo.
Javier.
// Our first DialogBox sample
#include "FiveWin.ch"
function Main()
local oDlg, oIco, cTest := "Hello world! "
DEFINE ICON oIco FILE "..\icons\fivewin.ico"
DEFINE DIALOG oDlg TITLE "I am a DialogBox" COLOR "W+/B" ;
ICON oIco
oDlg:lHelpIcon := .F.
@ 1, 3 GET cTest
@ 3, 5 BUTTON "&Ok" SIZE 40, 12 ;
ACTION MsgInfo( "Any action here!" ) DEFAULT
@ 3, 16 BUTTON "&Cancel" SIZE 40, 12 ACTION oDlg:End()
ACTIVATE DIALOG oDlg CENTERED ;
ON INIT DisableB( oDlg ) ;
VALID MsgYesNo( "Do you want to end ?" )
return nil
procedure AppSys // XBase++ requirement
return
#define MF_BYPOSITION 1024 // 0x0400
#define MF_DISABLED 0x00000002L
#define MF_REMOVE 0x00001000L
*****************
function DisableB( oWnd )
*****************
return RemoveMenu( GetSystemMenu( oWnd:hWnd, .f. ), 1, MF_BYPOSITION )
DEFINE WINDOW oWnd
ACTIVATE WINDOW oWnd ON INIT disable( oWnd )
STATIC function disabled( oWnd )
return RemoveMenu( GetSystemMenu( oWnd:hWnd, .f. ), 1, 1024 )
Hola Javier:jfafive wrote:Ademas, no trabajo con dialogos, sino con una ventana principal.
#include "FiveWin.ch"
#define MF_BYPOSITION 0x0400L
#define MF_BYCOMMAND 0x0000L
#define MF_GRAYED 0x0001L
#define SC_CLOSE 0xF060L
Function Main()
Local oWnd
DEFINE WINDOW oWnd TITLE "I am a Window" NOMINIMIZE NOZOOM
NoCloseButton( oWnd )
@ 43, 16 BUTTON "&Salir" SIZE 80, 24 PIXEL ACTION oWnd:End()
ACTIVATE WINDOW oWnd ;
VALID MsgYesNo( "Salir" )
Return Nil
Static Function NoCloseButton( oWnd )
// puedes usar cualquiera de estas 2 opciones
EnableMenuItem( GetSystemMenu( oWnd:hWnd, .F. ), SC_CLOSE, nOr( MF_BYCOMMAND, MF_GRAYED ) )
//ModifyMenu( GetSystemMenu( oWnd:hWnd, .F. ), SC_CLOSE, nOr( MF_BYCOMMAND, MF_GRAYED), -10, "Close")
DrawMenuBar( oWnd:hWnd ) // actualiza el menu
Return Nil
@ 3, 16 BUTTON "&Cancel" SIZE 40, 12 ACTION oDlg:End();
WHEN(Tu condición) // O si no pone directamente WHEN(.f.)
┌────────────────────────────────────────────────────────────────────────────┐
│ FiveWin for Harbour 8.04 - Apr. 2008 Harbour development power │▄
│ (c) FiveTech, 1993-2008 for Microsoft Windows 95/98/NT/2000/ME/XP/Vista │█
└────────────────────────────────────────────────────────────────────────────┘█
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
Compiling...
Harbour devel build 1.1-1 Intl.
Copyright (c) 1999-2007, http://www.harbour-project.org/
Compiling 'prueba.prg' and generating preprocessed output to 'prueba.ppo'...
1 error
No code generated
prueba.prg(26) Error E0030 Syntax error: "syntax error at 'L'"
Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
prueba.c:
Borland Resource Compiler Version 5.40
Copyright (c) 1990, 1999 Inprise Corporation. All rights reserved.
Turbo Incremental Link 5.00 Copyright (c) 1997, 2000 Borland
* Application successfully built
EnableMenuItem( GetSystemMenu( oWnd:hWnd, .F. ),;
SC_CLOSE, nOr( MF_BYCOMMAND, MF_GRAYED ) )
Return to FiveWin para Harbour/xHarbour
Users browsing this forum: No registered users and 60 guests