#include #include #include WORD findEntry(Block &rasEntryNames,RasEntryName &rasEntryName); int PASCAL WinMain(HINSTANCE /*hInstance*/,HINSTANCE /*hPrevInstance*/,LPSTR /*lpszCmdLine*/,int /*nCmdShow*/) { RemoteAccessServer remoteServerInterface; RasConnectionStatus rasConnectionStatus; RasConnectionState rasConnectionState; RasDialParams rasDialParams; Block 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 &rasEntryNames,RasEntryName &rasEntryName) { for(short entryIndex=0;entryIndex