Using DebugBreak

You can have your program call the DebugBreak Win32 function at the point in your code that you want debugging to start. Calling this function causes the program to display a dialog box as if it had crashed. Click Cancel to start the debugger and continue on in debug mode.