是否可以自动加载DLL?
有没有比每次打开并调用.dll文件更好的方法是否可以自动加载DLL?,dll,autoit,Dll,Autoit,有没有比每次打开并调用.dll文件更好的方法 Func getLife() Local $hDLL = DllOpen("MyFirstDll.dll") Local $result = DllCall($hDLL, "int:cdecl", "getLife") If @error > 0 Then MsgBox(0, "Error", "Oh ups.. dll loading fail") Else Ms
Func getLife()
Local $hDLL = DllOpen("MyFirstDll.dll")
Local $result = DllCall($hDLL, "int:cdecl", "getLife")
If @error > 0 Then
MsgBox(0, "Error", "Oh ups.. dll loading fail")
Else
MsgBox(0, "Result", $result[0])
EndIf
DllClose($hDLL)
EndFunc
在自动热键中,可以预加载.dll文件。在AutoIt中也可以这样做(以节省性能)
有没有比每次打开并调用.dll文件更好的方法
Func getLife()
Local $hDLL = DllOpen("MyFirstDll.dll")
Local $result = DllCall($hDLL, "int:cdecl", "getLife")
If @error > 0 Then
MsgBox(0, "Error", "Oh ups.. dll loading fail")
Else
MsgBox(0, "Result", $result[0])
EndIf
DllClose($hDLL)
EndFunc
加载并关闭.dll文件一次(与每次函数调用相反)。示例(未测试):
请回答这个问题。我的意思是DLLClose()函数在离开作用域后关闭它。事实并非如此。只有在终止的时候。