Turbo Screen Sharing
Adobe Acrobat Connect Professional offers users the ability to have a more productive and engaging web conferencing experience while providing the IT department with a program that efficiently utilizes bandwidth and minimally impacts the infrastructure. Learn More!
»
Rapid E-Learning: Maturing Technology Brings Balance and Possibilities
Rapid e-learning addresses both time and cost issues by using technology tools to shift the dynamics of e-learning development. Learn why more skilled learning professionals use these tools and how you can get a solution to keep pace with your business demands. »
Delivering on the Promise of ELearning
This white paper defines the framework to launch e-learning as a set of teaching, training, and learning practices not bound by a specific technology platform or learning management system. It offers practical suggestions for creating digital learning experiences that engage learners by building interest and motivation and providing opportunities for active participation. »
Remote Access Service (RAS), also as "Dial-Up Networking" in Windows 95/98, lets users at
remote locations work as if connected directly to a computer network, accessing one or more
RAS servers.
The Microsoft® Win32® RAS API enables RAS client applications to perform the
tasks such as display RAS common dialog boxes, start and end a RAS connection, operate to
phone-book, work with entries in the RAS AutoDial mapping database, and get RAS information,
etc. For Windows NT version 4.0, the Win32 API also provides support for RAS server
administration and connection management. Windows 95 does not provide RAS server support.
This Article introduces a RAS client class, CRasClient, which wraps the client part
functions of RAS API, and supports for both Windows 95/98 and NT4.0. In order to make your
application using CRasClient works on both Windows 95/98 and Windows NT4.0, instead of
wrapping some RAS API functions like RAS common dialog boxes, phone-book (.PBK) file
operation, the class doesn't include the functions which only work on Windows NT4.0. S
you don't need to worry about the operating system when you include this class in your
application. And it is easy to add Dial-Up Networking common dialog boxes, such as
establishing and monitoring connections, or working with phone-book entries, by yourself in
your application.
The functions CRasClient supported include:
Create Phone-book entry, and set the properties.
Get information about RAS-capable devices configured on the local computer.
Start and end RAS connection operation.
Get information about existing RAS connections
Get error message and notifications when a RAS connection begins or ends.
To add the support of Dial-Up Networking to your application, normally you need to implement the tasks as following:
Create a phone-book entry for dialing up.
Set the phone-book entry properties, like phone number, user name, device to use for dialing, dial-up server type, network protocol, etc... just like you set your Dial-up Networking in your desktop.
Start to dial, and try to make connection.
End your connection.
How to use CRasClient class?
Simply add CRasClient.h and CRasClient.cpp to your project, make an instance of the class, and call the functions you need. You don't need to add the library "rasapi32.lib" to your project setting.
About Demo Project
The demo project, "RasDemo", sets up a PPP dial-up networking connection with a Dial-Up Server (Windows 95/98), or RAS Server (Windows NT4.0) using modem connection. After connect, two computers will be able to see each other just like wire network. The protocol "RasDemo" uses is NetBEUI, dial-up server type is PPP.
How to run RasDemo?
Setup your Dial-Up Server. For Windows 95/98, go to "My Computer/Dial-Up Networking", under the menu "Connections", you can find "Dial-Up Server...". You shall have Windows 95 Plus! or Windows 98 installed to have this server. Also make your Dial-Up Adapter attached to NetBEIU in your computer's network setting, and "File and Print Sharing" enabled.
Run RasDemo, enter the phone number you use to dial, click "Connect". If it connects successfully, you will see the dial-up networking monitor icon on task tray, if not, you will get error messages.
How RasDemo works?
When RasDemo Dialog box appears, the modem names which RAS can use to dial fill a combo box, the function CRasDemoDlg::FillModemCombo() is called.
BOOL CRasDemoDlg::FillModemCombo()
{
int iModemCount = m_pRas->GetModemCount();
if(iModemCount == 0)
{
m_strStatus = "There is no modem installed in your computer!";
return FALSE;
}
elseif(iModemCount < 0)
{
m_strStatus = "Fail to get modem count!";
return FALSE;
}
CString* strName = new CString[iModemCount];
BOOL bResult = m_pRas->GetModemName(strName);
if(bResult)
{
for(int i = 0; i < iModemCount; i++)
m_ctrlModem_Combo.AddString(strName[i]);
m_ctrlModem_Combo.SetCurSel(0);
UpdateData(TRUE);
}
else
m_strStatus = "Fail to get Modem name!";
delete []strName;
return bResult;
}
When you click the button "Connect", the code below shows what happens.
void CRasDemoDlg::OnConnectBtn()
{
// TODO: Add your control notification handler code here
m_bUserCancel = FALSE;
GetDlgItem(IDC_CONNECT_BTN)->EnableWindow(FALSE);
CString strEntry = "My Network";
HRASCONN hrasConn;
if(CreateDialUpEntry())
{
if(!m_pRas->GetRasConnection(strEntry, hrasConn))
{
if(!DialUpNetwork())
{
GetDlgItem(IDC_CONNECT_BTN)->EnableWindow(TRUE);
}
}
}
}
It tries to create a new entry call "My Network" in your default phone-book, and set the properties.
Then check to see if the connection is already existed for that entry. If not, try to make an asynchronous dial operation: the call returns immediately. You shall supply a callback function, we call rasCallback1 here. Before the connection is established, the window also shows the text messages about the dialing progress.
If you click the "Cancel" to disconnect the connection, it calls CRasClient::HangupConnection(CString strEntry) to disconnect.
Environment:
The Win32 RAS functions are in RASAPI32.DLL. You can revise CRasClient to load this DLL explicitly by using LoadLibrary if RAS is not installed. Shall you want to know how to do this to CRasClient, drop me a mail.
CRasClient is tested under Windows 95, Windows 98, and Windows NT 4.0 SP3 using modem connection. Built by Visual C++ 5.0.
Add www.codeguru.com to your favorites Add www.codeguru.com to your browser search box IE 7 | Firefox 2.0 | Firefox 1.5.xReceive news via our XML/RSS feed