Shanheavel Posted February 26, 2011 Posted February 26, 2011 Hello.I'm trying to add *.DLL into my program *.EXE with Autoit3 Wrapper. I'm using resource.au3 from topic. If somone has easier idea to add DLL into EXE then please write. ... #include "resources.au3" ;Add MyLib.dll #AutoIt3Wrapper_Res_File_Add=MyLib.dll, rt_rcdata, LIB ;Get MyLib.dll as string $LibAsString = _ResourceGetAsString("LIB") ;Try to open this DLL DllOpen($LibAsString) ... ;Use DLLIt doesn't work. I can save "LIB" to file *.DLL without problem but I need to use library from memory (from EXE).Can someone tell me how to do it, please?
PsaltyDS Posted February 26, 2011 Posted February 26, 2011 (edited) Why are you getting the resource as a string? What makes you think you can execute a string? Use _ResourceSaveToFile() instead. Edited February 26, 2011 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Shanheavel Posted February 26, 2011 Author Posted February 26, 2011 Why are you getting the resource as a string? What makes you think you can execute a string? Use _ResourceSaveToFile() instead. I think you don't understand me I want to use DLL without saving it to file. I need DLLOpen from resource "LIB".
Developers Jos Posted February 26, 2011 Developers Posted February 26, 2011 (edited) I think you don't understand me I want to use DLL without saving it to file. I need DLLOpen from resource "LIB".Maybe we understand what you want, but not what the problem is with saving the DLL to a file first before using it? Edited February 26, 2011 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Shanheavel Posted February 26, 2011 Author Posted February 26, 2011 (edited) Maybe we understand what you want, but not what the problem is with saving the DLL to a file first before using it?I'm making some program and I don't like when people edit my DLLs using program like Winhex. It's safer method. Edited February 26, 2011 by Adrian777
Developers Jos Posted February 26, 2011 Developers Posted February 26, 2011 I'm making some program and I don't like when people edit my DLLs using program like Winhex. It's safer method.That doesn't make much sense for 2 reasons:1. They could "patch" your script as easy as any other file.2. You could FileInstall() the DLL with each run so whatever they change will be overwritten each time you start the script EXE. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Zedna Posted February 26, 2011 Posted February 26, 2011 You missed link to this post from my Resource topic Resources UDF ResourcesEx UDF AutoIt Forum Search
Shanheavel Posted February 27, 2011 Author Posted February 27, 2011 @ZednaWhen I use the DLLs in the normal method (by DllCall)DllOpen("SomeLib.dll") DllCall("SomeLib.dll, "int", ...)it works great.But when I use:Dim $DllBinary = ... ;My DLL binary code from MemoryDllGen.au3 MemoryDllOpen($DllBinary) ;It returns 0 :( MemoryDllCall($DllBinary, "int",...) MemoryDllExit() ...It doesn't work.
PsaltyDS Posted February 27, 2011 Posted February 27, 2011 (edited) DllOpen() requires a string file name. DllCall() requires either the string filename or a handle to the already open DLL. You can't pass it a binary like that. The correct way to do it would be to save $DllBinary to a .dll file and then use that. But you knew that... Edit: Tweaked statement per trancexx nagging below. Edited February 28, 2011 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
trancexx Posted February 27, 2011 Posted February 27, 2011 PsaltyDS meant to say DllCall(), surely.Advanced user could try ♡♡♡ . eMyvnE
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now