How to find out the IDs of controls and types?

Re: How to find out the IDs of controls and types?

Postby Giovany Vecchi » Thu Jan 11, 2024 8:58 pm

João, the procedure is not finished. It has classes and other functions working together. This procedure would only be to catch controls that are not declared by the FWH.
For now it's like this

Code: Select all  Expand view


DEFINE DIALOG oDlgMy Resource "MY_DLG"

ACTIVE DIALOG oDlgMy ON INIT  G_CTRLS_COLORS_API(oDlgMy)

FUNCTION G_CTRLS_COLORS_API(f_oDlgContainer)
   Local lc_aCtrlsAllFwh               := {}
   Local lc_aIDsAllFwh                 := {}
   Local lc_aCtrlsAllApi               := {}
   Local lc_aIDsSayFwh                 := {}
   Local lc_iFor                       := 0

   lc_aCtrlsAllFwh := f_oDlgContainer:aControls

   For lc_iFor := 1 To Len(lc_aCtrlsAllFwh)

      If ValType(lc_aCtrlsAllFwh[lc_iFor]) == "O"

         AAdd(lc_aIDsAllFwh,lc_aCtrlsAllFwh[lc_iFor]:nID)
         
      EndIf
   Next

   EnumChildWindows( f_oDlgContainer:hWnd,;
                     { | _hChild | AAdd( lc_aCtrlsAllApi, { GetClassName( _hChild ), GetDlgCtrlID( _hChild ), _hChild,  } ) } )

   For lc_iFor := 1 To Len(lc_aCtrlsAllApi)
      If Upper(lc_aCtrlsAllApi[lc_iFor,1]) == "STATIC"
         If hb_AScan(lc_aIDsAllFwh,lc_aCtrlsAllApi[lc_iFor,2]) == 0 ;               //Static Api > SAY Fwh not declared
            .and. lc_aCtrlsAllApi[lc_iFor,2] != 65535                               //Static borland or IDs null
            SetWindowTheme(GetDc(lc_aCtrlsAllApi[lc_iFor,3]), "", "" )
            Ctl3DLook(GetDc(lc_aCtrlsAllApi[lc_iFor,3]), .F.)
            SetTextColor(GetDc(lc_aCtrlsAllApi[lc_iFor,3]), CLR_WHITE)
            SetBkColor(GetDc(lc_aCtrlsAllApi[lc_iFor,3]), CLR_CYAN)
         EndIf
      EndIf

   next

Return Nil
 
User avatar
Giovany Vecchi
 
Posts: 223
Joined: Mon Jun 05, 2006 9:39 pm
Location: Brasil

Re: How to find out the IDs of controls and types?

Postby karinha » Sat Jan 13, 2024 1:23 pm

Giovany, sorry, but I didn't understand absolutely anything about what you wanted to do, this example had no effect on Windows 7. Honestly...

Giovany, lo siento, pero no entendí absolutamente nada de lo que querías hacer, este ejemplo no tuvo ningún efecto en Windows 7. Sinceramente...

Code: Select all  Expand view

// C:\FWH\SAMPLES\GIOVANY3.PRG

#include "FiveWin.ch"

FUNCTION Main()

   LOCAL oDlg, oFont, oFnt, aGrad, oImprimir, oSaida, aGet := ARRAY(5)
   LOCAL dDateHoy, IDCOR
   LOCAL cQuemAssina := [GIOVANNY VECCHI DE ALMEIDA JUNIOR FILHO UNICO]

   SET CENTURY ON
   SET DATE BRITISH
   SET EPOCH TO YEAR( DATE() ) - 30

   SkinButtons()

   dDateHoy := DTOC( DATE() )

   aGrad := { { 0.30, CLR_HCYAN, CLR_HCYAN },{ 0.50, CLR_HCYAN, CLR_HCYAN } }

   DEFINE FONT oFont NAME "Ms Sans Serif" SIZE 00, -14 BOLD
   DEFINE FONT oFnt  NAME "Ms Sans Serif" SIZE 00, -12 BOLD

   DEFINE DIALOG oDlg RESOURCE "FIND_CONTROL" GRADIENT aGrad

   oDlg:lHelpIcon := .F.

   For IDCor = 4001 To 4002 // Os ID's dos TEXTOS na DIALOG.
      REDEFINE SAY ID IDCor COLOR CLR_HBLUE, CLR_WHITE OF oDlg ;
         UPDATE FONT oFnt TRANSPARENT
   Next IDCor

   REDEFINE GET aGet[1] VAR dDateHoy ID 331 OF oDlg                          ;
      PICTURE "@D 99/99/9999" UPDATE COLORS CLR_BLACK, CLR_WHITE FONT oFnt

   REDEFINE GET aGet[2] VAR cQuemAssina ID 332 OF oDlg                       ;
      PICTURE "@K!" UPDATE COLORS CLR_BLACK, CLR_WHITE FONT oFnt

   REDEFINE BUTTON oImprimir ID 301  OF oDlg                                 ;
      ACTION ( NIL  )

   oImprimir:cTooltip :={ "Click no Botão Para Imprimir",                      ;
                          "Imprimir Dados da Proposta  ", 1, CLR_WHITE, CLR_HBLUE }

   REDEFINE BUTTON oSaida ID 302  OF oDlg ACTION ( oDlg:End() ) CANCEL

   oSaida:cTooltip :={ "Click no Botão Para Sair",                           ;
                       "Saida - Exit - Cancelar ", 1, CLR_WHITE, CLR_HBLUE }

   SET FONT OF oImprimir TO oFont
   SET FONT OF oSaida    TO oFont

   ACTIVATE DIALOG oDlg CENTERED ;
      ON INIT( G_CTRLS_COLORS_API( oDlg ) ) // nao entendi nada aqui.

   oFont:End()
   oFnt:End()

