how to popup this form use delphi ?
is ShellExecuteEx
or ShellExecute
can do this?
1 Answers
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:
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.

- 13,748
- 1
- 45
- 83

- 66,617
- 42
- 165
- 277
-
2+1 Very well played sir! The easiest way to do it in code is to call `LoadLibrary` to load `van.dll`, `GetProcAddress` to get `RunVAN` function pointer, and then call `RunVAN`. Rather heavy duty to invoke `rundll32` or `ShellExecute` from code. It looks like you need to load `RunVANW`. This does look like an unsupported hack though. I suspect it won't work on all versions of Windows. – David Heffernan Nov 05 '12 at 09:52
-
1Or even just like this: `procedure RunVANW; stdcall; external 'van.dll';` – David Heffernan Nov 05 '12 at 10:41
-
1@David: The last one crashes - apparently the signature has to be RunDll-compatible: `procedure RunVANW(hwnd: HWND; hinst: HINST; lpszCmdLine: LPSTR; nCmdShow: Integer); stdcall; external 'van.dll';`. Then calling `RunVANW(Handle, HInstance, '', 0);` works (for me :-)). – Uli Gerhardt Nov 05 '12 at 10:54
-
@UliGerhardt Ah, you are right. My mistake. Didn't crash for me when I did it wrong, but I guess I just got lucky! Or unlucky depending on your point of view! – David Heffernan Nov 05 '12 at 10:57
-
@UliGerhardt and David - I'm at the edge of my comfort zone here, so feel free to write a better answer incorporating your comments and the initial concept. I'll gladly upvote ;-) – Roddy Nov 05 '12 at 11:00
-
1@Roddy I added some code to your answer. We don't need another answer here in my view. – David Heffernan Nov 05 '12 at 11:05
-
@UliGerhardt I didn't do anything special. Blocks with 4 space indentation are code blocks and display pre-formatted. – David Heffernan Nov 05 '12 at 12:37
-
@DavidHeffernan I found it doesn't work in windows 8. error : "Access violation at address 76359B51 in module 'combase.dll'. Read of address 55C08BC3 " – Hanlin Nov 06 '12 at 04:57
-
@ONion that's exactly as I expected. It is, after all, an undocumented hack! – David Heffernan Nov 06 '12 at 07:20
-
@DavidHeffernan It's OK to use `procedure RunVANW; stdcall; external 'van.dll';` use `procedure RunVANW(hwnd: HWND; hinst: HINST; lpszCmdLine: LPSTR; nCmdShow: Integer); stdcall; external 'van.dll';` will got a error in win8 – Hanlin Nov 06 '12 at 07:42
-
@DavidHeffernan by the way, There are other ways to do this? – Hanlin Nov 07 '12 at 02:44
-
@ONion Perhaps. Not that I know of though. – David Heffernan Nov 07 '12 at 07:18