I need advice

I’m currently having really bad heavy bleeding with severe cramps. Went to the doctor and got painkillers.

The Doctor asked me if I was aware if I was pregnant 2 weeks ago and I had no idea. He said that I may be going through severe menstrual cramps or a miscarriage.

Can results show if I’m pregnant while having this bleeding going on?