Quick Search for:  in language:    
ZERO,DLL,Creating,ActiveX,DLLs,compatability,
   Code/Articles » |  Newest/Best » |  Community » |  Jobs » |  Other » |  Goto » | 
CategoriesSearch Newest CodeCoding ContestCode of the DayAsk A ProJobsUpload
C/ C++ Stats

 Code: 715,766. lines
 Jobs: 108. postings

 How to support the site

 
Sponsored by:

 
You are in:
 
Login





Latest Code Ticker for C/ C++.
Dos password
By William Simpson on 2/3


Click here to see a screenshot of this code!WinCodeGen
By Kruncher on 2/3

(Screen Shot)

Simple Calculator with +, -, * and / Functions
By Soul Fire on 2/3


Click here to see a screenshot of this code!Fast HTTP Server
By Kruncher on 2/3

(Screen Shot)

Click here to see a screenshot of this code!Dos Write
By Invision Software on 2/2

(Screen Shot)

Click here to see a screenshot of this code!WinTrick
By Kruncher on 2/2

(Screen Shot)

Click here to see a screenshot of this code!Colours in Console
By Mike C. on 2/2

(Screen Shot)

Click here to see a screenshot of this code!MasterX SDK 2.1
By Jared Bruni on 2/2

(Screen Shot)

Click here to see a screenshot of this code!DirectX 8 Animated Fractals
By Jared Bruni on 2/2

(Screen Shot)

Click here to put this ticker on your site!


Add this ticker to your desktop!


Daily Code Email
To join the 'Code of the Day' Mailing List click here!

Affiliate Sites



 
 
   

An almost complete DLL guide!

Print
Email
 

Submitted on: 9/3/2003 10:42:42 PM
By: D Davis  
Level: Intermediate
User Rating: By 31 Users
Compatibility:C++ (general), Microsoft Visual C++

Users have accessed this article 10831 times.
 
(About the author)
 
     + Creating ActiveX DLL's in VB (and compatability issues),<BR> + Creating DLL's in C++,<BR> + Using ActiveX DLL's in VB apps,<BR> + Using Non-ActiveX DLL's in VB app and C++ apps,<BR> + Loading DLL's DYNAMICALLY in both VB and C++ (Good for plug-ins),<BR> + Calling a function by a string (Good for scripting programs). <p> This article was written for alot of reasons. For one, I needed to learn how to load and use DLL's and get a better understanding of doing so. Another was because there are so many shxtty examples out there today it's not even funny. Plus I found ZERO information on most of the stuff I go over. Every tutorial I've seen on how to make a DLL covers making one, then using the 'Declare' statement to utilize them. Not any good for plug-ins. Plus, the other half of the tutorials didnt even work! Anyways, I wrote this to try and sum up all of the half-ass tutorials and the complex, cryptic information and fill in the non existant information. I try to explain as best as I can. I know there might be slight changes that have to be done in order for it to work with you, but so be it. Make them and write about it to teach others. <P> I hope that this gives everyone a better idea of how to use DLL's and add flexability to their applications/games.
 
winzip iconDownload article

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.

Virus note:All files are scanned once-a-day by Planet Source Code for viruses,but new viruses come out every day, so no prevention program can catch 100% of them.

FOR YOUR OWN SAFETY, PLEASE:
1)Re-scan downloaded files using your personal virus checker before using it.
2)NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
Terms of Agreement:   
By using this article, you agree to the following terms...   
1) You may use this article in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.   
2) You MAY NOT redistribute this article (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
3) You may link to this article from another website, but ONLY if it is not wrapped in a frame. 
4) You will abide by any additional copyright restrictions which the author may have placed in the article or article's description.


Other 1 submission(s) by this author

 

 
Report Bad Submission
Use this form to notify us if this entry should be deleted (i.e contains no code, is a virus, etc.).
Reason:
 
Your Vote!

