Featured Posts

Device Context, Application Programming Interface(API), Dynamic Link Library.

Device Context

A device context is an area of memory used to represent n image by the windows system.  This is can be an image intended for either display or the printer.  A device context can correspond to all types of devices, like the screen or the printer.  When we have set up our graphics to appear in a device context, the display can appear in many different types of devices, including the screen or printer.
    To draw in our view, we use a device context corresponding to the view.  The CDC class is a class which supports device contexts.  We use CDC Textout() method to print in the view ( which corresponds to windows client area).  We are passed a pointer, PDC, in OnDraw(), which points to a device context for our view.
       A program may pass different device context to the OnDraw() method at different times.  For eg. If we have placed code in OnDraw (), also our program already supports print item from the file menu, the program passes a device context to OnDraw() which corresponds to the printer, & our text is printed out.  

 API ( Application Programming Interface ) :->

API is a acronym for Application Programming Interface.  It is a set of functions that are part of window OS.  Program can be created by calling the functions present in the API.  The programming do not have the internal working of the functions.  By just knowing the function prototype and return value on invoke the API function.

Window API are of two basic varities
->  API for 16bit windows ( win 16 API )
->  API for 32 bit windows ( win 32 API )

Win 16 API
Win 32 API

 DLL ( Dynamic Link Library )

Dynamic Link Library is a specific form of application code loaded into memory by request.
It is not executable by itself.  A DLL is a binary file that provides a library of functions, objects and resources.
All the API functions are contained in the Dynamic link libraries.  The functions present in DLL's can be linked during execution.
These function can also be shared between several applications running in windows.
Since, linking is done dynamically, the function do not become a part of the executable file.  As a result the size of .exe file do not go out of hand.
It is also possible to create your own DLL's for the following reasons :->
->  Sharing common code between different executable file.
->  Breaking an application into component parts to provide a way to easily upgrade applications components.
->  Keeping resource data out of an applications executable file but still readily accessible to an application.

      More than one application can use the function provided by a DLL, reducing overall memory requirements.  When more then one application is running.
     Thus, a dynamic link library (DLL) is a file that acts as a shared library of functions.
Dynamic linking provides a way for a process to call a function that is not part of it executable code.  The executable code for the function is located in a DLL, which contains one or more functions that are compiled, linked and stored separately from the process .  DLL's also facilitate the sharing of data and resource's.  Multiple applications can simultaneously access the contents of a single copy of a DLL in memory.
       Dynamic linking differs from static linking in that it allows an executable module to include only the information needed at run time to locate the executable code for a DLL function.
      In static linking, the linker gets all of the referenced functions from the static link library and places it with your code into your executable file.
      Dynamic link libraries save memory and disk space.

Post a Comment


www.posthatke.com. Powered by Blogger.
Copyright © www.posthatke.com | Blogger Templates | Designed By posthatke.com