Hi Yuan,
Just to make sure I'm clear what you're asking: are you talking about computing the risk neutral probability p with continuous dividends? If so, use (exp((r-q)dt) - d) / (u-d). If you're asking about discrete dividends, I have not tried it yet.
rog