G
gRANdOOM
A simple way to do put a window(form) in front of all other windows
(entire desctop) is to use the following conde.
[DllImport("user32")] public static extern int SetWindowPos(int hwnd,
int hWndInsertAfter, int x, int y, int cx, int cy, int wFlags);
private Form2 frm;
public void SetTopmost(IntPtr hwnd ,bool bTopmost)
{
long i = 0;
if (bTopmost == true)
{
i = SetWindowPos(hwnd.ToInt32() , -
1,Screen.PrimaryScreen.Bounds.Width/2 - 160/2,
Screen.PrimaryScreen.Bounds.Height/2 - 40/2, 160, 40, 0);
}
else
{
frm.Dispose();
}
}
public void StartForm()
{
frm = new Form2();
SetTopmost(frm.Handle ,true);
frm.Show();
}
The code iz copyed from a project.
(entire desctop) is to use the following conde.
[DllImport("user32")] public static extern int SetWindowPos(int hwnd,
int hWndInsertAfter, int x, int y, int cx, int cy, int wFlags);
private Form2 frm;
public void SetTopmost(IntPtr hwnd ,bool bTopmost)
{
long i = 0;
if (bTopmost == true)
{
i = SetWindowPos(hwnd.ToInt32() , -
1,Screen.PrimaryScreen.Bounds.Width/2 - 160/2,
Screen.PrimaryScreen.Bounds.Height/2 - 40/2, 160, 40, 0);
}
else
{
frm.Dispose();
}
}
public void StartForm()
{
frm = new Form2();
SetTopmost(frm.Handle ,true);
frm.Show();
}
The code iz copyed from a project.