Use VC ++ to realize the network dial function

zhaozj2021-02-11  212

Using VC to achieve Internet dialing function Dalian Jietong Computer Technology Co., Ltd. Chen Wei ---- The era of now is the Internet, the application of network applications is getting more and more extensive, and directly dialing online in their own design. The user has a lot of convenience. This application is on the Chinese Windows95 operating system, and a small program that is developed with VC 5.0, I hope to help everyone. Below is a source program that implements this feature: --- First create a VC project based on dialog box, the following is the dialog box (Dialogue) for this application - then in dialog box Add a few new definition functions in the header file: public:

Void SetupDialupCombo (Void);

protected:

// {{AFX_MSG (CDIALPROCDLG)

Virtual Bool OnInitdialog ();

AFX_MSG void onConnectButton ();

// Responding to the "Continued" of the Button button in the dialog

AFX_MSG Void OnselchangeDialupCombo ();

/ / Responding to the event of the COMBO control in the conversation

//}} AFX_MSG

---- The following is the function of adding a new defined function in the source file of the dialog box: Don't forget to add #include in the header file

This header file, and librarymodules in the link in Settings Add Rasapi32.lib.

Void CDialProcdlg :: setupdialupcombo ()

{

m_dialcombo.ResetContent ();

// m_dialcombo is a naming of the Combox control in the dialog

DWORD N;

DWORD DWSIZE = 0;

// Enumerate all dial-up connections in the local computer.

DWord Ret = RaseNumentries

(NULL, NULL, NULL, & DWSIZE, & N);

n = dwsize / sizeof (rasentryname);

RasentryName * entry = new rasentryname [n];

IF (entry) {

Entry [0] .dwsize = sizeof (RasentryName);

DWord Ret = RaseNumentries

(NULL, NULL, Entry, & Dwsize, & n);

For (DWORD I = 0; I

= 0) {

m_dialcombo.getlbtext (sel, params.szentryname);

Trace ("% s / n", params.szentryname;

BOOL P;

RasgeTryDialParams (NULL, & PARAMS, & P);

m_userid.setwindowText (params.szusername);

m_passworddedit.setwindowText (params.szpassword);

}

}

Bool cDialProcdlg :: OnItDialog ()

{CDialog :: oninitdialog ();

SetupDialupCombo ();

Return true; // returntrue

UnsS you set the focus to a control

}

---- This application is developed, compiled, and running on VC 5.0 under the Chinese 95 operating system.

转载请注明原文地址:https://www.9cbs.com/read-4079.html

New Post(0)