1.连接不上。
2。无法得到状态信息。
请指点?、#include <windows.h>
#include "ras.h"
#include "resource.h"
#include <TCHAR.h>
LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM) ;
static TCHAR szAppName[] = TEXT ("adsl") ; 
char text[50];
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
                    PSTR szCmdLine, int iCmdShow){     
     HWND         hwnd ;
     MSG          msg ;
     WNDCLASS     wndclass ;
     wndclass.style         = CS_HREDRAW | CS_VREDRAW ;
     wndclass.lpfnWndProc   = WndProc ;
     wndclass.cbClsExtra    = 0 ;
     wndclass.cbWndExtra    = 0 ;
     wndclass.hInstance     = hInstance ;
     wndclass.hIcon         = LoadIcon (NULL, IDI_APPLICATION) ;
     wndclass.hCursor       = LoadCursor (NULL, IDC_ARROW) ;
     wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH) ;
     wndclass.lpszMenuName  = (LPCSTR)IDR_MENU1;  //在窗口类中定义菜单的字符串名
     wndclass.lpszClassName = szAppName ;
     if (!RegisterClass (&wndclass))
     {
         MessageBox (NULL, TEXT ("This program requires Windows NT!"), 
                      szAppName, MB_ICONERROR) ;
          return 0 ;
     }
     hwnd = CreateWindow (szAppName,                  // window class name
                          TEXT ("adsl!"), // window caption
                          WS_OVERLAPPEDWINDOW,        // window style
                          CW_USEDEFAULT,              // initial x position
                          CW_USEDEFAULT,              // initial y position
                          CW_USEDEFAULT,              // initial x size
                          CW_USEDEFAULT,              // initial y size
                          NULL,                       // parent window handle
                          NULL,                       // window menu handle
                          hInstance,                  // program instance handle
                          NULL) ;                     // creation parameters     ShowWindow (hwnd, iCmdShow) ;
     UpdateWindow (hwnd) ;
     
     while (GetMessage (&msg, NULL, 0, 0))
     {
          TranslateMessage (&msg) ;
          DispatchMessage (&msg) ;
     }
     return msg.wParam ;
}
LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam){
     RASCONNSTATE rasstate;
     LPHRASCONN      m_hrasconn;     
     HDC         hdc ;
     PAINTSTRUCT ps ;     
     RECT        rect ;
                              //HWND        hbutton; 
     int         wmpara;     //这个参数是提取出WM_COMMAND消息参数WPAPAM的低16位
     switch (message)
     {
     case  WM_CREATE :
                 /*代码省略     */
 return 0 ; 
 case WM_COMMAND:  
          wmpara=LOWORD(wParam);                
  switch(wmpara)      
  {   
  case ID_CONNECITON:// 点击菜单中“连接按钮”进入ID_CONNECITON:处理中
HRASCONN hRasConn;//连接句柄
 RASDIALPARAMS RasDialParams;
RasDialParams.dwSize = sizeof(RASDIALPARAMS);
_tcscpy(RasDialParams.szEntryName,_T("宽带拨号器"));
         _tcscpy(RasDialParams.szPhoneNumber, _T(""));
         _tcscpy(RasDialParams.szCallbackNumber, _T(""));
_tcscpy(RasDialParams.szUserName,"xxxxxx s@adsl");
                  _tcscpy(RasDialParams.szPassword,"xxxxx");
tcscpy(RasDialParams.szDomain, _T(""));
int temp;
temp=RasDial(NULL,NULL,&RasDialParams,0xFFFFFFFF,hwnd,&hRasConn);//(不知哪里设置有误,总无法连接上。)
if(temp!=0){
MessageBox (NULL, TEXT ("connection error!!"), szAppName, MB_ICONERROR) ;
hRasConn = NULL;}
else
{
        MessageBox (NULL, TEXT ("connection success!!"), szAppName, MB_ICONERROR) ;
}
return 0;
  
              case ID_ABORT:       
    //                     
   return 0; 
              case ID_EXIT:
   DestroyWindow(hwnd);//
   return 0;
          }
      case WM_RASDIALEVENT://为什么总不进入此事件处理呢?????????
rasstate= (RASCONNSTATE)wParam;
           switch(rasstate)
   { 
              case RASCS_OpenPort: 
                   _tcscpy(text,"打开端口……");
                   InvalidateRect(hwnd,NULL,1);
                   return 0; 
              case RASCS_PortOpened: 
                   _tcscpy(text,"端口已打开.");
                   InvalidateRect(hwnd,NULL,1);
                   return 0;  
              case RASCS_ConnectDevice: 
                   _tcscpy(text,"连接设备");
                   InvalidateRect(hwnd,NULL,1);
                   return 0; 
              case RASCS_DeviceConnected: 
               _tcscpy(text,"设备已连接.");
                   InvalidateRect(hwnd,NULL,1);
                   return 0; 
              case RASCS_Authenticate: 
                   _tcscpy(text,"验证用户及密码");
                   InvalidateRect(hwnd,NULL,1);
                   return 0;  
              case RASCS_Authenticated: 
                   _tcscpy(text,"通过");
                   InvalidateRect(hwnd,NULL,1); 
              case RASCS_Connected: 
                   _tcscpy(text,"已连接");
                   InvalidateRect(hwnd,NULL,1);
                   return 0; 
              case RASCS_Disconnected: 
                   _tcscpy(text,"连接已断开");
                   InvalidateRect(hwnd,NULL,1);
                   m_hrasconn=NULL; 
                   return 0;
   }  case WM_PAINT:
         hdc = BeginPaint (hwnd, &ps) ;          
         GetClientRect (hwnd, &rect) ;          
         DrawText (hdc, text, -1, &rect,
                   DT_SINGLELINE | DT_CENTER | DT_VCENTER) ;
          EndPaint (hwnd, &ps) ;
          return 0 ;
  
     case WM_DESTROY:
          PostQuitMessage (0) ;
          return 0 ;     }     return DefWindowProc (hwnd, message, wParam, lParam) ;}