I have a line of code that connects to a DDE service/topic. Most of the time, the connection is instant however sometimes it can hang forever. I don't know why it's hanging and don't want to spend hours figuring out why either. I wanted to know if there is a way that I can wait for a maximum of 5 seconds for this line of code to execute. After 5 seconds, it should timeout and I'll handle the timeout event appropriately.
I was thinking of using events and WaitForSingleObject but don't know how to go about doing it.
Appreciate your help.