Control ID in a Dialog

Control ID in a Dialog

Postby Antonio Linares » Sat Aug 01, 2009 5:17 am

How to search a control ID in a resource dialog (without redefining its controls):
Code: Select all  Expand view

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
User avatar
Antonio Linares
Site Admin
 
Posts: 42081
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 64 guests