One thing you could try is to create a class that implements the IWin32Window interface. Check out
this article here (search for IWin32Window to get to the topic) on how to set this up.
You can wrap the GetForeGroundWindow() function and use that to get the window handle. I think this function should give you the correct window handle automatically. But if it doesnt' you can always get the HWND yourself and then pass it into a class that implements the IWin32Window, and then pass that class to the ShowDialog method.
I hope this helps.
Bilal Durrani
NI