如何用程序启动一个拨号连结?

eastsun 2004-09-14 09:30:46

如何用程序启动一个拨号连结?

又如何得到连结已经成功或者失败的消息?

如何结束这个拨号连结。
...全文
143 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
kugou123 2004-09-21
  • 打赏
  • 举报
回复
MSDN资料如下:(取自MSDN2003)

DWORD RasDial(
LPRASDIALEXTENSIONS lpRasDialExtensions,
LPCTSTR lpszPhonebook,
LPRASDIALPARAMS lpRasDialParams,
DWORD dwNotifierType,
LPVOID lpvNotifier,
LPHRASCONN lphRasConn
);

Parameters
lpRasDialExtensions
[in] Pointer to a RASDIALEXTENSIONS structure that specifies a set of RasDial extended features to enable. Set this parameter to NULL if there is not a need to enable these features.

Windows Me/98/95: This parameter is ignored. On these platforms, RasDial always uses the default behaviors for the RASDIALEXTENSIONS options.


lpszPhonebook
[in] Pointer to a null-terminated string that specifies the full path and file name of a phone-book (PBK) file. If this parameter is NULL, the function uses the current default phone-book file. The default phone-book file is the one selected by the user in the User Preferences property sheet of the Dial-Up Networking dialog box.

Windows 95: This parameter should always be NULL. Dial-up networking stores phone-book entries in the registry rather than in a phone-book file.


lpRasDialParams
[in] Pointer to a RASDIALPARAMS structure that specifies calling parameters for the RAS connection. Use the RasGetEntryDialParams function to retrieve a copy of this structure for a particular phone-book entry.
The caller must set the RASDIALPARAMS structure's dwSize member to sizeof(RASDIALPARAMS) to identify the version of the structure being passed.

If the szPhoneNumber member of the RASDIALPARAMS structure is an empty string, RasDial uses the phone number stored in the phone-book entry.

dwNotifierType
[in] Specifies the nature of the lpvNotifier parameter. If lpvNotifier is NULL, dwNotifierType is ignored. If lpvNotifier is not NULL, set dwNotifierType to one of the following values. Value Meaning
DWORD The lpvNotifier parameter is a handle to a window to receive progress notification messages. In a progress notification message, wParam is the equivalent of the rasconnstate parameter of RasDialFunc and RasDialFunc1, and lParam is the equivalent of the dwError parameter of RasDialFunc and RasDialFunc1.
The progress notification message uses a system registered message code. You can obtain the value of this message code as follows:

{UINT unMsg =
RegisterWindowMessageA( RASDIALEVENT );
if (unMsg == 0)
unMsg = WM_RASDIALEVENT;
}

0 The lpvNotifier parameter points to a RasDialFunc callback function.
1 The lpvNotifier parameter points to a RasDialFunc1 callback function.
2 The lpvNotifier parameter points to a RasDialFunc2 callback function.

Windows Me/98/95: This value is not supported.



lpvNotifier
[in] Specifies a window handle or a RasDialFunc, RasDialFunc1, or RasDialFunc2 callback function to receive RasDial event notifications. The dwNotifierType parameter specifies the nature of lpvNotifier. Please refer to its description preceding for further detail.
If this parameter is not NULL, RasDial sends the window a message, or calls the callback function, for each RasDial event. Additionally, the RasDial call operates asynchronously: RasDial returns immediately, before the connection is established, and communicates its progress via the window or callback function.

If lpvNotifier is NULL, the RasDial call operates synchronously: RasDial does not return until the connection attempt has completed successfully or failed.

If lpvNotifier is not NULL, notifications to the window or callback function can occur at any time after the initial call to RasDial. Notifications end when one of the following events occurs:


The connection is established. In other words, the RAS connection state is RASCS_Connected.
The connection fails. In other words, dwError is nonzero.
RasHangUp is called on the connection.
The callback notifications are made in the context of a thread captured during the initial call to RasDial.

lphRasConn
[in] Pointer to a variable of type HRASCONN. Set the HRASCONN variable to NULL before calling RasDial. If RasDial succeeds, it stores a handle to the RAS connection into *lphRasConn.
Return Values
If the function succeeds, the immediate return value is zero. In addition, the function stores a handle to the RAS connection into the variable pointed to by lphRasConn.

If the function fails, the immediate return value is a nonzero error value, either from the set listed in the RasError.h header file or ERROR_NOT_ENOUGH_MEMORY.

tjandy 2004-09-21
  • 打赏
  • 举报
回复
楼主你代码帖出来,大家帮你看看,你光说,这样错误很难解决的
tjandy 2004-09-15
  • 打赏
  • 举报
回复
ras可以为你做到,相关资料楼主可以上网查一下
DentistryDoctor 2004-09-15
  • 打赏
  • 举报
回复
直接RasDial函数。
eastsun 2004-09-15
  • 打赏
  • 举报
回复

我的系统环境是win2000 专业版。
eastsun 2004-09-15
  • 打赏
  • 举报
回复

我找到了一个程序,可是 DWORD ret=RasEnumEntries(NULL,NULL,NULL,&dwSize,&n);

ret返回值也是632,这个广泛流行的程序,应该不会有这么奇怪的错误。

真的不知道哪个地方配置不对劲了。

steven_sina 2004-09-14
  • 打赏
  • 举报
回复
同意楼上
Kudeet 2004-09-14
  • 打赏
  • 举报
回复
其中“连接Internet”为你创建的拨号程序名称
winexec('rundll32.exe rnaui.dll,RnaDial '+'连接Internet',9);
eastsun 2004-09-14
  • 打赏
  • 举报
回复

up.

16,551

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • AIGC Browser
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