对于拨号连接,如何获取连接时间?(100分)

  • 主题发起人 主题发起人 southwood
  • 开始时间 开始时间
S

southwood

Unregistered / Unconfirmed
GUEST, unregistred user!
看了大半天RAS(Remote Access Service)的API, 怎么都找不到
可以获得连接时间的办法。不可能呀,到底是怎么回事?我实在
没办法了。
大家帮帮忙。
 
连接的时候记录时间
 
I think if the connection property window can show the time(win2k system),
other softwares should be able to do so too.
But I only find a similar property in the server side connection properties--
"session start time".
MS doesnt want to give out the time ?
 
谢谢,原来好像没办法。
 
对win2k/winxp...,可以用

RasGetConnectionStatistics
(from msdn.microsoft.com)

The RasGetConnectionStatistics function retrieves accumulated
connection statistics for the specified connection.

DWORD RasGetConnectionStatistics(
HRASCONN hRasConn, // handle to the connection
RAS_STATS *lpStatistics // buffer to receive statistics
);
Parameters
hRasConn,
[in] Handle to the connection. Use RasDial or RasEnumConnections to obtain this handle.
lpStatistics
[in, out] Pointer to the RAS_STATS structure that, on output, receives the statistics.
On input, set the dwSize member of this structure to sizeof(RAS_STATS).
This parameter cannot be NULL.


Return Values
If the function succeeds, the return value is ERROR_SUCCESS.

If the function fails, the return value is one of the following error codes.
Value Meaning
E_INVALID_ARG At least one of the following is true: the hRasConn parameter
is zero, the lpStatistics parameter is NULL, or the value
specified by the dwSize member of the RAS_STATS structure
specifies a version of the structure that is not supported by
the operating system in use.
ERROR_NOT_ENOUGH_MEMORY The function could not allocate sufficient memory
to complete the operation.

Other Use FormatMessage to retrieve the system error message that corresponds
to the error code returned.


Requirements
Windows NT/2000/XP: Included in Windows 2000 and later.
Windows 95/98/Me: Unsupported.
Header: Declared in Ras.h.
Library: Use Rasapi32.lib.


 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
I
回复
0
查看
584
import
I
后退
顶部