cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Matronix
Level 6

Dialog box showing up in background on 64-bit machines.

I have a managed custom action that calls a C# DLL. The C# DLL displays a dialog. When I run this custom action on a Windows 2008 64-bit machine all of the C# dialogs show up in the background behind the installer window. Does anyone know how to make those dialogs come to the foreground. It works on all other types of operating systems.
Labels (1)
0 Kudos
4 Replies
grparsec
Level 7

I have the same problem.
0 Kudos
Matronix
Level 6

I found a few answers to the problem. There are two ways to do this I think. What are you trying to call from your custom action?
0 Kudos
grparsec
Level 7

I'm executing an EXE that gets installed with the product.
0 Kudos
Matronix
Level 6

This is what I ended up using:

[CODE]
...

[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
private static extern IntPtr GetForegroundWindow();

public class WindowWrapper : System.Windows.Forms.IWin32Window
{
public WindowWrapper(IntPtr handle)
{
_hwnd = handle;
}

public IntPtr Handle
{
get { return _hwnd; }
}

private IntPtr _hwnd;
}
...


MessageBox.Show(new WindowWrapper(GetForegroundWindow()), "Yippee!");



[/CODE]
0 Kudos