WM_RASDIALEVENTdoesn't seem to be working RRS feed

  • Question

  • I am having trouble getting the callback interface for the RasDial function to work. My Dialog box calls the RasDial function from a Button Click Event handler, as follows:

    hRasConn = NULL;

    memset (&m_RasDialParams, 0, sizeof (RASDIALPARAMS)); 

    m_RasDialParams.dwSize = sizeof (RASDIALPARAMS);

    m_RasDialParams.szPhoneNumber[0] = TEXT('\0'); // use the phone number from the Ras Named Entry

    m_RasDialParams.szCallbackNumber[0] = TEXT('\0');


    StringCbCopy(m_RasDialParams.szUserName,sizeof(m_RasDialParams.szUserName),m_szUserName); //This is optional

    StringCbCopy(m_RasDialParams.szPassword,sizeof(m_RasDialParams.szPassword),m_szPassword); //This is optional

    StringCbCopy(m_RasDialParams.szDomain,sizeof(m_RasDialParams.szDomain),m_szDomain); //This is optional

    dialStatus = RasDial(NULL,NULL, &m_RasDialParams,0xFFFFFFFF, g_hwndModemDlg, &hRasConn);

    where dialStatus is a local variable in the function that calls RasDial:

    DWORD dialStatus = 0;

    where the mRasDialParams is set up as a private member of the Dialog:

    RASDIALPARAMS m_RasDialParams;

    and g_hwndModemDlg is a global variableHWND g_hwndModemDlg;

     that is set just before the RasDial function is called.

    g_hwndModemDlg = this->m_hWnd;

     and hRasConn is a local variable defined in the function calling RasDial

    HRASCONN hRasConn;

    I have the callback function defined in the DialogBox Class definition as:

    afx_msg LRESULT OnRasDialEvent(WPARAM wp, LPARAM lp);

    and I am hooking in to the WM_RASDIALEVENT in this MFC Dialog with

    BEGIN_MESSAGE_MAP(CModemDlg, CDialog)

    ON_BN_CLICKED(IDC_DIAL_BTN, &CModemDlg::OnBnClickedDialBtn)

    ON_BN_CLICKED(IDC_ENDCONN_BTN, &CModemDlg::OnBnClickedEndconnBtn)




    The RasDial Function returns 0 and I can get the dialing status using the  RasGetConnectStatus function, but my OnRasDialEvent Function never gets called.

    If anyone can tell me what I am doing wrong I would really appreciate it.

    Susan Miner

    Tuesday, December 12, 2006 11:14 PM