CUT_RAS::SetDialStatusCallback
int SetDialStatusCallback(HWND hWnd, int nMessageID)
Parameters
hWnd |
Handle of the window which will receive the window messages. |
nMessageID |
ID of the message to send. |
Return Value
UTE_SUCCESS |
This function always return as successful. |
Remarks
Sets the window which will retrieve messages during dialing (see the Dial function). Messages are sent each time the dialing state changes, and this function is useful for showing the user the current state within a window or dialog box.
The format of the message sent back by the class to the window specified by the hWnd handle is:
wParam The LOWORD contains a string indicating the current state of the dialup process. The HIWORD contains the errorcode which applies to the current state. See the RASERROR.H header file for a complete listing of errorcodes.
lParam
Points to a string buffer which describes the current state.
Examples
Dial is invoked as an asynchronous operation and the function returns immediately. The user must therefore specify a notification handler that the RAS object uses to inform the client application when the connection operation state changes or an error occurs. This handler is implemented below. For more information see the sample code in the Overview page.
MFC Sample
Header File
// Generated message map functions
//{{AFX_MSG(CTestAppDlg)
........
afx_msg LRESULT OnDialStatus(WPARAM wParam, LPARAM lParam);
.......
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
Source File
BEGIN_MESSAGE_MAP(CTestAppDlg, CDialog)
//{{AFX_MSG_MAP(CTestAppDlg)
...
ON_MESSAGE(WM_USER+1,OnDialStatus)
.......
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
.....
(in OnInitDialog)
// specify a notification handler that RAS uses
// to inform the client application when the connection
// operation state changes or an error occurs
m_ras.SetDialStatusCallback(m_hWnd,WM_USER);
......
LRESULT CTestAppDlg::OnDialStatus(WPARAM wParam, LPARAM lParam){
DWORD dwError = HIWORD(wParam);
UpdateData();
CString szTemp = (LPCSTR)m_strStatus;
szTemp += "\r\n";
szTemp += (LPCSTR)lParam;
SetDlgItemText(IDC_EDIT1,szTemp);
if(dwError){
MessageBox(m_ras.GetRASErrorString(dwError));
}
m_ctlStatus.LineScroll(100000);
return 0;
}
SDK Sample
ras.SetDialStatusCallback (hwndDlg,WM_USER+1);
case WM_USER+1 :
{
SetDlgItemText(hwndDlg, IDC_EDIT1,(LPCSTR)(LPARAM)lParam);
return 1;
}