开发者

Suppress Process Popup in .NET

开发者 https://www.devze.com 2023-03-07 18:01 出处:网络
Our user panel runs all of our software as services. For whatever reason though, the Mumble voice software creates a popup when you run it with an administrator password set in the command line. Someo

Our user panel runs all of our software as services. For whatever reason though, the Mumble voice software creates a popup when you run it with an administrator password set in the command line. Someone posted an alternative by using a bat file that runs two processes as a work around, but is there any way to just suppress the popup message using .NET? I have written a lot of launcher type apps to fix things like this, but I have no idea how I could suppress this message.

Here is what the .bat file looks like from the workaround.

set /p VAR= < su开发者_开发百科peradmin.txt
start murmur2.exe -supw %var%
ping 0.0.0.0 -n 3 > NUL
tskill murmur2
murmur.exe


You can try to monitor open windows and close popup via winapi when it shows up

[DllImport("user32.dll")]
public static extern int FindWindow(string lpClassName, string lpWindowName);

[DllImport("user32.dll")]
public static extern int SendMessage(int hWnd, uint Msg, int wParam, int lParam);

public const int WM_COMMAND = 0x0112;
public const int WM_CLOSE = 0xF060;

int handle = FindWindow(lpClassName, lpWindowName);
SendMessage(handle, WM_COMMAND, WM_CLOSE, 0);
0

精彩评论

暂无评论...
验证码 换一张
取 消