event.childID = varChild_lVal - 1;
event.detail = osToState(osState); if (varChild_lVal == COM.CHILDID_SELF) { event.childID = ACC.CHILDID_SELF; } else { if (control instanceof Tree) {  event.childID = varChild_lVal;   int hwnd = control.handle; TVITEM tvItem = new TVITEM (); tvItem.mask = OS.TVIF_HANDLE | OS.TVIF_STATE; tvItem.hItem = varChild_lVal; tvItem.stateMask = OS.TVIS_STATEIMAGEMASK; int result = OS.SendMessage (hwnd, OS.TVM_GETITEM, 0, tvItem); boolean checked = (result != 0) && (((tvItem.state >> 12) & 1) == 0); if (checked) event.detail |= ACC.STATE_CHECKED; } else if (control instanceof Table) { event.childID = varChild_lVal - 1;   Table table = (Table) control; TableItem item = table.getItem(event.childID); if (item != null) { if (item.getChecked()) event.detail |= ACC.STATE_CHECKED; } } else { event.childID = varChild_lVal - 1; } }
	int get_accState(int varChild_vt, int varChild_reserved1, int varChild_lVal, int varChild_reserved2, int pvarState) {		if (accessibleControlListeners.size() == 0) {			return iaccessible.get_accState(varChild_vt, varChild_reserved1, varChild_lVal, varChild_reserved2, pvarState);		}		if ((varChild_vt & 0xFFFF) != COM.VT_I4) return COM.E_INVALIDARG;		AccessibleControlEvent event = new AccessibleControlEvent(this);		event.childID = varChild_lVal - 1;		for (int i = 0; i < accessibleControlListeners.size(); i++) {			AccessibleControlListener listener = (AccessibleControlListener) accessibleControlListeners.elementAt(i);			listener.getState(event);		}		int state = stateToOs(event.detail);		COM.MoveMemory(pvarState, new short[] { COM.VT_I4 }, 2);		COM.MoveMemory(pvarState + 8, new int[] { state }, 4);		return COM.S_OK;	}