Recently had a small project that needed me to launch a connection wizard from a small application. There are a few different ways to launch the wizard on Vista manually so this was a "Gee Whiz" creature comfort feature. Started digging thru the MSDN and found my answer. Its as simple as pie, so if anyone wants to know how to do this:
Code: Select all
;Get Connected Wizard API for PureBasic
;see for details: http://msdn.microsoft.com/en-us/library/aa364732(VS.85).aspx
;Windows Vista only !
;//////////////////////////////////////////
; returns if connected to internet or not
;/////////////////////////////////////////
Procedure Internet_Connected()
ret.l
Libef = LoadLibrary_("Connect.dll")
If Libef
*Inet_Connected = GetProcAddress_(Libef, "IsInternetConnected")
If *Inet_Connected
If CallFunctionFast(*Inet_Connected) = #S_OK
ret = 1
EndIf
EndIf
EndIf
FreeLibrary_(Libef)
ProcedureReturn ret
EndProcedure
Debug Internet_Connected()
;///////////////////////////
; Creates a VPN connection
;///////////////////////////
Procedure Create_VPNConnect(in_hwndParent.l, in_dwWizardType.l, in_dwContextFlags.l, in_dwUserFlags.l, in_hUserContext.l, in_opt_pszCommandLine)
ret.l
Libef = LoadLibrary_("Connect.dll")
If Libef
*VPNConnect = GetProcAddress_(Libef, "CreateVPNConnection")
If *VPNConnect
If CallFunctionFast(*VPNConnect, in_hwndParent.l, in_dwWizardType.l, in_dwContextFlags.l, in_dwUserFlags.l, in_hUserContext.l, in_opt_pszCommandLine) = #S_OK
ret = 1
EndIf
EndIf
EndIf
FreeLibrary_(Libef)
ProcedureReturn ret
EndProcedure
Debug Create_VPNConnect(hwndParent.l, dwWizardType.l, dwContextFlags.l, dwUserFlags.l, hUserContext.l, opt_pszCommandLine)
;////////////////////////////////////////////////////////////
;Below launches Internet, Network, and VPN connection wizards
;////////////////////////////////////////////////////////////
;Internet connection wizard
Procedure GetInet_Connect(in_hwndParent.l, in_dwWizardType.l, in_dwContextFlags.l, in_dwUserFlags.l, in_hUserContext.l, in_opt_pszCommandLine)
ret.l
Libef = LoadLibrary_("Connect.dll")
If Libef
*G_Inet_Connect = GetProcAddress_(Libef, "GetInternetConnected")
If *G_Inet_Connect
If CallFunctionFast(*G_Inet_Connect, in_hwndParent.l, in_dwWizardType.l, in_dwContextFlags.l, in_dwUserFlags.l, in_hUserContext.l, in_opt_pszCommandLine) = #S_OK
ret = 1
EndIf
EndIf
EndIf
FreeLibrary_(Libef)
ProcedureReturn ret
EndProcedure
Debug GetInet_Connect(#Null, 0, 0, 0, #Null, #Null)
;network connection wizard
Procedure GetNetwork_Connect(in_hwndParent.l, in_dwWizardType.l, in_dwContextFlags.l, in_dwUserFlags.l, in_hUserContext.l, in_opt_pszCommandLine)
ret.l
Libef = LoadLibrary_("Connect.dll")
If Libef
*G_Net_Connect = GetProcAddress_(Libef, "GetNetworkConnected")
If *G_Net_Connect
If CallFunctionFast(*G_Net_Connect, in_hwndParent.l, in_dwWizardType.l, in_dwContextFlags.l, in_dwUserFlags.l, in_hUserContext.l, in_opt_pszCommandLine) = #S_OK
ret = 1
EndIf
EndIf
EndIf
FreeLibrary_(Libef)
ProcedureReturn ret
EndProcedure
Debug GetNetwork_Connect(#Null, 0, 0, 0, #Null, #Null)
;VPN connection wizard
Procedure GetVPN_Connect(in_hwndParent.l, in_dwWizardType.l, in_dwContextFlags.l, in_dwUserFlags.l, in_hUserContext.l, in_opt_pszCommandLine)
ret.l
Libef = LoadLibrary_("Connect.dll")
If Libef
*G_VPN_Connect = GetProcAddress_(Libef, "GetVPNConnected")
If *G_VPN_Connect
If CallFunctionFast(*G_VPN_Connect, in_hwndParent.l, in_dwWizardType.l, in_dwContextFlags.l, in_dwUserFlags.l, in_hUserContext.l, in_opt_pszCommandLine) = #S_OK
ret = 1
EndIf
EndIf
EndIf
FreeLibrary_(Libef)
ProcedureReturn ret
EndProcedure
Debug GetVPN_Connect(#Null, 0, 0, 0, #Null, #Null)