I don't know if you can have a formula in terms of window length, number of DFT points and difference between two angular frequencies you are trying to resolve. But you can do some experiments with different types of the windows and determine this in MATLAB. Note you need to consider the following.
For a DFT of size N you get two frequency bins separated by $\frac{2*\pi}{N}$. So you should have N large enough resolve $\omega_2 - \omega_1$
Note that before you take DFT, when you window it the frequency response will be convolution of two frequency response - frequency response of the window and the frequency response of the signal which in your case pretty much a pair of delta function.
Now Hanning window will have a wide main lobe and suppressed side lobes. So if the second signal's frequency falls within the main lobe then you won't be able to detect it unless amplitude of the second signal is large enough compared to the smeared component of the first signal at the location of the second signal. Or if the second signal falls in some of the side lobe location and second signal's amplitude is large enough compared to the first signal's component in side lobe region you should be able to detect it.
If you chose a rectangular window the main lobe will be substantially shorter compared to rectangular window. But the side lobes will be substantially larger compared to the Hanning window case.
There exist the trade-off between using different window sizes.