About WRL function argument of IVectorView

zheng cheng 1 Reputation point
2024-09-05T10:10:43.1033333+00:00

Hi All,

I‘m developing a desktop application (MFC), but I need to use mobile hotspot feature.

Now i can start tethering by WRL API, but when I try get the tethering client info. I find the interface like below. It's so complex, I don't know how to make the right argument of IVectorView, I didn't find any useful info in the web. Can someone give me some hint?

Thank you very much

                INetworkOperatorTetheringClientManager : public IInspectable
                {
                public:
                    virtual HRESULT STDMETHODCALLTYPE GetTetheringClients(
                        __FIVectorView_1_Windows__CNetworking__CNetworkOperators__CNetworkOperatorTetheringClient** value
                        ) = 0;
                };

typedef IVectorView<ABI::Windows::Networking::NetworkOperators::NetworkOperatorTetheringClient*> __FIVectorView_1_Windows__CNetworking__CNetworkOperators__CNetworkOperatorTetheringClient_t;
#define __FIVectorView_1_Windows__CNetworking__CNetworkOperators__CNetworkOperatorTetheringClient ABI::Windows::Foundation::Collections::__FIVectorView_1_Windows__CNetworking__CNetworkOperators__CNetworkOperatorTetheringClient_t


Windows
Windows
A family of Microsoft operating systems that run across personal computers, tablets, laptops, phones, internet of things devices, self-contained mixed reality headsets, large collaboration screens, and other devices.
5,325 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Neuvi Jiang 1,150 Reputation points Microsoft Vendor
    2024-09-06T02:57:08.27+00:00

    Hi zheng cheng,

    Thank you for posting in the Microsoft Community Forums.

    ComPtr<IVectorView<NetworkConnectionProfile^>> profilesView;

    // Assuming you've got the profilesView here somehow

    UINT32 size = 0;

    profilesView->get_Size(&size);

    for (UINT32 i = 0; i < size; ++i)

    {

    ComPtr<NetworkConnectionProfile> profile;  
    
    HRESULT hr = profilesView->GetAt(i, &profile);  
    
    if (SUCCEEDED(hr))  
    
    {  
    
        // Now you can use the profile, e.g. get its name  
    
        hstring profileName;  
    
        hr = profile->GetProfileName(profileName.GetAddressOf());  
    
        if (SUCCEEDED(hr))  
    
        {  
    
            wprintf(L “Profile Name: %s\n”, static_cast<const wchar_t*>(profileName.Get()));  
    
        }  
    
    }  
    

    }

    Best regards

    Neuvi

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.