PDA

View Full Version : Resource Only DLL



Centauri Soldier
08-17-2009, 02:44 PM
I have tried several resource editors but have not found exactly what I'm looking for just yet. I am trying to build a resource-only DLL and then call the resources in AMS.

Anyone know any good programs for creating the DLL? XN Resource Editor lets me create res and dcr files but I'm having trouble compiling them with Dev C++. Any pointers to relevant articles about this would be great. I spent hours searching through erroneous information and, as yet, haven't had success with finding helpful and clear info on how to create DLLs from res files.

Also, how are the resources called? I have spent a while reading about RO DLLs and can't quite peg the call procedure. Is it just LoadImage() or LoadModule()? How does this works?

After about a week of working with this problem I figured it might not be a bad idea to ask for some tips.

reteset
08-17-2009, 04:29 PM
How To Build A Resource Dll With Dev-C++ :


Open Dev-C++


From Main Menu : File -> New -> Project


On New Project Dialog : Select DLL And Save Your New Project


From Main Menu : File -> New -> Resource File


Rename Your Resource File Like MyResource ( do not use Resource as resource file name)


Open dll.h And Put This #define IDI_ICON1 100 After #define _DLL_H_


Open your MyResource.rc And Put This #include "dll.h"


Place An Icon File In To Your Project Directory , For Example : MyIcon.ico


Put This IDI_ICON1 ICON "MyIcon.ico" In To MyResource.rc


If You Did Above Correctly Press To Build Button From ToolBar


If You Will Get Some Compiler Errors Then Restart Dev-C++ And Build Project Again


Create An Empty AMS Project And Put An Instance Of Icon Object Plugin To Page Area


Copy OutPut Dll From Your Dev-C++ Project Directory And Paste In To Docs Folder Of Your AMS Project


Put This To On Show Event Of Your AMS Project
Icon.LoadEx("Plugin1", _SourceFolder.."\\AutoPlay\\Docs\\Project1.dll", "IDI_ICON1", 32, false);


Do Not Forget To Replace Dll Name With Yours


And PreView Your AMS Project


Good Luck :)


I Can Show Some Tips Later For Loading Resources From WithIn AMS

SGW
08-17-2009, 05:24 PM
Hi reteset,

I have been trying to call a function (in AMS 7.5) from a DLL made in C++ (Borland Delphi) in another posting thread. Can you help? So far, no success.

http://www.indigorose.com/forums/showthread.php?t=27673&goto=newpost

Regarding a tool to write C++ DLL's: while I suspect that the Dev-C++ may be a far better choice, the VisualStudio 2008 C++ edition is available for free at the Microsoft developer site. (I don't have the skills needed to successfully use it, but I think it can generate Win 32 DLL's in C++ (unmanaged code).

Kind Regards,

SGW

Centauri Soldier
08-17-2009, 05:51 PM
Thank you reteset! That was very informative. Now if I want to use an image would I just change IDI_ICON1 ICON "MyIcon.ico" to IDI_IMAGE1 IMAGE "MyImage.jpg" for all instances?

Imagine Programming
08-17-2009, 07:42 PM
I used to include resources in DLL's using PureBasic's resource system. Centauri, you've got purebasic right? Do you know how to generate/create *.rc resource scripts? It allows you to include files in your dll.

This is a nice way reteset, thank you :yes

Centauri Soldier
08-17-2009, 07:51 PM
Yes, I have PureBasic. I think I can generate those scripts with XN Resource Editor. Are you saying to compile the scripts with PureBasic?

Imagine Programming
08-17-2009, 08:40 PM
Yes, I have PureBasic. I think I can generate those scripts with XN Resource Editor. Are you saying to compile the scripts with PureBasic?

Yes, Compiler > Compiler options > Resources :) You can browse and add resource scripts and afterwards compile it as DLL (without any script).

If you get any bugs while you're compiling, message me, I might know the reason (happend to me plenty of times before:p)