求解决!该怎么处理

求解决!!!
问各位一个问题:加载动态库,为什么把XXX.dll复制到目录下可以执行,用LoadLibrary()加载就会出错:找不到该XXX.dll

------解决方案--------------------
说明你LoadLibrary中路径设置的不对,一般.dll建议放在system或者是应用程序路径,这样直接用相对路径就好。
------解决方案--------------------
程序在查找动态库时,先在系统的环境变量中查找,如果找不到就会在当前的程序目录中查找;
所以要看环境变量有没有设对
------解决方案--------------------
引用:
HINSTANCE h = LoadLibraryA("../../../VS2005/KeyBoardHook/debug/KeyBoardHook.dll");
if(h)
{
typedef BOOL (WINAPI *MYFUNC)(BOOL,DWORD,HWND);
MYFUNC fun = NULL;
fun = (MYFUNC)GetProcAddress(h,"SetKeyHook");
if(!SetKeyHook(TRUE,0,m_hWnd))
MessageBox(_T("安装钩子失败"));
FreeLibrary(h);
}
这是部分代码,运行弹出对话框找不到KeyBoardHook.dll,可是路径对着呢,但是把这个dll放在执行文件下或者/system32/下可以执行通过

"../../../VS2005/KeyBoardHook/debug/KeyBoardHook.dll",dll不就是应该放在这个路径下吗? 这个路径中还有"debug",不就是可执行文件的存放目录吗?
------解决方案--------------------
先改成绝对路径试试,如果行的话,那可能是你环境中的当前路径被改变了。
------解决方案--------------------
LoadLibrary
The LoadLibrary function maps the specified executable module into the address space of the calling process. 

HINSTANCE LoadLibrary(
  LPCTSTR lpLibFileName   // address of filename of executable module
);
 
Parameters
lpLibFileName 
Pointer to a null-terminated string that names the executable module (either a .DLL or .EXE file). The name specified is the filename of the module and is not related to the name stored in the library module itself, as specified by the LIBRARY keyword in the module-definition (.DEF) file. 
If the string specifies a path but the file does not exist in the specified directory, the function fails. When specifying a path, be sure to use backslashes (\), not forward slashes (/).