FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Object associate Handle Window with ClassName = "#32770
Posts: 37
Joined: Tue Feb 20, 2007 09:26 AM
Object associate Handle Window with ClassName = "#32770
Posted: Sun Feb 25, 2007 04:20 AM
Sorry my English :-)

Please Antonio Linares,

FindObject( GetActivateWindow() ), not found the Handle in GetAllWin(), when Handle active Window belong ClassName = "#32770"

Always return correctly, when the handle is control with focus, FindObject( GetFocus()).
--------------------------------------------------------------------------
Montei uma rotina de propósito geral, onde pesquiso o handle do controle informado(ou ativo), e retorno o objeto associado.
Caso eu procure o controle que esta em foco, sempre encontra corretamente.
/**************************************************** 
Retorna o objeto associado ao Handle informado. 
Return Object associate to Handle argument. 
****************************************************/ 
function FindObject( nHandle ) // => oControl 
TypeU nHandle Def GetFocus() 
return FindObj( nHandle, GetAllWin() ) 

/**************************************************** 
Faz a pesquisa recursiva 
Find recursive 
****************************************************/ 
static function FindObj( nHandle, oSource ) // oControl 
local oControl 

if ValTypeA(oSource) 
   AEVAL( oSource, {|o,x| x:=FindObj(nHandle,o), oControl:=if(x=nil,oControl,x) }) 

elseif ValTypeO(oSource) 

   if oSource:hWnd = nHandle 
      oControl:=oSource 

   elseif 'DIALOG' $ oSource:ClassName .or. ; 
          'WINDOW' $ oSource:ClassName .or. ; 
          '#32770' $ oSource:ClassName .or. ; 
          'MDICHILD' $ oSource:ClassName .or. ; 
          'MDIFRAME' $ oSource:ClassName 

      AEVAL( oSource:aControls, {|o,x| x:=FindObj(nHandle,o), oControl:=if(x=nil,oControl,x) }) 

   elseif 'FOLDER' $ oSource:ClassName .or. ; 
          'PAGES' $ oSource:ClassName 

      AEVAL( oSource:aDialogs, {|o,x| x:=FindObj(nHandle,o), oControl:=if(x=nil,oControl,x) }) 

   endif 

endif 
return oControl 

/**************************************************** 
Retorna o Objeto da janela ativa 
Retorn object to Window active 
****************************************************/ 
function WindowObject() // => oWindow 
return FindObject( GetActiveWindow() ) 
//****************************************************
virtually,
Éric
xHarbour.org + Borland C + FiveWin (2.8/6.12) + Pelles C + HBMake + ADSCDX
São Paulo - Brasil
http://xBaseSuporte.freeforums.org
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Object associate Handle Window with ClassName = "#32770
Posted: Sun Feb 25, 2007 09:20 AM

Éric,

Class "#32770" is a standard Windows Class that is used to create the dialogboxes.

FW does not include the dialogs inside the returned array from GetAllWin() because the dialogos don't get replaced theirs windows procedures, as we just store there the windows and controls that have changed their procedures.

I guess that you want to find a dialog given its window handle, right ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 37
Joined: Tue Feb 20, 2007 09:26 AM
Object associate Handle Window with ClassName = "#32770
Posted: Sun Feb 25, 2007 09:36 AM
Antonio Linares wrote:Éric,

Class "#32770" is a standard Windows Class that is used to create the dialogboxes.

FW does not include the dialogs inside the returned array from GetAllWin() because the dialogos don't get replaced theirs windows procedures, as we just store there the windows and controls that have changed their procedures.

I guess that you want to find a dialog given its window handle, right ?


Sim.
Dependendo da rotina, gostaria de acessar todos os controles do Dialogo atual. Como eu faço ?
/*
Yes, depend routine, need access objects all control of Dialog. How resolve ?
*/
regards.
virtually,
Éric
xHarbour.org + Borland C + FiveWin (2.8/6.12) + Pelles C + HBMake + ADSCDX
São Paulo - Brasil
http://xBaseSuporte.freeforums.org
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Object associate Handle Window with ClassName = "#32770
Posted: Sun Feb 25, 2007 12:21 PM
Éric,
AEval( oDlg:aControls, { | oControl | ... } )

or

for n = 1 to Len( oDlg:aControls )
   ... oDlg:aControls[ n ] ...
next
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 37
Joined: Tue Feb 20, 2007 09:26 AM
Object associate Handle Window with ClassName = "#32770
Posted: Sun Feb 25, 2007 01:24 PM

of course... oDlg:aControls.... :)

but, how found object of Dialogs "#32770" ? have only handle of Dialog active.

thanks !!

virtually,
Éric
xHarbour.org + Borland C + FiveWin (2.8/6.12) + Pelles C + HBMake + ADSCDX
São Paulo - Brasil
http://xBaseSuporte.freeforums.org
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Object associate Handle Window with ClassName = "#32770
Posted: Sun Feb 25, 2007 08:25 PM
Éric,

FWH does not provide yet a function to retrieve a dialog object given its window handle

Ahyhow, given any window handle you can check all its controls using GetWindow()
   local hCtrl := GetWindow( hWnd, GW_CHILD ) 

   while hCtrl != 0 
      if GetClassName( hCtrl ) == "Static"  // SAY 
         ... 
      endif 
      hCtrl = GetWindow( hCtrl, GW_HWNDNEXT ) 
   end
regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion