0
LONG DoDlg(HWND hDlg,UINT message,WPARAM wParam,LPARAM lParam)
{
    switch (LOWORD(wParam))
    {
        case IDOK:
            GetDlgItemText(hDlg,IDC_EDIT2,(LPWSTR)Mask,255);
            GetDlgItemText(hDlg,IDC_EDIT3,(LPWSTR)Gateway,255);
            GetDlgItemText(hDlg,IDC_EDIT1,(LPWSTR)IPAddress,255);
            DWORD dwErrorCode = GetLastError();//the value is 6
            char buf[100]={0};
            sprintf(buf,"%d",dwErrorCode);
            SetIPInfo(IPAddress,Mask,Gateway);//this is my function
            MessageBox(hDlg,(LPCWSTR)buf,TEXT("hehe"),MB_OKCANCEL);
            break;
        case IDCANCEL:
            EndDialog(hDlg,0);
            break;
        default:
            break;
    }
    return 0;
}

The three GetDlgItemText always has some problem. Now the first and the second is OK,and the last IPAddress get nothing from Edit control. If i change the order,maybe Mask or Gateway will get nothing. the GetLastError is 6.

4

0 回答 0