#define FUNC_ADDR(hDll, func) pf##func func = (pf##func)GetProcAddress(hDll,#func); if(! func) { AfxMessageBox("GetAddrErr"#func); } HMODULE hDll = LoadLibrary("InvoicePrintMP512.dll"); if(!hDll) { AfxMessageBox("LoadErr"); } FUNC_ADDR(hDll, OpenDevice) FUNC_ADDR(hDll, CloseDevice)