Was it clear that she became pregnant from David?
Chomas Anach: It is not normal for a pregnant woman to see blood. Since she immersed from Nidah, this shows that she was not pregnant before this! However, this is not a proof; occasionally a pregnant woman becomes Nidah! The Zohar says that Uriyah never had Bi'ah with her. "V'Hi Miskadeshes" hints to this (she was like an Arusah, and not like a Nesu'ah).
Malbim: Yes. The Zohar says that he gave to her a Get on Sivan 7, and David took her on Elul 24 (more than three months later), so clearly she was pregnant from him.
When did she realize that she is pregnant?
Malbim citing Ralbag: It was immediately; she felt that the moistness left her. 1
The verse implies that she had no doubt. It is a Chidush that she knew with certainty, especially if she was only six years old when she gave birth (Sanhedrin 69b), and presumably had not been pregnant before this! (PF)