我在.net 2.0上有一个Windows应用程序.在Form1,我打开一个PrintDialog.如何从我的代码中获取该对话框的句柄?
我已经尝试了很多的Win32函数:EnumWindows,EnumChildWindows,FindWindow,FindWindowEx但它无法找到我的PrintDialog.所有我能找到的只是Form1它的孩子是它的控制.我无法PrintDialog's办理.
我试过的一些代码:
导入win32:
[DllImport("user32.dll", SetLastError = true)]
public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
Run Code Online (Sandbox Code Playgroud)
调用win32函数:
using (PrintDialog dlg = new PrintDialog
{
AllowCurrentPage = false,
AllowSomePages = true,
AllowSelection = false
})
{
IntPtr printHandle = CustomPrintDialog.FindWindow("#32770", "Print");
// some logic with printHandle go here
if (dlg.ShowDialog(this)==DialogResult.OK){
// some logic go here
}
}
Run Code Online (Sandbox Code Playgroud)
我用Spy ++检查过,还有一个PrintDialog窗口.该PrintDialog …
我使用的是 Ubuntu 14.04(实际上是 Azure VPS),所以我必须安装 rfc5766-turn-server 而不是最新的 coturn 版本。我已遵循本指南。
在最后一步,我无法启动turnserver。我的启动命令:
turnserver -n -L <my_server_public_IP> -X <my_server_public_IP> -E <my_server_public_IP> -a -f -r my-domain.com --cert /myPath/TurnServerCerts/turnserver.crt --pkey /myPath/TurnServerCerts/turnserver.key
Run Code Online (Sandbox Code Playgroud)
我从日志中得到:
........
bind: Cannot assign requested address
0: Trying to bind fd 14 to <my_server_public_IP:3478>: errno=99
Cannot bind local socket to addr: Cannot assign requested address
0: Cannot bind UDP/DTLS listener socket to addr <my_server_public_IP:3478>:3478
0: Trying to bind UDP/DTLS listener socket to addr <my_server_public_IP:3478>:3478, again...
0: Trying to bind fd 15 …Run Code Online (Sandbox Code Playgroud)