Help me DisConnect Internet use Ras
-
#include "stdio.h"
#include "conio.h"
#include "windows.h"
#include "Wininet.h"
#include "Ras.h"
#include "raserror.h"
#pragma comment(lib, "rasapi32.lib")int main()
{
LPRASCONN lpRasConn;
DWORD dwCb=0;
DWORD dwRet;
DWORD dwConnections = 0;
HRASCONN hRasConn;lpRasConn = (LPRASCONN) HeapAlloc(GetProcessHeap(), HEAP\_ZERO\_MEMORY, dwCb); lpRasConn\[0\].dwSize=sizeof(RASCONN) ; dwRet = RasEnumConnections(lpRasConn, &dwCb, &dwConnections); if(dwRet==ERROR\_SUCCESS) for(int i=0 ; i < dwConnections ; i++) { hRasConn= lpRasConn\[i\].hrasconn; BOOL b=RasHangUp(hRasConn); }
// HeapFree(GetProcessHeap(), 0, lpRasConn);
_getch();}
i don't know where was it wrong? sorry if my english is not well :laugh:
-
#include "stdio.h"
#include "conio.h"
#include "windows.h"
#include "Wininet.h"
#include "Ras.h"
#include "raserror.h"
#pragma comment(lib, "rasapi32.lib")int main()
{
LPRASCONN lpRasConn;
DWORD dwCb=0;
DWORD dwRet;
DWORD dwConnections = 0;
HRASCONN hRasConn;lpRasConn = (LPRASCONN) HeapAlloc(GetProcessHeap(), HEAP\_ZERO\_MEMORY, dwCb); lpRasConn\[0\].dwSize=sizeof(RASCONN) ; dwRet = RasEnumConnections(lpRasConn, &dwCb, &dwConnections); if(dwRet==ERROR\_SUCCESS) for(int i=0 ; i < dwConnections ; i++) { hRasConn= lpRasConn\[i\].hrasconn; BOOL b=RasHangUp(hRasConn); }
// HeapFree(GetProcessHeap(), 0, lpRasConn);
_getch();}
i don't know where was it wrong? sorry if my english is not well :laugh:
The
for
loop is wrong. It looks incomplete.«_Superman_»
I love work. It gives me something to do between weekends. -
The
for
loop is wrong. It looks incomplete.«_Superman_»
I love work. It gives me something to do between weekends.can you help me indicate that error...i don't know plz :-O
-
can you help me indicate that error...i don't know plz :-O
:omg: It looks OK now. I guess something is wrong with me today. :^)
«_Superman_»
I love work. It gives me something to do between weekends. -
#include "stdio.h"
#include "conio.h"
#include "windows.h"
#include "Wininet.h"
#include "Ras.h"
#include "raserror.h"
#pragma comment(lib, "rasapi32.lib")int main()
{
LPRASCONN lpRasConn;
DWORD dwCb=0;
DWORD dwRet;
DWORD dwConnections = 0;
HRASCONN hRasConn;lpRasConn = (LPRASCONN) HeapAlloc(GetProcessHeap(), HEAP\_ZERO\_MEMORY, dwCb); lpRasConn\[0\].dwSize=sizeof(RASCONN) ; dwRet = RasEnumConnections(lpRasConn, &dwCb, &dwConnections); if(dwRet==ERROR\_SUCCESS) for(int i=0 ; i < dwConnections ; i++) { hRasConn= lpRasConn\[i\].hrasconn; BOOL b=RasHangUp(hRasConn); }
// HeapFree(GetProcessHeap(), 0, lpRasConn);
_getch();}
i don't know where was it wrong? sorry if my english is not well :laugh:
thanhl0v3 wrote:
i don't know where was it wrong?
Neither do we. Why don't you bother telling is what is happening vs. what is supposed to happen.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
-
#include "stdio.h"
#include "conio.h"
#include "windows.h"
#include "Wininet.h"
#include "Ras.h"
#include "raserror.h"
#pragma comment(lib, "rasapi32.lib")int main()
{
LPRASCONN lpRasConn;
DWORD dwCb=0;
DWORD dwRet;
DWORD dwConnections = 0;
HRASCONN hRasConn;lpRasConn = (LPRASCONN) HeapAlloc(GetProcessHeap(), HEAP\_ZERO\_MEMORY, dwCb); lpRasConn\[0\].dwSize=sizeof(RASCONN) ; dwRet = RasEnumConnections(lpRasConn, &dwCb, &dwConnections); if(dwRet==ERROR\_SUCCESS) for(int i=0 ; i < dwConnections ; i++) { hRasConn= lpRasConn\[i\].hrasconn; BOOL b=RasHangUp(hRasConn); }
// HeapFree(GetProcessHeap(), 0, lpRasConn);
_getch();}
i don't know where was it wrong? sorry if my english is not well :laugh:
Hi,
thanhl0v3 wrote:
dwCb=0; // ... lpRasConn = (LPRASCONN) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwCb);
You allocate a block of zero size, so it's unlikely useful :) cheers, AR
When the wise (person) points at the moon the fool looks at the finger (Chinese proverb)