Object associate Handle Window with ClassName = "#32770

Object associate Handle Window with ClassName = "#32770

Postby ericmagaldi » Sun Feb 25, 2007 4: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.
Code: Select all  Expand view
/****************************************************
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() )
//****************************************************
Last edited by ericmagaldi on Sun Mar 04, 2007 12:39 pm, edited 1 time in total.
virtually,
Éric
xHarbour.org + Borland C + FiveWin (2.8/6.12) + Pelles C + HBMake + ADSCDX
São Paulo - Brasil
http://xBaseSuporte.freeforums.org
User avatar
ericmagaldi
 
Posts: 37
Joined: Tue Feb 20, 2007 9:26 am
Location: São Paulo - Brazil

Postby Antonio Linares » Sun Feb 25, 2007 9: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
User avatar
Antonio Linares
Site Admin
 
Posts: 41937
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby ericmagaldi » Sun Feb 25, 2007 9: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
User avatar
ericmagaldi
 
Posts: 37
Joined: Tue Feb 20, 2007 9:26 am
Location: São Paulo - Brazil

Postby Antonio Linares » Sun Feb 25, 2007 12:21 pm

Éric,
Code: Select all  Expand view
AEval( oDlg:aControls, { | oControl | ... } )

or

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

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

Postby ericmagaldi » Sun Feb 25, 2007 1: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
User avatar
ericmagaldi
 
Posts: 37
Joined: Tue Feb 20, 2007 9:26 am
Location: São Paulo - Brazil

Postby Antonio Linares » Sun Feb 25, 2007 8: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()
Code: Select all  Expand view
   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
User avatar
Antonio Linares
Site Admin
 
Posts: 41937
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

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