Simple C++ DLL Programming Tutorial

(My Original Blog Post: -*http://api-madness.com/post/simple-c-dll-programming-tutorial/)

Attention! API Garbage (might be unreadable):

DLL function using

Mrs. Brian from Vernon development.com and today I assure you how to make a DLL and how to use that and get a integer from your DLL or send integer to your DLL and first all you want to make a file save it using I m using code blocks is a free editor for C++ and the need to make a project for it and then we ll start with include iostream which is RC Odyssey and had windows.h which we will need for loading our DLL using namespace STD which will get rid of the STD:: for our Cialis in and then we are going to define a type using typedef with a return value of and a pointer called function message function which is our riches will we will use the label are tight and then into parameter for this basically is if you don t understand is that the function definition without actually having any function and then we have a hint as to the H. instance for a DLL which will hold our instance when the loader DLL and we have an insane starter program message function MessageBox windows will do is this will create a type message box which will be our function name which will have an integer argument and an integer return value just like I type definition are here and then MessageBox zero this will initialize that zero just in case about making mistakes in DLL equals load library is a function in Windows for us the loader library with rim in DLL called in for an adult.dll and we will check if his DLL is not empty and then MessageBox are function will call that from the DLL has to does the same kind as her type definition using jet prop address we can get the process from our yellow card and then we have a integer message box which will be a return value what we will be doing if this program will load the MessageBox function from our DLL and then we can now use it to send in a parameter called five and the function really is very simple assist the return that five edit input so X. will have five successful than we know that we call the function from ideal will display a message to tell us that it works and I was just to the
also this way I could have better free library this will prevent any memory leaks that will have so we need to free our DLL before we exit our program okay to say that control us and then also you may want to check if MessageBox does not equal zero or it may be legal zero that way you can display a message in case there is an error I say that a lot create a new project this will be our DLL actual, we ll just do new projects in any here you see this menu click on dynamic link library double-click this MessageBox dialog comes up just do adjectival DLL seems fine and suspended in a folder this create a release configuration will need to make it a debug version right we got to the project and auction actually already creates two files for you on the left side there is the main.cgi not been.h under the folders is automatically created by code blocks which we can use as would it look like with diverse wonders in the H. file remove this thing is we really need it or not to make a import DLL which is a live file not a DLL file reasoning explicit sewer using DLL export to justify that and then here were to change our function to be called MessageBox exactly like that and an integer is going to have an integer parameter and remember have an integer return value and this is just a case of C++ or C. so that will work in both RA and then say that control us may not see beauty in your gun I have to do the same changes in another source called MessageBox here is Mrs. and acts you can also make it a default value and then I guess you can have a running back any of us knew her work and year organ overturned acts because it just returns the primary that actually using an analyst with some text in here right and then it is just displays the icon information which is just the icon on the MessageBox that looks like! Or someone like that and then it ll display the okay button using the MB okay and then the title will be the DLL message and the tax will be join us that infernal and then although I might be wrong about that and then you have this DLL main which is the main WINAPI function that ll load and then were going to go grab this using the proper address so that s all we need to do for the DLL now you can build the project control F9R you should see this message which is a DLL.dll created but you need to have the same name as the file so you may have to rename it right we save it as a DLL project so agreed a deal about the oil but in here we actually use them for not all about the oil so you open up the folder dear Abby and her didn t release this year where every name this as inferno and develop were taking that are going to our launching sequence to put in the same folders that I can find it now you can activate project on the left side for the first program and do compile again just in case writer works and then you ll go here you ll chartered DLL and you get the message hope that helps and the pleas subscribe then come join us@infernaldevelopment.com and our forums as a new form so hope you join us thank you

Advertisements

~ by bitahatini on December 20, 2008.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: