How popup "Connect To" dialog?

delphi, winapi

Solution

From the command line you can do this. (at least, on Win7 for me...()

 rundll32.exe van.dll,RunVAN

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:

https://groups.google.com/forum/?hl=en&fromgroups=#!topic/microsoft.public.development.device.drivers/nPn-PH3g_2Q

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;

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.

Problem

how to popup this form use delphi ? is `ShellExecuteEx` or `ShellExecute` can do this?

Original source