12.07.2015 Views

Delcom DLL Manual - Delcom Products Inc.

Delcom DLL Manual - Delcom Products Inc.

Delcom DLL Manual - Delcom Products Inc.

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

3.0 Using the <strong>DLL</strong> in your applications.3.1 C ApplicationsThere are two ways to use the <strong>DLL</strong> in C applications, they are Link Implicitly and Link Explicitly.Implicitly link is the easiest to use. In Implicitly linking the <strong>DLL</strong> is loaded when your application loads. Toimplicitly link to the <strong>DLL</strong> add the <strong>DLL</strong> library file to your project and include the <strong>DLL</strong> header file in yoursource code. Then simply call the <strong>DLL</strong> functions. All example C code in this manual uses the implicitmethod.Explicitly linking allows your application to load the <strong>DLL</strong> at a defer time. For your application toExplicitly link to the <strong>DLL</strong> you will have to load the <strong>DLL</strong> with LoadLibrary() function. LoadLibrary loadsthe <strong>DLL</strong>, if not already loaded, and returns a handle to the <strong>DLL</strong>. Then using the <strong>DLL</strong> handle and the <strong>DLL</strong>function name of interest, call GetProcAddress() to obtain the address of the <strong>DLL</strong> function.GetProcAddress returns the function address, which you can use to call the <strong>DLL</strong> functions. When yourdone using the <strong>DLL</strong> you should call FreeLibrary() to release the <strong>DLL</strong> resources.3.2 VB ApplicationsWhen using the <strong>DLL</strong> in a VB application you must declare the <strong>DLL</strong> functions. To declare <strong>DLL</strong> proceduresuse the Declare statement to prototype each function.Declare Function publicname Lib "libname" [Alias "alias"] [([[ByVal] variable [As type] [,[ByVal] variable [As type]]...])] AsTypeExampleDeclare Function <strong>Delcom</strong>GetDeviceCount Lib “<strong>Delcom</strong><strong>DLL</strong>.dll” Alias“<strong>Delcom</strong>GetDeviceCount” (ByVal Count As Long) As LongAll the <strong>DLL</strong> functions have been declared in the <strong>Delcom</strong><strong>DLL</strong>.bas file. Simply add this file to your VBproject and then call the <strong>DLL</strong> function from your code as you would any other function.<strong>Delcom</strong> <strong>DLL</strong> <strong>Manual</strong> 4 of 21 June 9, 2011 Ver 1.1

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!