如何弹出“连接到”对话? [英] How popup "Connect To" dialog?
问题描述
如何弹出窗体使用delphi?
是 ShellExecuteEx
或 ShellExecute
可以这样做吗?
how to popup this form use delphi ?
is ShellExecuteEx
or ShellExecute
can do this?
推荐答案
从命令行可以做到这一点。 (至少在Win7上为我...()
From the command line you can do this. (at least, on Win7 for me...()
rundll32.exe van.dll,RunVAN
所以,只需将它包装在一个合适的 ShellExecute
或类似的调用中。
So, just wrap that in a suitable ShellExecute
or similar call.
请注意,该对话框旨在弹出系统托盘,我不知道如何让它在更明显的地方出现。
Note that the dialog is designed to pop up in the system tray. I don't know how you'd get it to appear somewhere more obvious.
另外,看看这个线程,这里提到的另一种方法是描述如何以更有用的方式来实现:
Also, have a look at this thread. There's another way mentioned here that describes how to do it in a possibly more useful fashion:
如果你想从你的程序调用这个,只需跳过 rundll32
调用就简单了可以自己加载DLL并调用该函数,例如:
If you want to invoke this from your program, it's simpler just to skip the rundll32
call. You can load the DLL yourself and invoke the function. For example:
procedure RunVANW(hwnd: HWND; hinst: HINST; lpszCmdLine: LPSTR;
nCmdShow: Integer); stdcall; external 'van.dll';
procedure ShowViewAvailableNetworksDialog;
begin
RunVANW(0, 0, nil, 0);
end;
我希望这个功能在旧版本的Windows上不可用,几乎肯定会被修改在Windows的未来版本。因此,您可能更喜欢使用 LoadLibrary
和 GetProcAddress
编写DLL导入,并根据是否运行时切换行为 RunVANW
功能可用。
I would expect that this functionality is not available on older versions of Windows, and almost certainly will be modified on future versions of Windows. So you may prefer to write the DLL import using LoadLibrary
and GetProcAddress
, and switch behaviour at runtime depending on whether or not the RunVANW
function is available.
这篇关于如何弹出“连接到”对话?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!