event.childID = varChild_lVal - 1;
	int get_accState(int varChild_vt, int varChild_reserved1, int varChild_lVal, int varChild_reserved2, int pvarState) {		if (iaccessible == null) return COM.CO_E_OBJNOTCONNECTED;		if ((varChild_vt & 0xFFFF) != COM.VT_I4) return COM.E_INVALIDARG;		/* Get the default state from the OS. */		int osState = 0;		int code = iaccessible.get_accState(varChild_vt, varChild_reserved1, varChild_lVal, varChild_reserved2, pvarState);		if (code == COM.E_INVALIDARG) code = COM.S_FALSE; // proxy doesn't know about app childID		// TEMPORARY CODE - process tree and table even if there are no apps listening		if (accessibleControlListeners.size() == 0 && !(control instanceof Tree || control instanceof Table)) return code;		if (code == COM.S_OK) {			short[] pvt = new short[1];			COM.MoveMemory(pvt, pvarState, 2);			if (pvt[0] == COM.VT_I4) {				int[] pState = new int[1];				COM.MoveMemory(pState, pvarState + 8, 4);				osState = pState[0];			}		}		AccessibleControlEvent event = new AccessibleControlEvent(this);		event.detail = osToState(osState);		if (varChild_lVal == COM.CHILDID_SELF) {			event.childID = ACC.CHILDID_SELF;		} else {			if (control instanceof Tree) {				/* Tree item childIDs are pointers (not 1-based indices). */				event.childID = varChild_lVal;				// TEMPORARY CODE				/* Currently our checkbox tree is emulated using state mask images,				 * so we need to determine if the item is 'checked' here. */				int hwnd = control.handle;				TVITEM tvItem = new TVITEM ();				tvItem.mask = OS.TVIF_HANDLE | OS.TVIF_STATE;				tvItem.stateMask = OS.TVIS_STATEIMAGEMASK;				if (OS.COMCTL32_MAJOR >= 6) {					tvItem.hItem = OS.SendMessage (hwnd, OS.TVM_MAPACCIDTOHTREEITEM, varChild_lVal, 0);				} else {					tvItem.hItem = varChild_lVal;				}				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;								// TEMPORARY CODE				/* Currently our checkbox table is emulated using state mask images,				 * so we need to determine if the item is 'checked' here. */				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;			}		}		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;	}