请看下面代码:
WORD CBdeAbstractDb::vcDbiInit(pDBIEnv pEnv)
{
DBIResult nRetVal = 0;
DbiInitFn *pDbiInitFn;
//下一句返回的函数地址是非0的,也就是说是get到了地址。
pDbiInitFn = (myDbiInitFn)GetProcAddress(m_hDll,"DbiInitFn");
// /* 此处出错。提示为:The value of ESP was not properly saved across a functon call . This is usually a result of calling a function declared with one calling convention with a function pointer declared with a diffent calling */
convention.这个调用约定究竟怎么处理呢? nRetVal = (*pDbiInitFn)(DBIINTFVER,pEnv);
return nRetVal;
}
WORD CBdeAbstractDb::vcDbiInit(pDBIEnv pEnv)
{
DBIResult nRetVal = 0;
DbiInitFn *pDbiInitFn;
//下一句返回的函数地址是非0的,也就是说是get到了地址。
pDbiInitFn = (myDbiInitFn)GetProcAddress(m_hDll,"DbiInitFn");
// /* 此处出错。提示为:The value of ESP was not properly saved across a functon call . This is usually a result of calling a function declared with one calling convention with a function pointer declared with a diffent calling */
convention.这个调用约定究竟怎么处理呢? nRetVal = (*pDbiInitFn)(DBIINTFVER,pEnv);
return nRetVal;
}
{
HMODULE hModule =GetModuleHandle("User32.DLL");
if(hModule == NULL)
{
return FALSE;
}typedef BOOL (WINAPI* SETLAYEREDWND)( HWND, COLORREF, BYTE, DWORD);
SETLAYEREDWND SetLayeredWindowPtr = NULL;
SetLayeredWindowPtr = (SETLAYEREDWND)GetProcAddress(hModule, "SetLayeredWindowAttributes");
if(SetLayeredWindowPtr)
{
LONG lStyle = GetWindowLong(hWnd, GWL_EXSTYLE) | 0x00080000;SetWindowLong( hWnd, GWL_EXSTYLE, lStyle);SetLayeredWindowPtr( hWnd,
RGB(0, 0, 0),
BYTE((255 * 70) / 100),
2);
}
}这段代码先loadlibrary然后调用getprocaddress,不知道您的代码是不是这样的。
错误应该在这句。
如果dll中用的C Calling convention。
用extern c修饰这句
注:调用的dll是delphi下的,我连lib文件都没有。幸好有头文件。