A reusable RAS class

Source: Internet
Author: User

This article supporting source code

CRAs is an MFC class that encapsulates the remote Access service for Windows. The main advantage of this class is that you can connect to the Internet over a LAN, and you do not have to install RAS because the RAS DLLs are loaded dynamically.

The use of CRAs is very simple. Add the CRAs file to the project, create a CRAs class instance, and call its Initialize method.

BOOL cras::initialize

This call returns a Boolean value that indicates whether the initialization was successful. If False, most of the cases are because the RAS is not installed.

After the initialization is completed, CRAs gets the Windows Address book entry by calling the following member function and stores it in a private member variable for later use.

BOOL CRAS::GetEntryCount();
CString CRAS::GetEntry(ULONG ulIndex);

These two functions are useful, for example, you can use them to get a fill combo box or list box, and the user can select a dial-up entry.

If you need to dial or hang a line, you can use the following function:

BOOL CRAS::Dial (
CString sEntry,
CString sUserName,
CString sPassword,
CRASCallback pfnCallback,
CString sDomain );
BOOL CRAS::HangUp();

SEntry for dial-up Address book entry, sUserName and Spassword to log on to the network username and password, sdomain the parameters you must use to dial to a Windows NT dial-up server. A crascallback is a pointer to a callback function that is invoked when a RAS event (mostly a state change) occurs, and if it is not needed, it can set its value to null.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.