Click here to Skip to main content
15,885,919 members
Articles / Desktop Programming / MFC

Internet dialup program

Rate me:
Please Sign up or sign in to vote.
3.12/5 (16 votes)
2 Dec 1999 293.4K   10.7K   45  
A dial-up dialer for connection to Internet providers
///////////////////////////////////////////////////////////////////////
// If this program works, it was written by Alexander Fedorov.
// If not, I don't know who wrote it.
// mailto:lamer2000@hotmail.com
// Home Page: http://members.xoom.com/lamer2000/
// This file is part of Alexf Dialer.
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
///////////////////////////////////////////////////////////////////////

// stdafx.cpp : source file that includes just the standard includes
//	Afd.pch will be the pre-compiled header
//	stdafx.obj will contain the pre-compiled type information

#include "stdafx.h"

char gchMain[] = "Main";
char gchRedialWhenHangUp[] = "RedialWhenHangUp";
char gchLogFile[] = "LogFile";
char gchPingTime[] = "PingTime";
char gchMinSpeed[] = "MinSpeed";
char gchTermKB[] = "TermKB";
char gchTermTime[] = "TermTime";
char gchMaxWaitTime[] = "MaxWaitTime";
char gchPulseDialing[] = "PulseDialing";
char gchEnableTerminateWhenExit[] = "EnableTerminateWhenExit";
char gchEnableLogFile[] = "EnableLogFile";
char gchEnablePing[] = "EnablePing";
char gchEnableMinSpeed[] = "EnableMinSpeed";
char gchEnableTerminateLowSpeed[] = "EnableTerminateLowSpeed";
char gchEnableTimeout[] = "EnableTimeout";
char gchInterfaceStartMinimized[] = "InterfaceStartMinimized";
char gchInterfaceMinimizeOnConnect[] = "InterfaceMinimizeOnConnect";
char gchHidePassword[] = "HidePassword";

CString GetRegKey(HKEY hOpen, CString key1,CString key2)
{
	HKEY hkey;
	LONG l = RegOpenKeyEx(hOpen, key1, 0, KEY_READ, &hkey);
	if (l != ERROR_SUCCESS) return "";
	CString sss;
	ULONG LS = _MAX_PATH;
	DWORD lpType = REG_EXPAND_SZ;

	l = RegQueryValueEx(hkey, key2, NULL,
	& lpType, (unsigned char *) sss.GetBuffer(LS), & LS);
	sss.ReleaseBuffer();
	RegCloseKey(hkey);
	if (l != ERROR_SUCCESS) return "";
	return sss;
}

CString L2S(LONG l)
{
	CString sss;
	sprintf(sss.GetBuffer(512), "%ld", l);
	sss.ReleaseBuffer();
	return sss;
}

CString D2S_2(double d)
{
	CString sss;
	sprintf(sss.GetBuffer(512), "%.2f", d);
	sss.ReleaseBuffer();
	return sss;
}

void PrintError()
{
	DWORD dw = GetLastError();
	LPVOID lpMsgBuf;
	FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
	FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL,
	dw, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
	(LPTSTR) &lpMsgBuf,	0, NULL);// Process any inserts in lpMsgBuf.
	// Display the string.
	MessageBox(NULL, (LPCTSTR)lpMsgBuf, "Error",
	MB_OK | MB_ICONINFORMATION);
	// Free the buffer.
	LocalFree(lpMsgBuf);
}


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 has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer SEO
Russian Federation Russian Federation
AlexF's Blog in Russian
Owner Spy competition analysis
Rating Burner Rating of blogs

Comments and Discussions