| CodeGuru Home | VC++ / MFC / C++ | .NET / C# | Visual Basic | Newsletters | VB Forums | Developer.com |
|
|||||||
| C++ and WinAPI Discuss Windows API related issues using C++ (and Visual C++). This is a non-MFC forum. |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
ask how to disable internet connection
hai guyz, i have an idea : how to disable an internet connection ?? i've try to search in msdn, but have no clue in there.
thanx 4 the answer....
|
|
#2
|
|||
|
|||
|
Re: ask how to disable internet connection
What do you mean with disable? Please explain.
Cheers
__________________
If a post helped you dont forget to "Rate This Post" My Article: Capturing Windows Regardless of Their Z-Order Cheers |
|
#3
|
|||
|
|||
|
Re: ask how to disable internet connection
Quote:
i hope it clear you... ![]() regards... |
|
#4
|
|||
|
|||
|
Re: ask how to disable internet connection
Do you wan't to disable internet access completely or just block some programs?
The easiest way has to be to install ZoneAlarm or similar software.
|
|
#5
|
|||
|
|||
|
Re: ask how to disable internet connection
Quote:
![]() Problem is i can't see the function in MSDN library to disable internet connection. regards... |
|
#6
|
|||
|
|||
|
Re: ask how to disable internet connection
IMO you can't block internet connection. But you can try to block every program that asks for internet connection.
__________________
Winapizone.net. [WinAPI] OwnerDraw buttons with images [WinAPI] OwnerDraw menus with images and titles See you space cowboy... |
|
#7
|
|||
|
|||
|
Re: ask how to disable internet connection
You can disable your NIC (Network Interface Card).
Here is an example (The code could use some work/error checking but it's a start for you). Code:
#include <netcon.h>
void DisableNIC(char* InterfaceName)
{
INetConnectionManager* pNet;
INetConnection* pConn;
IEnumNetConnection* pEnum;
NETCON_PROPERTIES* pProps;
wchar_t Temp[255];
ULONG uCount = 0;
swprintf(Temp, L"%S", InterfaceName);
CoInitialize(NULL);
CoCreateInstance(CLSID_ConnectionManager, NULL, CLSCTX_SERVER, IID_INetConnectionManager, (void**)&pNet);
pNet->EnumConnections(NCME_DEFAULT, &pEnum);
while (pEnum->Next(1, &pConn, &uCount) == S_OK)
{
pConn->GetProperties( &pProps );
if (!wcscmp(pProps->pszwName, Temp))
{
printf("Found %S\n", pProps->pszwName);
printf("Going to disable connection now!\n");
pConn->Disconnect();
printf("Disabled!");
CoTaskMemFree(pProps->pszwName);
CoTaskMemFree(pProps->pszwDeviceName);
CoTaskMemFree(pProps);
pConn->Release();
}
}
pEnum->Release();
pNet->Release();
CoUninitialize();
}
- Tom Last edited by zeRoau; November 21st, 2006 at 06:57 AM. |
|
#8
|
|||
|
|||
|
Re: ask how to disable internet connection
This code will 'disable an internet connection' - is it what you are looking for?
Code:
#include "IpExport.h" #include "Iphlpapi.h" #pragma comment(lib,"iphlpapi") ... // Call GetInterfaceInfo() with empty buffer to get the required size. ULONG ulInfoLength = 0; ::GetInterfaceInfo(0,&ulInfoLength); // Allocate buffer for PIP_INTERFACE_INFO LPBYTE pInfoBuffer = new BYTE[ulInfoLength]; PIP_INTERFACE_INFO pInfo = (PIP_INTERFACE_INFO)pInfoBuffer; // Call GetInterfaceInfo() with valid buffer to get the actual data ::GetInterfaceInfo(pInfo,&ulInfoLength); // Release adapters for( LONG i=0; i<pInfo->NumAdapters; ++i ) ::IpReleaseAddress(&pInfo->Adapter[i]); // Delete the IP_INTERFACE_INFO buffer delete [] pInfoBuffer; |
|
#9
|
|||
|
|||
|
Re: ask how to disable internet connection
Quote:
cherrssss....
|
|
#10
|
|||
|
|||
|
Re: ask how to disable internet connection
Quote:
regards....
|
|
#11
|
|||
|
|||
|
Re: ask how to disable internet connection
Quote:
and i think this is coolll.... ![]() regards.... |
|
#12
|
||||
|
||||
|
Re: ask how to disable internet connection
Quote:
__________________
I am not offering technical guidiance via email or IM Come on share your photo with us! CG members photo album! Use the Code Tags! |
|
#13
|
|||
|
|||
|
Re: ask how to disable internet connection
Quote:
|
|
#14
|
|||
|
|||
|
Re: ask how to disable internet connection
I've got a question concerning this problem, too, or should I better open a new thread?
How do I disable the internet connection for one program? And no, I do not want to install a firewall, its only for one program/process. |
![]() |
| Bookmarks |
|
||||||
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|