#include "stdafx.h"
#include "resource.h"
BOOL CALLBACK DialogProc(
HWND hwndDlg, // handle to dialog box
UINT uMsg, // message
WPARAM wParam, // first message parameter
LPARAM lParam // second message parameter
)
{
HWND hEditUser=NULL;
HWND hEditPass=NULL;
switch(uMsg)
{
case WM_COMMAND:
{
switch(LOWORD(wParam))
{
case IDOK:
{
TCHAR szUserBuffer[0x50];
TCHAR szPassBuffer[0x50];
hEditUser=GetDlgItem(hwndDlg,IDC_EDIT_UserName);
hEditPass=GetDlgItem(hwndDlg,IDC_EDIT_PassWord);
GetWindowText(hEditUser,szUserBuffer,0x50);
GetWindowText(hEditPass,szPassBuffer,0x50);
if ((strcmp(szUserBuffer,"") !=NULL)&&(strcmp("",szPassBuffer) !=NULL))
{
if (strcmp(strcat(szUserBuffer,TEXT("abc")),szPassBuffer) ==NULL)
{
MessageBox(NULL,TEXT("恭喜密码正确"),TEXT("正确"),MB_OK);
}
else
{
MessageBox(NULL,TEXT("密码错误"),TEXT("错误"),MB_OK);
}
}
else
MessageBox(NULL,TEXT("用户名密码不能为空"),TEXT("错误"),MB_OK);
return true;
}
case IDCANCEL:
{
// MessageBox(NULL,TEXT("IDC_Button_CANCEL"),TEXT("取消"),MB_OKCANCEL);
DestroyWindow(hwndDlg);
return false;
}
}
}
}
return false;
}
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
// TODO: Place code here.
DialogBox(hInstance,MAKEINTRESOURCE(IDD_DIALOG1),NULL,DialogProc);
return 0;
}