一个简单的问题(不知道怎么描述)
typedef bool(__stdcall CHANGE)(char *,char *);
void CBmpToJpgDlg::OnButton1()
{
UpdateData(TRUE);
HINSTANCE hInst;
CHANGE *pFunc;
hInst = ::LoadLibrary("jpgdll.dll");
pFunc = (CHANGE*)::GetProcAddress(hInst,"BmpToJpg");
pFunc(m_strBmp.GetBuffer(50),m_strJpg.GetBuffer(50));
m_strBmp.ReleaseBuffer();
m_strJpg.ReleaseBuffer();
::FreeLibrary(hInst);
}
程序编译成功,但是运行出错
单步调试
发现在pFunc(m_strBmp.GetBuffer(50),m_strJpg.GetBuffer(50));这句时出错
如下:
Unhandled exception in bmptojpeg.exe: 0xc0000005: Access Violation