I'm wondering if there is a way other than executing cmd commands in my windows form app to enable or configure an ad hoc network in windows 10?
I'm looking for a direct way like using windows's own libraries which the cmd command for ad hoc (netsh wlan hostednetwork) uses to configure the network.
Note: I don't want to execute cmd commands in my app.
What I have tried:
I've used cmd execution in my app and worked.
command like:
wlan netsh hostednetwork
but I don't want that black cmd console to be displayed over my app frequntly.
Any help will be appreciated.
Based on my research, you can refer to the following link to know use winapi to Start the wireless Hosted Network.
User and Application Access to Wireless Hosted Network
However, we find that the function(such as
WlanHostedNetworkForceStart) is c++ code.Therefore, we can add nuget-package
Vanara.PInvoke.WlanApito c# in the winform app.Then, we can call the code like the following.