RETURN NIL

FUNCTION G_CTRLS_COLORS_API( f_oDlgContainer )

   LOCAL lc_aCtrlsAllFwh := {}
   LOCAL lc_aIDsAllFwh   := {}
   LOCAL lc_aCtrlsAllApi := {}
   LOCAL lc_aIDsSayFwh   := {}
   LOCAL lc_iFor         := 0

   lc_aCtrlsAllFwh := f_oDlgContainer:aControls

   FOR lc_iFor := 1 TO Len( lc_aCtrlsAllFwh )

      IF ValType( lc_aCtrlsAllFwh[ lc_iFor ] ) == "O"

         AAdd( lc_aIDsAllFwh, lc_aCtrlsAllFwh[ lc_iFor ]:nID )

      ENDIF

   NEXT

   EnumChildWindows( f_oDlgContainer:hWnd, ;
      {| _hChild | AAdd( lc_aCtrlsAllApi, { GetClassName( _hChild ), GetDlgCtrlID( _hChild ), _hChild,  } ) } )

   FOR lc_iFor := 1 TO Len( lc_aCtrlsAllApi )

      IF Upper( lc_aCtrlsAllApi[ lc_iFor, 1 ] ) == "STATIC"

      #ifdef __XHARBOUR__

      IF AScan( lc_aIDsAllFwh, lc_aCtrlsAllApi[ lc_iFor, 2 ] ) == 0 ; // Static Api > SAY Fwh not declared
         .AND. lc_aCtrlsAllApi[ lc_iFor, 2 ] != 65535                 // Static borland or IDs null

      #Else

         IF hb_AScan( lc_aIDsAllFwh, lc_aCtrlsAllApi[ lc_iFor, 2 ] ) == 0 ; // Static Api > SAY Fwh not declared
            .AND. lc_aCtrlsAllApi[ lc_iFor, 2 ] != 65535                    // Static borland or IDs null

      #endif

            SetWindowTheme( GetDc( lc_aCtrlsAllApi[ lc_iFor, 3 ] ), "", "" )

            Ctl3DLook( GetDc( lc_aCtrlsAllApi[ lc_iFor, 3 ] ), .F. )

            // sem efeito
            SetTextColor( GetDc( lc_aCtrlsAllApi[ lc_iFor, 3 ] ), CLR_YELLOW )

            // sem efeito
            SetBkColor( GetDc( lc_aCtrlsAllApi[ lc_iFor, 3 ] ), CLR_HCYAN )

         ENDIF

      ENDIF

   NEXT

RETURN NIL

// FIN / END

/* // GIOVANY3.RC
FIND_CONTROL DIALOGEX DISCARDABLE 6, 18, 325, 96
STYLE WS_POPUP|DS_MODALFRAME|DS_CONTEXTHELP|DS_3DLOOK|WS_CAPTION|WS_SYSMENU|WS_VISIBLE
CAPTION "Dialog: Find Controls?"
FONT 10, "Tahoma"
{
  CONTROL "Edit", 331, "Edit", ES_AUTOHSCROLL|WS_BORDER|WS_TABSTOP, 74, 40, 44, 12
  CONTROL "Edit", 332, "Edit", ES_AUTOHSCROLL|WS_BORDER|WS_TABSTOP, 74, 54, 243, 12
  CONTROL "&Imprimir", 301, "Button", WS_TABSTOP, 162, 72, 76, 17
  CONTROL "&Saida", 302, "Button", WS_TABSTOP, 241, 72, 76, 17
  CONTROL "Data da Intimação:", 4001, "Static", SS_RIGHT|WS_GROUP, 6, 42, 67, 8
  CONTROL "Quem assina/Cargo:", 4002, "Static", SS_RIGHT|WS_GROUP, 1, 56, 72, 8
}
*/

 


Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7824
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 99 guests

cron