CUT_RAS::HangUp

Dundas

CUT_RAS::HangUp

Members | Overview

int HangUp()
int HangUp(HRASCONN rasConn)

Parameters

rasConn

A RAS connection handle.

Return Value

UTE_SUCCESS

Successfully hung up the connection or it was not connected to begin with.

UTE_RAS_HANDLE_ERROR

NULL RAS handle supplied.

UTE_RAS_LOAD_ERROR

Unable to load the RAS DLLs.

Remarks

Call this function to hang up a currently active RAS connection. If rasConn is not specified then the function attempts to hang up the current connection that was initiated with the Dial function.  Otherwise it will hang up the specified RAS connection by using the supplied RAS connection handle.

RAS connection handles can be retrieved using the EnumConnections function. 

Once the hang-up process starts this function will wait until the hang-up is complete. Hang-up times vary and depend on the modem. Usually 1-3 seconds is the norm. 

If the hang-up status cannot be monitored (which is the case on some older versions of Win95) then a 4 second waiting period is applied to ensure a proper hang-up.

Example

//hangs up a specified connection

void CTestAppDlg::OnHangUp()

{

RASCONN rConection;

int index= 0;

 

//if we are currently trying to connect then exit the connection attempt

m_ras.CancelDial();

 

//Get the Selected connection out of the ComboBox

index = m_ctlConnections.GetCurSel();

if (index != LB_ERR && index < m_ctlConnections.GetCount())

{

m_ras.GetConnection(&rConection,index);

m_ras.HangUp(rConection.hrasconn);

}

else

m_ras.HangUp();

 

//display the connections

CComboBox* cb3 = (CComboBox*)GetDlgItem(IDC_COMBO3);

cb3->ResetContent();

cb3->SetWindowText("");

m_ras.EnumConnections();

int cnt = m_ras.GetConnectionCount();

RASCONN rc;

for(int x = 0; x < cnt; x++){

m_ras.GetConnection(&rc,x);

cb3->AddString(rc.szEntryName);

}

cb3->SetCurSel(0);

}