topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday March 28, 2024, 5:04 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Last post Author Topic: How to create a shortcut for the "wireless network connection" in Windows XP?  (Read 55993 times)

superboyac

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 6,347
    • View Profile
    • Donate to Member
I'm not having luck finding any way to create a shortcut for the Wireless Network Connection dialog in windows Xp.  Can anyone help with this?  Without a shortcut, it takes two or three clicks to get to the screen, depending on how you go about it.  You can click on the tray icon for wifi, which opens up the properties, then from there you have to click on the "view wireless networks" button to get to the screen.  I've googled this, and there are no answers that I could find (surprise).  There was the typical forum response of "you can just click here and then click there" to someone, who (as i would) responded with "Yes, I'm aware of the normal way of doing it.  i was asking for a shortcut."  that was pretty funny.

Anyway, I'm trying to figure out how to do the shortcut.  Any advice is appreciated.  Thanks.

Carol Haynes

  • Waffles for England (patent pending)
  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 8,066
    • View Profile
    • Donate to Member
Drag the connection to the desktop

AndyM

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 616
    • View Profile
    • Donate to Member
Drag the connection to the desktop
from the Network Connections Folder

Stoic Joker

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 6,646
    • View Profile
    • Donate to Member
I don't have WiFi on my desktop... but ncpa.cpl opens the network connections folder. It's possible if you do a search of the Windows folder for *.cpl you might get closer (find a better match) to your target.

Stoic Joker

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 6,646
    • View Profile
    • Donate to Member
Also Found This:
Wireless Network Setup
RunDll32.exe shell32.dll,Control_RunDLL NetSetup.cpl,@0,WNSW

Here: http://www.osattack....ws-7-shell-commands/


superboyac

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 6,347
    • View Profile
    • Donate to Member
Andy, Carol...your suggestion only opens up the Connection Status window.  From there, you still have to press the 'View Wireless Networks" button.  It's better, but not really what I was asking for.

Stoic, your suggestion doesn't really work either, nor does anything on that link.  but I think you're right, there must be some cpl file that does this.  Seriously, what is the command that opens up that window?  It's there somewhere, I know it is...

AndyM

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 616
    • View Profile
    • Donate to Member
Yeah, it was too easy.  I didn't really think you didn't already know how to make that shortcut. 

I can't get to the dialog box that shows the "View Wireless Networks" button since I don't have any wireless connections enabled.  But when I want a one click solution like this and I can't find the right .cpl file and/or parameters, I'll use either an AutoHotkey or Macro Express script.  In this case, Macro Express since it's easier for me (haven't learned how to click buttons in Autohotkey): open the cpl file and then either Alt-key or mouse click commands to hit the button.  Crude but effective.   


superboyac

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 6,347
    • View Profile
    • Donate to Member
Yeah, it was too easy.  I didn't really think you didn't already know how to make that shortcut. 

I can't get to the dialog box that shows the "View Wireless Networks" button since I don't have any wireless connections enabled.  But when I want a one click solution like this and I can't find the right .cpl file and/or parameters, I'll use either an AutoHotkey or Macro Express script.  In this case, Macro Express since it's easier for me (haven't learned how to click buttons in Autohotkey): open the cpl file and then either Alt-key or mouse click commands to hit the button.  Crude but effective.   
Ooo...good idea.  I'm going to post this in the ideas section.  Maybe somebody can do an AHK thing for it.

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,286
    • View Profile
    • Donate to Member
There is no .cpl file for this.  Apparently, though, there is a way using the RunDLL method:  rundll32.exe van.dll,RunVAN

However, none of my systems have a van.dll file on them (even my laptop with a wireless card).  Anybody else have this file on their system?


superboyac

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 6,347
    • View Profile
    • Donate to Member
There is no .cpl file for this.  Apparently, though, there is a way using the RunDLL method:  rundll32.exe van.dll,RunVAN

