Initial
This commit is contained in:
42
rasapi/MAIN.CPP
Normal file
42
rasapi/MAIN.CPP
Normal file
@@ -0,0 +1,42 @@
|
||||
#include <rasapi/rasapi.hpp>
|
||||
#include <rasapi/rassrv.hpp>
|
||||
#include <rasapi/dialparm.hpp>
|
||||
|
||||
WORD findEntry(Block<RasEntryName> &rasEntryNames,RasEntryName &rasEntryName);
|
||||
|
||||
int PASCAL WinMain(HINSTANCE /*hInstance*/,HINSTANCE /*hPrevInstance*/,LPSTR /*lpszCmdLine*/,int /*nCmdShow*/)
|
||||
{
|
||||
RemoteAccessServer remoteServerInterface;
|
||||
RasConnectionStatus rasConnectionStatus;
|
||||
RasConnectionState rasConnectionState;
|
||||
RasDialParams rasDialParams;
|
||||
Block<RasEntryName> entryNames;
|
||||
RasEntryName rasEntryName;
|
||||
HRASCONN hRasConn(0);
|
||||
|
||||
if(!remoteServerInterface.isOkay())return FALSE;
|
||||
remoteServerInterface.rasEnumEntries(entryNames);
|
||||
if(!entryNames.size())return FALSE;
|
||||
rasEntryName.entryName("Long Island Link");
|
||||
if(!findEntry(entryNames,rasEntryName))return FALSE;
|
||||
rasDialParams.entryName(rasEntryName.entryName());
|
||||
rasDialParams.phoneNumber("");
|
||||
rasDialParams.callbackNumber("");
|
||||
rasDialParams.userName("sean");
|
||||
rasDialParams.password("Cygnus");
|
||||
rasDialParams.domain("");
|
||||
if(remoteServerInterface.rasDial(0,0,&((tagRASDIALPARAMSA&)rasDialParams),0,0,&hRasConn))return FALSE;
|
||||
remoteServerInterface.rasGetConnectStatus(hRasConn,rasConnectionStatus);
|
||||
rasConnectionState=rasConnectionStatus.rasConnectionState();
|
||||
if(!rasConnectionState.connected())::MessageBox(::GetFocus(),(LPSTR)"No connection.",(LPSTR)rasDialParams.entryName(),MB_OK);
|
||||
remoteServerInterface.rasHangUp(hRasConn);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
WORD findEntry(Block<RasEntryName> &rasEntryNames,RasEntryName &rasEntryName)
|
||||
{
|
||||
for(short entryIndex=0;entryIndex<rasEntryNames.size();entryIndex++)
|
||||
if(rasEntryNames[entryIndex].entryName()==rasEntryName.entryName())return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user