windows ce gprs 拨号程序
2010-08-22 12:44:00 来源:WEB开发网printf("正在连接设备 ");
break;
case RASCS_Connected:
//int i;
//printf("已连接 ");
//scanf("%d",i);
//if(i==1)
//{
// RasHangUp(hRasConn);
//}
break;
case RASCS_Disconnected:
printf("连接已断开 ");
break;
default:
printf("未知 ");
break;
}
break;
default:
return DefWindowProc(hWnd, Msg, wParam, lParam);
}
return TRUE;
}
int WINAPI WinMain( HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
// TODO: Place code here.
HWND hwnd;
MSG msg;
WNDCLASS wc;
wc.style = 0;
wc.lpfnWndProc = (WNDPROC)WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = 0;
wc.hCursor = 0;
wc.hbrBackground = NULL;
wc.lpszMenuName = 0;
wc.lpszClassName = _T("embo");
RegisterClass(&wc);
hwnd = CreateWindow(_T("embo"),_T("EmboConnection"),0,0,0,0,0,NULL,NULL,hInstance,NULL);
ShowWindow(hwnd,0);
CreatePort();
RASDIALPARAMS rdParams;//拨号参数
//初始化拨号参数
rdParams.dwSize=sizeof(RASDIALPARAMSW);
wcscpy(rdParams.szEntryName,_T("Embo Connection"));
wcscpy(rdParams.szPhoneNumber,_T(""));
wcscpy(rdParams.szCallbackNumber,_T(""));
wcscpy(rdParams.szUserName,_T(""));
wcscpy(rdParams.szPassword,_T(""));
wcscpy(rdParams.szDomain,_T(""));
DWORD dwRet;
//拨号连接
//printf("connecting ");
dwRet = RasDial(NULL,NULL,&rdParams,0xFFFFFFFF,hwnd ,&hRasConn);
if(dwRet != 0)//connection successful
{
RasHangUp(hRasConn);
}
while ( GetMessage(&msg, NULL, 0, 0) != FALSE )
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 0;
}
更多精彩
赞助商链接