However, none of my systems have a van.dll file on them (even my laptop with a wireless card).  Anybody else have this file on their system?
Yeah, I just tried that one.  I don't have this van file anywhere, either.  I just created a request for this idea in the coding snacks forum:
https://www.donation...ex.php?topic=25399.0

skwire?  I'll make you another badge...

Stoic Joker

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 6,646
    • View Profile
    • Donate to Member
It's been a really long time since I played with this kinda stuff, but I do recall that teh string after the .cpl extension is for triggering a specific tab or child dialog. So your answer will be along those lines.

If I have time tonight I'll drag out my laptop and see if I can nail down which one it is.

AndyM

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 616
    • View Profile
    • Donate to Member
What you posted:

RunDll32.exe shell32.dll,Control_RunDLL NetSetup.cpl,@0,WNSW

gets me the same dialog as the "Wireless Network Connection" icon in the Network Connections folder. (Edit:  No it doesn't, my mistake). So you could use the RunDll line and then have the script select the "View Wireless Connections" button.
If you find the right parameter then you'll be able to get there right from a plain vanilla shortcut.

But the Wireless Network Connection shortcut does get me to here in one click (XP SP3) :

« Last Edit: January 24, 2011, 04:51 PM by AndyM »

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,286
    • View Profile
    • Donate to Member
Yeah, I just tried that one.  I don't have this van file anywhere, either.  I just created a request for this idea in the coding snacks forum:
https://www.donation...ex.php?topic=25399.0

I actually found the file on my Win7 VM but the RunDLL call doesn't work under XP (not surprising).

skwire?  I'll make you another badge...

Unless there's a programatical way to do this, I'll pass.  This is easily scriptable with AutoHotkey but the script will almost certainly be custom to your computer and whichever OS you run.  I don't like to get involved in such scripts for that reason.

superboyac

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 6,347
    • View Profile
    • Donate to Member
Unless there's a programatical way to do this, I'll pass.  This is easily scriptable with AutoHotkey but the script will almost certainly be custom to your computer and whichever OS you run.  I don't like to get involved in such scripts for that reason.
I hear you.  If that's true, now I understand why there are no good third-party wifi management utilities out there.  I remember searching very intensely for a couple of weeks, I'm talking hours and hours.  There was nothing.  The closest was WeFi, and it wasn't all that great.  But I get it now.  If there's no way for a programmer to do it in a way that works for most people, it's not worth it.  What a shame.

Still, I can't help but feel there's a way to call up that window.  It seems to me to be a standalone window.  It's not like any other window needs to be open to access it.  Like that network connections window where the button appears...you can close that and the wifi connections window will stay open.  It's a standalone window.  I don't get it.

wraith808

  • Supporting Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 11,186
    • View Profile
    • Donate to Member
Not sure if this helps...

Spoiler
from http://bit.ly/f7xeF0 (very long link to a google groups topic)
Stephan, et al,

The attached sample code uses the Shell APIs and will pop up the network
adapter Wireless Networks properties or Wireless Connections diaplog
depending on the value of ci.lpVerb (szShowWirelessProperties
"wzcproperties" or szShowWirelessConnect 0x0018), see code fragment below.  
These values may change at any time and this sample is provided "as is".  
ConnectionGUID will have to be changed to the GUID for your adapter.  This
is the same GUID as the NetCfgInstanceId for the adapter.

Bryan S. Burgin
[email protected]

This posting is provided "AS IS" with no warranties, and confers no rights.

Code: C++ [Select]
  1. // ShellExecuteSample.cpp : Defines the entry point for the console
  2. application.
  3. //
  4.  
  5. #include "stdafx.h"
  6. #include <windows.h>
  7. #include <tchar.h>
  8. #include <shellapi.h>
  9. #include <iostream.h>
  10. #include <objbase.h>
  11. #include <shlobj.h>
  12. #include <wtypes.h>
  13.  
  14. // {7007ACC7-3202-11D1-AAD2-00805FC1270E}
  15. const GUID CLSID_NetworkConnections = { 0x7007ACC7, 0x3202, 0x11D1, { 0xAA,
  16. 0xD2, 0x00, 0x80, 0x5F, 0xC1, 0x27, 0x0E } };
  17.  
  18. // Change this connection GUID to the GUID of the Wireless Network Device.
  19. LPWSTR ConnectionGUID = L"::{C07F7206-6DF1-4537-9890-D71C981BF952}";
  20.  
  21. // The '18' below may appear like a magic number, but it's really not. If
  22. you were to
  23. // call IContextMenu->QueryContextMenu, and look for the Cmd ID of 'Show
  24. Available Wireless Networks'
  25. // you'll see it to be 18. The value is constant.
  26. LPCSTR szShowWirelessConnect    = (LPCSTR)0x0018;
  27. LPCSTR szShowWirelessProperties = "wzcproperties";
  28.  
  29. int main(int argc, char* argv[])
  30. {
  31.     CoInitialize(NULL);
  32.  
  33.     IShellFolder *pShellFolder;
  34.     HRESULT hr = CoCreateInstance(CLSID_NetworkConnections, NULL,
  35. CLSCTX_INPROC_SERVER,
  36.                                   IID_IShellFolder, reinterpret_cast<LPVOID
  37. *>(&pShellFolder) );
  38.  
  39.     if (SUCCEEDED(hr))
  40.     {
  41.         LPITEMIDLIST pidl;
  42.         hr = pShellFolder->ParseDisplayName(NULL, NULL, ConnectionGUID,
  43. NULL, &pidl, NULL);
  44.         if (SUCCEEDED(hr))
  45.         {
  46.             LPCITEMIDLIST apidl[] = { pidl };
  47.             IContextMenu* pContextMenu;
  48.             hr = pShellFolder->GetUIObjectOf(NULL, 1, apidl,
  49. IID_IContextMenu, NULL, reinterpret_cast<LPVOID *>(&pContextMenu));
  50.             if (SUCCEEDED(hr))
  51.             {
  52.                 CMINVOKECOMMANDINFO ci;
  53.                 ZeroMemory(&ci, sizeof(CMINVOKECOMMANDINFO));
  54.  
  55.                 // Change this line to show either szShowWirelessProperties
  56. or szShowWirelessConnect
  57.                 // ci.lpVerb = szShowWirelessProperties;
  58.                 ci.lpVerb = szShowWirelessConnect;
  59.  
  60.                 hr = pContextMenu->InvokeCommand(&ci);
  61.                 if (SUCCEEDED(hr))
  62.                 {
  63.                     cout << "Done - spinning message loop\n";
  64.  
  65.                     // Spin a windows message loop in order to give the
  66. dialog chance to process commands.
  67.                     // Of course to do it here is totally wrong - this
  68. should be as part of a parent window's windowproc
  69.                    // otherwise this app will never terminate. However,
  70. this is just for illustration.
  71.                    BOOL bRet;
  72.                    MSG msg;
  73.                    while( (bRet = GetMessage( &msg, NULL, 0, 0 )) != 0)
  74.                    {
  75.                        if (bRet == -1)
  76.                        {
  77.                            // handle the error and possibly exit
  78.                        }
  79.                        else
  80.                        {
  81.                            TranslateMessage(&msg);
  82.                            DispatchMessage(&msg);
  83.                        }
  84.                    }
  85.                }
  86.                pContextMenu->Release();
  87.            }
  88.        }
  89.        pShellFolder->Release();
  90.  
  91.        // Free the PIDL using the shell's allocator
  92.         IMalloc* pShellMalloc;
  93.         hr = SHGetMalloc(&pShellMalloc);
  94.         if (SUCCEEDED(hr))
  95.         {
  96.             pShellMalloc->Free(pidl);
  97.         }
  98.     }
  99.  
  100.     if (FAILED(hr))
  101.     {
  102.         cout << "Could not open wireless dialog due to error " << hr;
  103.     }
  104.     else
  105.     {
  106.         cout << "Success";
  107.     }
  108.     CoUninitialize();
  109.  
  110.         return 0;


Note: there were some hard breaks in the C&P, so the highlighting is wrong in places :(


superboyac

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 6,347
    • View Profile
    • Donate to Member
Yeah  ;D that doesn't help.  Thanks, though!  I wish I were a programmer...

wraith808

  • Supporting Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 11,186
    • View Profile
    • Donate to Member
Yeah  ;D that doesn't help.  Thanks, though!  I wish I were a programmer...

Not for you. LOL.  For someone that wants to program it for you. :)

Stoic Joker

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 6,646
    • View Profile
    • Donate to Member
Let me see if I can get it to compile...

Stoic Joker

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 6,646
    • View Profile
    • Donate to Member
Hm... Well, the program says it was successful ... But it don't open nothing.

*Shrug* Wraith, did the code say which OS(s) it was supposed to work on? My laptop is XP, Intel Pro 2915ABG WiFI card, with Windows controlling the connections.

Sorry SB, I tried.

Stoic Joker

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 6,646
    • View Profile
    • Donate to Member
Okay, scratch that last part, apparently I'm F'ing retarded ... I missed the use GUID for your NIC part.

GUID is in HKLM\SOFTWARE\Microsoft\CurrentVersion\NetworkCards\

Under that is numbered Keys containing the entry ServiceName; its value is the GUID needed.

Let me see what I can do...

superboyac

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 6,347
    • View Profile
    • Donate to Member
Thanks Stoic, for whatever you're trying to do!

wraith808

  • Supporting Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 11,186
    • View Profile
    • Donate to Member
Okay, scratch that last part, apparently I'm F'ing retarded ... I missed the use GUID for your NIC part.

GUID is in HKLM\SOFTWARE\Microsoft\CurrentVersion\NetworkCards\

Under that is numbered Keys containing the entry ServiceName; its value is the GUID needed.

Let me see what I can do...

Thanks for picking that up SJ... I would, if I wasn't swamped with 2 projects, because it looks interesting! :)

Stoic Joker

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 6,646
    • View Profile
    • Donate to Member
This had the appearance of a 5 minute job ... I did mention I was retarded right. :-\

Okay, seriously, Currently I have it setup to pass the GUID to the program via the command line
i.e. WiFi.exe 261AAE34-9C9D-40EB-A25C-CFEDF328E3CF

That part works just dandy. But... I can't get the damn thing to close because of the psudo message loop that has no apparent exit plan.

The program doesn't work without it.

So I'm trying to find some way of reliably torpedoing the damn message loop so I can put a bow on this thing.

Stoic Joker

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 6,646
    • View Profile
    • Donate to Member
Okay, it's almost midnight, so I resorted to duct tape:
Wait 2 sec for window to open.
Call FindWindow(...) in a loop to prop the door open with a stick.

It works, but I'll have to find something better later when I have time.

Usage:
Get the GUID for your WiFi card from the registry.
GUID is in HKLM\SOFTWARE\Microsoft\CurrentVersion\NetworkCards\

Under that are numbered Keys containing the entry ServiceName; its value is the GUID needed.
Grab only the alpha-numeric string (No curly brackets {}).

command line or Shortcut target is (example with my GUID):

WiFi.exe 261AAE34-9C9D-40EB-A25C-CFEDF328E3CF

Download removed - current version is later in thread.

Let me know how it works.
« Last Edit: January 30, 2011, 11:03 AM by Stoic Joker »

worstje

  • Honorary Member
  • Joined in 2009
  • **
  • Posts: 588
  • The Gent with the White Hat
    • View Profile
    • Donate to Member
Stoic Joker, does whatever you use to call the window open it asynchronously on its own thread, inside of your process? E.g. does your message loop actually matter and do stuff, or could you have used a Sleep(10000) and still have stuff basically function till the loop runs out and kills the app after 10s? In that case I might have a solution as I already bumped into such a problem once in the past.