拨号问题(0分)

  • 主题发起人 主题发起人 耗子
  • 开始时间 开始时间

耗子

Unregistered / Unconfirmed
GUEST, unregistred user!
有哪位高手编写过Windows2000下的拨号程序?我现在急需用,我编写了Windows 98下的
拨号程序,不知到两者的区别大不大?请高手指点。急!急!急!
可惜我没有分奉上,但还是想请各位大虾帮忙,谢谢!
hao.z@371.net
 
不止你的拨号程序原理是什么,如果你用的是TAPI的话应该可以 ,因为他向下兼容哦
请教一个问题,如何得到对方摘机的消息
 
基本上是一样的,我在win98下的拨号程序在win2000下通过
 
是一样的啊,怎么,你的不行吗?
 
我有个方法,不过是从别的网友那学来的:
首先要建立两个Unit文件
1、unit Ras;
interface
uses
Windows;
const
{$IFDEF WINVER400}
RAS_MaxEntryName = 256;
{$ELSE}
RAS_MaxEntryName = 20;
{$ENDIF}
rasapi32 = 'rasapi32.dll';
type
TRASENTRYNAME = packed record
dwSize : DWORD;
szEntryName : array [0..RAS_MaxEntryName] of char;
szPadding : array [0..2] of Char;
end;
PRASENTRYNAME = ^TRASENTRYNAME;
implementation
end.
2、
unit libRasDial;
interface
uses
Windows, SysUtils, Registry, WinSock, WinInet, Ras;
function _IsConnectedToInternet: Boolean;
function _DoConnect(hwndParent:HWND): Boolean;
function _GetRasConnNum: Integer;
procedure _DoNew(hwndParent:HWND);
function RasEnumEntriesA(Reserved: Pointer;
szPhonebook: PChar;
lpRasEntryName: PRASENTRYNAME;
lpcb : PDWORD;
lpcEntries : PDWORD
): DWORD; stdcall;
function RasGetErrorStringA(uErrorValue : DWORD;
szErrorString : PChar;
cBufSize : DWORD
): DWORD; stdcall;
function RasCreatePhonebookEntryA(hWndParent : HWND;
lpszPhonebook : PChar
) : DWORD; stdcall;
var Conn: DWORD;
implementation
const
INTERNET_CONNECTION_MODEM = 1;
INTERNET_CONNECTION_LAN = 2;
INTERNET_CONNECTION_PROXY = 4;
INTERNET_CONNECTION_MODEM_BUSY = 8;
function InternetGetConnectedState(lpdwFlags: LPDWORD;
dwReserved: DWORD): BOOL; stdcall; external 'WININET.DLL';
function _IsConnectedToInternet: Boolean;
var
dwConnectionTypes: Integer;
begin
try
dwConnectionTypes := INTERNET_CONNECTION_MODEM +
INTERNET_CONNECTION_LAN +
INTERNET_CONNECTION_PROXY;
if InternetGetConnectedState(@dwConnectionTypes, 0) then
Result := true
else
Result := false;
except
Result := false;
end;
end;
function _DoConnect(hwndParent:HWND):Boolean;
begin
Result:= false;
if _GetRasConnNum=0 then _DoNew(hwndParent);
if _GetRasConnNum=0 then exit;
InternetDial(hwndparent,
'',
INTERNET_AUTODIAL_FORCE_ONLINE,
@Conn,
0);
if Conn<>0 then Result:=true;
end;
function _GetRasConnNum: Integer;
var
Entries : array [0..15] of TRASENTRYNAME;
cb : DWORD;
cEntries : DWORD;
dwRet : DWORD;
Buf : array [0..127] of char;
begin
FillChar(Entries, SizeOf(Entries), 0);
Entries[0].dwSize := SizeOf(TRASENTRYNAME);
cb := SizeOf(Entries);
cEntries := 0;
dwRet := RasEnumEntriesA(NIL, NIL, @Entries[0], @cb, @cEntries);
if dwRet <> 0 then RasGetErrorStringA(dwRet, @Buf[0], SizeOf(Buf));
Result:= cEntries;
end;
procedure _DoNew(hwndParent:HWND);
var
dwRet: DWORD;
Buf : Array [0..127] of char;
begin
dwRet := RasCreatePhonebookEntryA(hwndParent, nil);
if dwRet <> 0 then RasGetErrorStringA(dwRet, @Buf[0], SizeOf(Buf));
end;
function RasEnumEntriesA; external rasapi32 name 'RasEnumEntriesA';
function RasGetErrorStringA; external rasapi32 name 'RasGetErrorStringA';
function RasCreatePhonebookEntryA; external rasapi32 name 'RasCreatePhonebookEntryA';
end.
然后你就可以调用这些函数了
procedure TMainForm.Buttn1Click(Sender: TObject);
begin
_DoConnect(0);//拨号
end;
procedure TMainForm.Buttn1Click(Sender: TObject);
begin
if Conn <> 0 then
InternetHangUp(Conn,0);//断开
end;

 
接受答案了.
 
后退
顶部