rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CEX12_02AppDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
void CEX12_02AppDlg::OnAdd()
{
// TODO: Add your control notification handler code here
UpdateData(true);
//加载动态链接库
HINSTANCE hInstance= NULL;
hInstance = LoadLibrary("Ex12_02DLL.dll");
if(hInstance == NULL)
{
MessageBox("加载动态库失败!");
return;
}
//得到函数地址
typedef double(*MYADD)(double,double);
MYADD SquareAdd = NULL;
SquareAdd = (MYADD)GetProcAddress(hInstance , "MyAdd");
//计算平方和
m_result= SquareAdd (m_x,m_y);
UpdateData(false);
//卸载动态链接库
if(hInstance != NULL)
FreeLibrary(hInstance);
}
void CEX12_02AppDlg::OnMinus()
{
// TODO: Add your control notification handler code here
UpdateData(true);
//加载动态链接库
HINSTANCE hInstance= NULL;
hInstance = LoadLibrary("Ex12_02DLL.dll");
if(hInstance == NULL)
{
MessageBox("加载动态库失败!");
return;
}
//得到函数地址
typedef double(*MYMINUS)(double,double);
MYMINUS SquareMinus = NULL;
SquareMinus = (MYMINUS)GetProcAddress(hInstance, "MyMinus");
//计算平方差
m_result= SquareMinus (m_x,m_y);
UpdateData(false);
//卸载动态链接库
if(hInstance != NULL)FreeLibrary(hInstance);
}