EndDialog(hwnd, IDOK); if(IDOK==returncode)

void Dlg1_OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
{
    switch(id)
    {
	case IDOK:
		{
		PUserInfo puser1;
        puser1=(PUserInfo)GetWindowLong(hwnd,GWL_USERDATA);		
		/*
		char buf[256];
		wsprintf(buf,"%d,%d,%d",sizeof(puser1),sizeof(puser1->userName),sizeof(puser1->passWord));
		MessageBox(hwnd,buf,"",MB_OK);
		//*/
		GetDlgItemText(hwnd,IDC_USERNAME,puser1->userName,sizeof(puser1->userName));
		GetDlgItemText(hwnd,IDC_PASSWORD,puser1->passWord,sizeof(puser1->passWord));
		EndDialog(hwnd, IDOK);
		}
        break;
	case IDCANCEL:
		{
		EndDialog(hwnd, IDCANCEL);
		}
        break;
	default:
		break;
    }
}


        case IDC_OK:
		{
			//MessageBox(hwnd,TEXT("欢迎访问如鹏网 www.RuPeng.com 大学生计算机学习社区"),TEXT("问好"),MB_OK);
			HINSTANCE hInstance;
			hInstance=(HINSTANCE)GetWindowLong(hwnd,GWL_HINSTANCE);
			//DialogBox(hInstance, MAKEINTRESOURCE(IDD_DIALOG1), NULL, Dlg1_Proc);	
			UserInfo user1={"yzk","12345"};
			int returncode=DialogBoxParam(hInstance,MAKEINTRESOURCE(IDD_DIALOG1),hwnd,Dlg1_Proc,(long)&user1);
			if(IDOK==returncode)
			{
			MessageBox(hwnd,user1.userName,user1.passWord,MB_OK);
			} 
			else if(IDCANCEL==returncode)
			{
				MessageBox(hwnd,user1.userName,"取消",MB_OK);
			}

		}
        break;

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值