My user has Windows 11 pro, I do not.
The issue is that he has 2 networks with the same name, at work "PGNET" and at home "pgnet"
The following code retrieves PGNET when the wireless is connected to pgnet at home.
Code: Select all
CLSID_NetworkListManager := "{DCB00C01-570F-4A9B-8D69-199FDBA5723B}"
NLM_ENUM_NETWORK_CONNECTED := 1
NetworkListManager := ComObjCreate(CLSID_NetworkListManager)
for NetWork in NetworkListManager.GetNetworks(NLM_ENUM_NETWORK_CONNECTED)
{
INetWork := ComObjValue(NetWork)
DllCall(NumGet(NumGet(INetWork + 0) + A_PtrSize*9), "Ptr", INetWork, "PtrP", pWStr)
NetworkName := StrGet(pWStr, "UTF-16") ;get network name
DllCall("OleAut32\SysFreeString", "Ptr", pWStr)
}
MsgBox % NetworkName
Can someone that has windows 11 pro try the above code and see if it retrieves the correct network after you have connected to both networks with the same name but different case?
Other than his computer being windows 11 pro, I can not imagine why this code would not work properly.