易截截图软件、单文件、免安装、纯绿色、仅160KB

在Delphi中使用RAS实现对系统拨号的控制

 在Delphi中使用RAS实现对系统拨号的控制
  在企业应用中有时候希望能在程序中实现对拨号网络的控制,以实现自动拨号、自动断开网络。在尝试了多种方式之后,认为RAS是一种比较稳定的方式。在google了网上一些资料后,现整理如下:
一、首先需要有个针对RAS的头文件定义,Ras.pas代码如下
 
{* Copyright (c) 1992-1995, Microsoft Corporation, all rights reserved
**
** ras.h
** Remote Access external API
** Public header for external API clients
*}
{ Delphi conversion by Davide Moretti <dmoretti@iper.net> }
{ Note: All functions and structures defaults to Ansi. If you want to use
Unicode structs and funcs, use the names ending with 'W' }
unit Ras;
interface
uses Windows, Messages;
const
{ These are from lmcons.h }
DNLEN = 15; // Maximum domain name length
UNLEN = 256; // Maximum user name length
PWLEN = 256; // Maximum password length
NETBIOS_NAME_LEN = 16; // NetBIOS net name (bytes)
RAS_MaxDeviceType = 16;
RAS_MaxPhoneNumber = 128;
RAS_MaxIpAddress = 15;
RAS_MaxIpxAddress = 21;
{ Note: you must define WINVER31 before compiling this unit to get the sizes
for the 3.x version of RAS. The default is for Windows 95 and NT 4.0 }
{$IFDEF WINVER31}
{Version 3.x sizes }
RAS_MaxEntryName = 20;
RAS_MaxDeviceName = 32;
RAS_MaxCallbackNumber = 48;
{$ELSE}
{Version 4.x sizes }
RAS_MaxEntryName = 256;
RAS_MaxDeviceName = 128;
RAS_MaxCallbackNumber = RAS_MaxPhoneNumber;
{$ENDIF}
type
LPHRasConn = ^THRasConn;
THRasConn = Longint;
{* Identifies an active RAS connection. (See RasEnumConnections)
*}
LPRasConnW = ^TRasConnW;
TRasConnW = record
dwSize: Longint;
hrasconn: THRasConn;
szEntryName: Array[0..RAS_MaxEntryName] of WideChar;
{$IFNDEF WINVER31}
szDeviceType: Array[0..RAS_MaxDeviceType] of WideChar;
szDeviceName: Array[0..RAS_MaxDeviceName] of WideChar;
{$ENDIF}
end;
LPRasConnA = ^TRasConnA;
TRasConnA = record
dwSize: Longint;


相关文档:

DELPHI深度探索 (第2版)PDF电子书

 推荐给大家[url=DELPHI深度探索 (第2版)PDF电子书][/url]
因为需要前几天在网上搜搜过这本书书,可没有,源码倒是有,今天打开经常去的网站,居然发现提供下载了,这个网站自己差不多每天都要打开看看,这几天忙糊涂了,居然没有看到,在这推荐给大家,能下载的,速度很快。
[url=http://www.delphifans.com/Soft ......

delphi 类成员信息地址分析

 //定义MyClass
TMyClass = class
GUID: string;
Name: string;
bSex: Boolean;
Tel : string;
end;
//取值
var
obj: TMyClass;
begin
obj := TMyClass.Create;
with Memo1.Lines do
begin
Add('对象大小:' + IntToStr(obj.InstanceSize));
Add('对象所在地址:'+ ......

delphi 继承类

 继承是为了表现类与类之间“是一种”关系,是多态存在的基础,继承是面象对象必不可少的基础,只支持封装而不支持继承的语言只能称为“基于对象”(Object-Based)面非面向对象“Object-Oriented”;
Object Pascal只支持单继承,也就是一个派生类只能有一个基类
但可以实现多个接口 ......

delphi 多态

 什么是多态,字面意思就是“多种形态”,用对象来讲就是子类继承基类,而不同的子类又分别对基类进行功能的扩展。
多态在Object Pascal中是通过虚方法实现的(Virtual Method),在Object Pascal中基类的虚方法是可以被派生类覆盖(Override)的 ......

Delphi 设计模式:《HeadFirst设计模式》Delphi7代码

1. 复杂的子系统
unit uSubObject;

interface

type

{ TAmplifier与TTuner,TCDPlayer,TDVDPlayer相互依赖。 }
{ 在TTuner等的简单实现时用不到对TAmplifier的引用, }
{ 但现实生活中就应该让TAmplifier提供服务,所以这里保留了。 }
{ TProjector对T ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号