FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour HOW TO DIM "CLOSE BUTTON"
Posts: 12
Joined: Thu Nov 17, 2005 02:53 AM
HOW TO DIM "CLOSE BUTTON"
Posted: Thu Nov 26, 2009 03:44 AM

hi, everybody

I want to know how to control the dialog box with activate "minimized botton", disactivate "maximize button" & "close button".

In fw16, it can control via uncheck "system menu" & check "minimized button" in borload resource

In fwh, all three buttons disappear, if i check system menu, "close button" will appear but being actvivated, how to dim this button

Thanks a lot

Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Re: HOW TO DIM "CLOSE BUTTON"
Posted: Thu Nov 26, 2009 06:57 AM
kkyung,

Code (fw): Select all Collapse
nStyle :=nOR( DS_MODALFRAME, WS_POPUP, WS_CAPTION ) // Removes the ? and x on the dialogue title
DEFINE DIALOG oDlg FROM 10,20 to 27,90 TITLE "Login"style nStyle


Regards
Anser
Posts: 12
Joined: Thu Nov 17, 2005 02:53 AM
Re: HOW TO DIM "CLOSE BUTTON"
Posted: Thu Nov 26, 2009 07:33 AM

I have tried this before but it remove all "minimize, maximize, close button"

my purpose is to DIM "close button" instead of REMOVE "close button"

Posts: 782
Joined: Wed Dec 19, 2007 07:50 AM
Re: HOW TO DIM "CLOSE BUTTON"
Posted: Thu Nov 26, 2009 08:23 PM
Hi kkyung:
kkyung wrote:my purpose is to DIM "close button" instead of REMOVE "close button"

Here you are a working sample:
Code (fw): Select all Collapse
#include "FiveWin.ch"

Function Test()

   Local oDlg, ;
         lExit := .F.

   Define Dialog oDlg Title "Test"

   @ 30, 10 Button "Exit" Of oDlg Size 30, 15 Pixel Action ( lExit := .T., oDlg:End() )

   ACTIVATE Dialog oDlg Centered On Init NoCloseDlg( oDlg:hWnd ) ;
            Valid lExit

Return Nil

#pragma BEGINDUMP

#include "windows.h"
#include "hbapi.h"

HB_FUNC ( NOCLOSEDLG ) // ( hWnd )

{
   HMENU hMenu = GetSystemMenu( ( HWND ) hb_parnl( 1 ), FALSE ) ;
   EnableMenuItem( hMenu, SC_CLOSE, MF_GRAYED ) ;
}

#pragma ENDDUMP

Best regards.
manuelmercado at prodigy dot net dot mx
Posts: 654
Joined: Fri Oct 21, 2005 05:54 AM
Re: HOW TO DIM "CLOSE BUTTON"
Posted: Fri Nov 27, 2009 04:44 AM
This is another working sample. The difference between the above code and the following code is that, You can enable or disable the X Button and
when lDisable := .T., the Menu item is completely removed from the menu list instead of showing it disabled.

Code (fw): Select all Collapse
#include "FiveWin.ch"

#define MF_BYPOSITION 1024 // 0x0400
#define MF_DISABLED     2

Function Test()

   Local oDlg, ;
         lExit := .F.,;
         oIcon

   Define ICON oIcon FILE "C:\FWH\ICONS\FiveWin.Ico"

   Define Dialog oDlg Title "Test" ICON oIcon

   @ 30, 10 Button "Exit" Of oDlg Size 30, 15 Pixel Action ( lExit := .T., oDlg:End() )

   ACTIVATE Dialog oDlg Centered On Init DisableX( oDlg, .T.) ;
            Valid lExit

Return Nil

************

FUNCTION DisableX(oWin, lDisable)

LOCAL hMenu  := 0
LOCAL nCount := 0

DEFAULT lDisable := .T.

IF lDisable
   hMenu  = GetSystemMenu(oWin:hWnd, .F.)
   nCount = GetMItemCount(hMenu)
   IF oWin:ClassName() = "TDIALOG"
      RemoveMenu(hMenu, 1, nOR( MF_BYPOSITION, MF_DISABLED) )
   ELSE
      RemoveMenu(hMenu, nCount - 1, nOR( MF_BYPOSITION, MF_DISABLED) )
      RemoveMenu(hMenu, nCount - 2, nOR( MF_BYPOSITION, MF_DISABLED) )
   ENDIF
ELSE
   GetSystemMenu( oWin:hWnd, .T. )
ENDIF

RETURN nil


You can even try this.

- Ramesh Babu P
Posts: 12
Joined: Thu Nov 17, 2005 02:53 AM
MMERCADE/ RAMESHBABU Re: HOW TO DIM "CLOSE BUTTON"
Posted: Sun Nov 29, 2009 02:38 PM

Thank for all your warm help!

nmercade,
I have tried your suggestion but error occur during compile, I don't know how to apply your 'NOCLOSEDLG" function

NoCloseDlg( oDlg:hWnd )

pragma BEGINDUMP

include "windows.h"

include "hbapi.h"

HB_FUNC ( NOCLOSEDLG ) // ( hWnd )

{
HMENU hMenu = GetSystemMenu( ( HWND ) hb_parnl( 1 ), FALSE ) ;
EnableMenuItem( hMenu, SC_CLOSE, MF_GRAYED ) ;
}

pragma ENDD


Above is it a function or modify the existing FWH classes, what is the parameters of SC_CLOSE

RAMESHBABU,

I have tried your function but it make disappear "close button" on dialog menu bar, can i change it to appear in dialog menu bar but only DIM it , or by using above
enablemenuitm function

Posts: 654
Joined: Fri Oct 21, 2005 05:54 AM
Re: HOW TO DIM "CLOSE BUTTON"
Posted: Mon Nov 30, 2009 07:56 AM
Hi,

>>I have tried your suggestion but error occur during compile

You have to include the "#define SC_CLOSE 0xF060" statement
the top of the test prg. That's all

>> I don't know how to apply your 'NOCLOSEDLG" function
Just see the following code. It is called on INIT Clause of the ACTIVATE DIALOG

This is working sample of Mr.Manuel Mercado example.

Code (fw): Select all Collapse
#include "FiveWin.ch"

#define SC_CLOSE   0xF060

Function Test()

   Local oDlg, ;
         lExit := .F.,;
         oIcon

   Define ICON oIcon FILE "C:\FWH\ICONS\FiveWin.Ico"

   Define Dialog oDlg Title "Test" ICON oIcon

   @ 30, 10 Button "Exit" Of oDlg Size 30, 15 Pixel Action ( lExit := .T., oDlg:End() )

   ACTIVATE Dialog oDlg Centered On Init NoCloseDlg( oDlg:hWnd ) ;
            Valid lExit

Return Nil

************

#pragma BEGINDUMP

#include "windows.h"
#include "hbapi.h"

HB_FUNC ( NOCLOSEDLG ) // ( hWnd )

{
   HMENU hMenu = GetSystemMenu( ( HWND ) hb_parnl( 1 ), FALSE ) ;
   EnableMenuItem( hMenu, SC_CLOSE, MF_GRAYED ) ;
}

#pragma ENDDUMP
Posts: 12
Joined: Thu Nov 17, 2005 02:53 AM
Re: HOW TO DIM "CLOSE BUTTON"
Posted: Mon Nov 30, 2009 09:10 AM

RAMESHBABU,

I have tried and successful,

thanks a lot

Best Regards
kkyung

Continue the discussion