FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Control ID in a Dialog
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Control ID in a Dialog
Posted: Sat Aug 01, 2009 05:17 AM
How to search a control ID in a resource dialog (without redefining its controls):
Code (fw): Select all Collapse
DEFINE DIALOG oDlg RESOURCE cResDlgName

ACTIVATE DIALOG oDlg ;
  ON INIT ( lFound := LookForControl( oDlg:hWnd, nCtrlId ), oDlg:End() )

...

function LookForControl( hDlg, nCtrlId )

  local hCtrl

  while ( hCtrl := GetWindow( hDlg, GW_CHILD ) ) != 0 .and. GetParent( hCtrl ) == hDlg
     if GetWindowLong( hCtrl, GWL_ID ) == nCtrlId
        return .T.
     endif
     hCtrl = GetWindow( hCtrl, GW_HWNDNEXT )
  end

return .F.
regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion