It's hard to say without knowing the cause. If it's a problem with data then a factory reset should fix it, though of course you'll lose any un-backed-up data in the internal storage (including messages, also contacts if these are not backed up to SD or synced with Google). If you are not rooted that may be your only option, though it would be worth trying to wipe cache first.
If you didn't take the battery out for at least 2 minutes, try that before anything else.
To wipe cache or reset, reboot the phone while pressing and holding the "volume down" key. This will take you to the hboot screen (white, little green androids at the bottom). Use the volume and power keys to select "recovery". This will give you a black screen with a red triangle. From there, pressing volume up + power should bring up the recovery menu. This will let you wipe cache, which is the first thing I'd try, and if that doesn't fix it go back into recovery and this time do a factory reset.
If by any chance you are rooted and have a custom recovery you have more options. If that is the case, please post again and we'll see what we can come up with.
Otherwise, if a factory reset doesn't fix it and you are not rooted the one remaining option is to reload the software completely. This will require a PC, and also we'll need to know more about the phone (whether it was an unbranded or branded handset, if branded which network) in order to identify the correct software package. So in that case please post again, either here or in the main forum, with the information and we'll point you to the right download (the main forum would be better as it's more likely that a Desire expert - probably me - will see it there).
Good luck!