#include "stdafx.h" #include <windows.h> #include <windowsx.h> #include "resource.h" #include "MainDlg.h" #pragma comment(lib,"Newdll.lib") extern "C" _declspec(dllexport) int add(int i1,int i2); /* Template designed by RuPeng.com. Please visit http://www.rupeng.com for more information 如鵬網(http://www.rupeng.com)大學生計算機學習社區,提供大量免費視頻學習教程,提供個性化一對一學習指導 */ BOOL WINAPI Main_Proc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch(uMsg) { HANDLE_MSG(hWnd, WM_INITDIALOG, Main_OnInitDialog); HANDLE_MSG(hWnd, WM_COMMAND, Main_OnCommand); HANDLE_MSG(hWnd,WM_CLOSE, Main_OnClose); } return FALSE; } BOOL Main_OnInitDialog(HWND hwnd, HWND hwndFocus, LPARAM lParam) { return TRUE; } void Main_OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify) { switch(id) { case IDC_OK: { int i=add(2,56); TCHAR msg[256]; wsprintf(msg,"2+56=%i",i); MessageBox(hwnd,msg,TEXT("問好"),MB_OK); } break; default: break; } } void Main_OnClose(HWND hwnd) { EndDialog(hwnd, 0); }