Click here to Skip to main content
15,896,201 members
Articles / Programming Languages / C++

3G Modem Internet Dialer

Rate me:
Please Sign up or sign in to vote.
4.90/5 (88 votes)
13 Jul 2011CPOL7 min read 777.5K   65.9K   192  
3G Modem Internet Dialer
#pragma once

#include <iostream>
#include <ras.h>
#include <raserror.h>

class CMyRAS
{
public:
	CMyRAS(void);
	~CMyRAS(void);

	int CheckIfAnyExistingConnection(void);
	int GetEntriesCount(void) {return m_iEntriesCount;};

	BOOL HangUp(void);	
	BOOL isDialing(void);
	BOOL isConnected(void);
	BOOL Initialize(CWnd* pEventWnd);
	BOOL Dial(CString sEntry, CString sUser, CString sPassword);
	BOOL GetDialErrorMsg(DWORD dwError, CString &sMsg);
	BOOL GetConnectionStatistics(DWORD &dwBytesXmited, DWORD &dwBytesRcved, DWORD &dwConnectDuration);
	RASCONNSTATE GetConnectionStatus(void);

	CString GetEntry(int iIndex) const;

	static VOID WINAPI RasDialEventNotifier (UINT unMsg, RASCONNSTATE rasconnstate, DWORD dwError);


private:
	int m_iEntriesCount;

	CString *m_psEntriesNames;

	static HRASCONN m_hRasConn;
	static CWnd* m_pEventWnd;
	static BOOL m_bConnected;
	static BOOL m_bDialing;
};

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
United States United States
I love coding with C++. I always split my free time between coding and gaming Smile | :)

Comments and Discussions