一个使用RAS拨号的程序,拨号部分在dialog之外的一个cpp中
在dialog的cpp文件中有
BEGIN_MESSAGE_MAP(CHISENBUSDlg, CDialog)
//{{AFX_MSG_MAP(CHISENBUSDlg)
ON_MESSAGE( WM_RASDIALEVENT, OnRasDialEvent)
//<<<<<<<<<<<<<<<
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
而且在h和cpp文件中也有OnRasDialEvent但是在拨号的时候,无论如何也不能得到WM_RASDIALEVENT,为什么?
在ClassWizard中,消息里也没有WM_RASDIALEVENT应该如何做才能触发事件呢?
在dialog的cpp文件中有
BEGIN_MESSAGE_MAP(CHISENBUSDlg, CDialog)
//{{AFX_MSG_MAP(CHISENBUSDlg)
ON_MESSAGE( WM_RASDIALEVENT, OnRasDialEvent)
//<<<<<<<<<<<<<<<
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
而且在h和cpp文件中也有OnRasDialEvent但是在拨号的时候,无论如何也不能得到WM_RASDIALEVENT,为什么?
在ClassWizard中,消息里也没有WM_RASDIALEVENT应该如何做才能触发事件呢?
RasDialFunc
The RasDialFunc function is an application-defined or library-defined callback function that the RasDial function calls when a change of state occurs during a RAS connection process. VOID WINAPI RasDialFunc(
UINT unMsg, // type of event that has occurred
RASCONNSTATE rasconnstate, // connection state about to be entered
DWORD dwError // error that may have occurred
);
Parameters
unMsg
[in] Specifies the type of event that has occurred. Currently, the only event defined is WM_RASDIALEVENT.
rasconnstate
[in] Specifies the RASCONNSTATE enumerator value that indicates the state the RasDial remote access connection process is about to enter.
dwError
[in] Specifies the error that has occurred, or zero if no error has occurred.
RasDial calls RasDialFunc with dwError set to zero upon entry to each connection state. If an error occurs within a state, RasDialFunc is called again with a nonzero dwError value.
RasDial( NULL, NULL, &m_RasDialParams,0xFFFFFFFF, AfxGetMainWnd()->m_hWnd,&rasconn.hrasconn)在窗口上处理的,不知为何窗口得不到事件,如果换成回调函数结果都一样吗?
The progress notification message uses a system registered message code. Obtain the value of this message code as follows: {UINT unMsg =
RegisterWindowMessageA( RASDIALEVENT );
if (unMsg == 0)
unMsg = WM_RASDIALEVENT;
}得先注册消息