#include "stdafx.h"
#include
#include"resource.h"
void leftright(HWND hwndDlg)
{
int left = GetDlgItemInt(hwndDlg, IDC_EDIT1, NULL, TRUE);
int right = GetDlgItemInt(hwndDlg, IDC_EDIT2, NULL, TRUE);
SetDlgItemInt(hwndDlg, result, (left + right), TRUE);
}
void reduce(HWND hwndDlg)
{
int left = GetDlgItemInt(hwndDlg, reduce1, NULL, TRUE);
int right = GetDlgItemInt(hwndDlg, reduce2, NULL, TRUE);
SetDlgItemInt(hwndDlg, reduce3, left - right, TRUE);
}
void ride(HWND hwndDlg)
{
int left = GetDlgItemInt(hwndDlg, ride1, NULL, TRUE);
int right = GetDlgItemInt(hwndDlg, ride2, NULL, TRUE);
SetDlgItemInt(hwndDlg, ride3, left * right, TRUE);
}
BOOL comand(HWND hwndDlg, WPARAM wParam)
{
switch (LOWORD(wParam))
{
case PUTIND:
EndDialog(hwndDlg, 0);
case OK:
leftright(hwndDlg);
return TRUE;
case OK2:
reduce(hwndDlg);
return TRUE;
case OK3:
ride(hwndDlg);
return TRUE;
}
return FALSE;
}
BOOL CALLBACK DialogProc(
HWND hwndDlg,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
)
{
switch (uMsg)
{
case WM_COMMAND:
return comand(hwndDlg, wParam);
return TRUE;
}
return FALSE;
}
int APIENTRY tWinMain(_In HINSTANCE hInstance,
In_opt HINSTANCE hPrevInstance,
In LPTSTR lpCmdLine,
In int nCmdShow)
{
HWND head = FindWindow("CalcFrame", NULL);
if (head)
{
return 0;
}
int p=DialogBox(hInstance, (LPCSTR)BIG, NULL, DialogProc);
return 0;
}
为什么点运行起来图标的最右上角的叉却关闭不掉怎么回事啊