EnumChildWindows

EnumChildWindows

Postby Natter » Sat Jun 21, 2008 9:09 pm

Hi, all !
Where I can find examples with function API EnumChildWindows() using ? I finded examplest on VB/Delphi/C. But ! can't write it on FWH.
Natter
 
Posts: 1215
Joined: Mon May 14, 2007 9:49 am

Postby Antonio Linares » Mon Jun 23, 2008 8:01 am

You can use this code to access all child windows:
Code: Select all  Expand view
#define GW_CHILD      5
#define GW_HWNDNEXT   2

function ProcessChilds( oDlg )

   local hCtrl := GetWindow( oDlg:hWnd, GW_CHILD )

   ... your code ...

   while hCtrl != 0
      hCtrl = GetWindow( hCtrl, GW_HWNDNEXT )
      ... your code ...
   end

return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Natter » Mon Jun 23, 2008 9:19 am

Function GetWindow( hCtrl, GW_HWNDNEXT ) not find MDI windows . For this I to used FindWindowEx. Then I want get handles of controls on this MDI window by function GetWindow, but can't do it. I read that can to use EnumChildWindows for it.
Natter
 
Posts: 1215
Joined: Mon May 14, 2007 9:49 am

Postby Antonio Linares » Mon Jun 23, 2008 10:25 am

We are going to implement it :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Natter » Mon Jun 23, 2008 12:04 pm

Thank, Antonio ! It's work
Natter
 
Posts: 1215
Joined: Mon May 14, 2007 9:49 am

Postby Antonio Linares » Mon Jun 23, 2008 1:52 pm

Here you have it:
Code: Select all  Expand view
// (c) FiveTech Software, 2008

#include "FiveWin.ch"

function Main()

   local oDlg

   DEFINE DIALOG oDlg TITLE "Test"

   @ 2, 2 BUTTON "Enum" ;
      ACTION EnumChildWindows( oDlg:hWnd,;
             { | hChild, nLParam | MsgInfo( GetClassName( hChild ) ), .T. },; // .T. means continue
             0 ) // optional supplied value

   @ 2, 8 BUTTON "Another"

   ACTIVATE DIALOG oDlg CENTERED

return nil

#pragma BEGINDUMP

#include <hbapi.h>
#include <hbapiitm.h>
#include <windows.h>

void hb_evalBlock( PHB_ITEM pCodeBlock, ... );

static PHB_ITEM pCodeBlock = NULL;

BOOL CALLBACK static EnumChildProc( HWND hWnd, LPARAM lParam )
{
    PHB_ITEM pHWnd  = hb_itemPutNL( NULL, ( LONG ) hWnd );
    PHB_ITEM pParam = hb_itemPutNL( NULL, ( LONG ) lParam );
   
    if( pCodeBlock )
      hb_evalBlock( pCodeBlock, pHWnd, pParam, 0 );
     
   hb_itemRelease( pHWnd );
   hb_itemRelease( pParam );   
     
   return hb_parl( -1 );      
}   

HB_FUNC( ENUMCHILDWINDOWS )
{
   HWND hWnd = ( HWND ) hb_parnl( 1 );
   LPARAM lParam = ( LPARAM ) hb_parnl( 3 );
   
   pCodeBlock = hb_param( 2, HB_IT_BLOCK );
   hb_retl( EnumChildWindows( hWnd, EnumChildProc, lParam ) );
   pCodeBlock = NULL;
}   

#pragma ENDDUMP
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 59 guests

cron