What do you think of this article(in the Intermediate category)?
(The article with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor See Voting Log
 
Other User Comments
9/3/2003 10:51:20 PM:D Davis
Yes, I did post this in two categories since it deals with VB and C++.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
9/4/2003 4:46:08 AM:Psyc
very good article.. thanks! :) [5 glbs]
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
9/5/2003 2:14:42 PM:maniac
very nice, 5 from me
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
9/7/2003 8:00:23 AM:Ali Akbar
Excellent Article. Thanks.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
9/7/2003 12:21:30 PM:
very nice, i was wanting to learn some of that stuff
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
9/10/2003 4:38:01 AM:
Very useful article, with useful information.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
9/11/2003 5:27:36 AM:John Bell
Umm, stdafx? ack....I prefer the hard way. If you want info on loading dll's into other processes(cross-task subclassing) I submitted an article on how to do this for aol. fallenhobit is the name its submitted under. Peace.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
9/11/2003 10:13:38 AM:D Davis
I agree! I only used the stdafx for easy setup purposes. that's it. I prefer the hard way as well!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
9/12/2003 2:17:31 PM:
Thanks for the article! I've been wanting to do some of this myself and this will at least get me started before I head off into the dark...
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
9/16/2003 4:08:12 PM:John Mikhaiel
just wanted to let you know that in the Accessing you Dll Code, before the end of the process, its better to include the following line: Set MyDll = Nothing to free it up this way itll free up memory wit it, and its unloaded properly. the reason y i think it should be included is cause you also included the loading process (CreateObject) so if the code loads it, it should unload it. not tryin 2 be smart or anythin.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
9/16/2003 4:20:36 PM:John Mikhaiel
also for users of older vb versions: vb5 supports ActiveX Dlls, and the 32bit version of VB4 (but ActiveX Dlls were called OLE Dlls). the 16bit version of VB4 supports only ActiveX EXEs which if written correctly are the same as the Dlls but can also be stand-alone programs (NOTE That vb4 16bit is only good for compatibilty with windows 3.1 and is pretty useless otherwise, vb4 32, and 16 are on the same installation CD).
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
10/9/2003 7:11:19 PM:Jonathan Ho
Just what I needed. Very concise. 5 from me!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
12/3/2003 4:47:30 PM:Wolf McCloud
I don't really see the use of this for me but it looks nice for beginners that can't learn by themselves... I'll vote like other people. :)
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
12/3/2003 5:05:30 PM:D Davis
This article was meant for people who have never been involved in complex projects, or have no experience with design docs. Hopefully it didnt come off as a guideline for experts as well as it was not intended to be. It's basically a place to start for those who have never worked in organized projects.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
12/25/2003 6:51:49 AM:mugman21
PART 1: Great Job, this is a very nice piece of work. First, when calling the dll, there is no need for all the fancy api calls (load library, getprocaddress,freelibrary yada yada yada). Just do this... In your dll, change: int MyDLLFunc1() { MessageBox(NULL,"My DLL Function 1","",MB_OK); return true;} to: int _stdcall MyDLLFunc1() { MessageBox(NULL,"My DLL Function 1","",MB_OK); return true; }
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
12/25/2003 6:52:20 AM:mugman21
PART 2: NOTE THE KEY PRASE "_stdcall" I ADDED!!! After that is done, you can call the dll normally, like anyother. For example, in vb just do a "Private|Public declare function MyDLLFunc1 lib "The_DLL_Name" () as long" This goes for C++ as well. This makes it a lot easier. As you can see, in vb after you declare the api to call it you only use it's name: Command_Click() MyDLLFunc1 End Sub One thing you mentioned in your article is the use of .def files. I use that method myself, but if I recall correctly, you said you did not know of any other way to export functions. This function __declspec(dllexport) allows you to do it without creating a .def file. I never use it, although it supposedly creates a smaller dll.Thanks for your submission, and hope you release an updated article soon, thanks and take care.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
12/25/2003 7:09:51 AM:mugman21
One more thing, the dll needs to be in the app.path directory, the winnt|windows dir, or the system32 dir. D Davis, I hope you would release an update to this article soon, I think what you created was excellent.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
1/19/2004 9:07:05 AM:
Listen to this dude he knows what hes talking about, ok
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
1/27/2004 3:03:28 AM:RAJENDRA
Very helpful articles
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
Add Your Feedback!
Note:Not only will your feedback be posted, but an email will be sent to the code's author in your name.

NOTICE: The author of this article has been kind enough to share it with you.  If you have a criticism, please state it politely or it will be deleted.

For feedback not related to this particular article, please click here.
 
Name:
Comment:

 

Categories | Articles and Tutorials | Advanced Search | Recommended Reading | Upload | Newest Code | Code of the Month | Code of the Day | All Time Hall of Fame | Coding Contest | Search for a job | Post a Job | Ask a Pro Discussion Forum | Live Chat | Feedback | Customize | C/ C++ Home | Site Home | Other Sites | About the Site | Feedback | Link to the Site | Awards | Advertising | Privacy

Copyright© 1997 by Exhedra Solutions, Inc. All Rights Reserved.  By using this site you agree to its Terms and Conditions.  Planet Source Code (tm) and the phrase "Dream It. Code It" (tm) are trademarks of Exhedra Solutions, Inc.