CRAS is an MFC class that incapsulates Windows Remote Access Service procedures.
The main CRAS advantage is that it can be used on computers that are connected
to the Internet via LAN and do not have RAS installed, since it loads RAS DLLs
dynamically.
Create CRAS class instance
Within your code create CRAS class instance and add initialization method
calls:
BOOL CRAS::Initialize();
This procedure returns a boolean value indicating whether initialization was
successfull. FALSE as it's return value in most cases means that RAS was not
installed on this computer.
RAS phonebook access
While initializing CRAS retrieves all Windows phonebook entries and stores them
in the private class member; you later can access them with
BOOL CRAS::GetEntryCount();
CString CRAS::GetEntry(ULONG ulIndex);
function members. This can be usefull, e.x., if you want to fill a combobox or
listbox where user will be able to select an entry to dial.
Dial an entry
When using these methods compression and extraction are performed with some
predefined parameters set in:
BOOL CRAS::Dial
(
CString sEntry,
CString sUserName,
CString sPassword,
CRASCallback pfnCallback,
CString sDomain
);
BOOL CRAS::HangUp();
where sEntry is a phonebook entry to dial, sUserName and sPassword are login and
password you are logging into network, and sDomain is required in some cases
when you are dialing Windows NT dialup server. CRASCallback type is a pointer to
a callback function that will be used when a RAS event (state change in most
cases) occures; you can submit NULL in this parameter if you do not need it.
Interested?
We've got more great code for you! Check our Alchemy DBF Access - the smart
library for any development tool that brings full database access for your
programs and just few kilobytes to your executable!
Alchemy DBF Access
Download CRAS source code