HOW TO DIM "CLOSE BUTTON"

HOW TO DIM "CLOSE BUTTON"

Postby kkyung » Thu Nov 26, 2009 3: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
kkyung
 
Posts: 12
Joined: Thu Nov 17, 2005 2:53 am

Re: HOW TO DIM "CLOSE BUTTON"

Postby anserkk » Thu Nov 26, 2009 6:57 am

kkyung,

Code: Select all  Expand view
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
User avatar
anserkk
 
Posts: 1332
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: HOW TO DIM "CLOSE BUTTON"

Postby kkyung » Thu Nov 26, 2009 7: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"
kkyung
 
Posts: 12
Joined: Thu Nov 17, 2005 2:53 am

Re: HOW TO DIM "CLOSE BUTTON"

Postby mmercado » Thu Nov 26, 2009 8: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: Select all  Expand view
#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
User avatar
mmercado
 
Posts: 782
Joined: Wed Dec 19, 2007 7:50 am
Location: Salamanca, Gto., México

Re: HOW TO DIM "CLOSE BUTTON"

Postby RAMESHBABU » Fri Nov 27, 2009 4: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: Select all  Expand view


#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
User avatar
RAMESHBABU
 
Posts: 624
Joined: Fri Oct 21, 2005 5:54 am
Location: Secunderabad (T.S), India

MMERCADE/ RAMESHBABU Re: HOW TO DIM "CLOSE BUTTON"

Postby kkyung » Sun Nov 29, 2009 2: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
kkyung
 
Posts: 12
Joined: Thu Nov 17, 2005 2:53 am

Re: HOW TO DIM "CLOSE BUTTON"

Postby RAMESHBABU » Mon Nov 30, 2009 7: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: Select all  Expand view

#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
 
User avatar
RAMESHBABU
 
Posts: 624
Joined: Fri Oct 21, 2005 5:54 am
Location: Secunderabad (T.S), India

Re: HOW TO DIM "CLOSE BUTTON"

Postby kkyung » Mon Nov 30, 2009 9:10 am

RAMESHBABU,

I have tried and successful,

thanks a lot

Best Regards
kkyung
kkyung
 
Posts: 12
Joined: Thu Nov 17, 2005 2:53 am


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 82 guests