Visual Studio C++ Language LoadLibrary Sample Snippet
While specific instructions are given here for Visual
Studio, the wh32.dll should be useable by any C++
compiler.
There are 2 ways you can use our library in a c++ program. One of them is the static method. In this method you link your program to a .lib file (provided with our package).
There are 2 ways you can use our library in a c++ program. One of them is the static method. In this method you link your program to a .lib file (provided with our package).
Structures
All structures you will need are defined in our online
manual or in the header file wh32.h supplied
with the library.
Dim month As Long
Dim day As Long
Dim year As Long
End Structure
Structure WITHHOLDING_TAXBODY_ID
Dim struct_size As Long
Dim error_return As Long
Dim state As Long
Dim muni_type As Long
Dim prompt_number As Long
Dim desired_entry As Long
Dim number_of_entries As Long
Dim muni_number As Long
Dim calc_number As Long
End Structure
Dim month As Long
Dim day As Long
Dim year As Long
End Structure
Dim struct_size As Long
Dim error_return As Long
Dim state As Long
Dim muni_type As Long
Dim prompt_number As Long
Dim desired_entry As Long
Dim number_of_entries As Long
Dim muni_number As Long
Dim calc_number As Long
End Structure
Function Declarations
You must declare the Withholding32 functions you will use. The first time you actually call one of these functions it will be loaded into memory by the operating system. Here is an example.
Declare Function WH32_Get_Prompt Lib "libwh32.dll"
(ByRef id As WITHHOLDING_TAXBODY_ID, ByVal ss As
String) As Long
Build Additions
Besides the .dll file we provide we also provide a .lib
file. The wh32.lib file is used in this passive
method. You link the wh32.lib file at build time
and then the wh32.dll library will be loaded
automatically by your application at run time.
To link the wh32.lib file you do the following:
1) In your Projects "Properties/Linker/General/Additional Library Directores" add an entry to point to the location of wh32.lib
2) In your Projects "Properties/Linker/Input/Additional Dependencies" add the name wh32.lib
Then build your application normally. At runtime you must make the file wh32.dll available in the same folder as your executable. It will be loaded automatically.
1) In your Projects "Properties/Linker/General/Additional Library Directores" add an entry to point to the location of wh32.lib
2) In your Projects "Properties/Linker/Input/Additional Dependencies" add the name wh32.lib
Then build your application normally. At runtime you must make the file wh32.dll available in the same folder as your executable. It will be loaded automatically.
Sample Execution Code
Here is a code snippet which shows how you would actually use one of the Withholding32 functions.
This particular snippet sets up an array of county
names and calculation codes for Marylang. Note that it
is required that any structure with a 'struct-size'
member be filled in correctly before calling the
function.
Public Const WH32_MARYLAND As Short = 25
'c language wh32.h has all defined
Dim wid As WITHHOLDING_TAXBODY_ID
Dim l As Long
Dim numberofthem As Long
Dim i As Long
thenam = " " 'pass at least 60 char blank
wid.struct_size=Len(wid) 'required
wid.state = WH32_MARYLAND
wid.muni_type = 0
wid.desired_entry = 0
l = WH32_Get_Prompt(wid, thenam) ' get number of entries
numberofthem = wid.number_of_entries
For i = 0 To numberofthem - 1
wid.desired_entry = i
l = WH32_Get_Prompt(wid, thenam)
marylandcounty.Items.Add(thenam)
county_calc_number(i) = wid.calc_number
Next
Dim wid As WITHHOLDING_TAXBODY_ID
Dim l As Long
Dim numberofthem As Long
Dim i As Long
thenam = " " 'pass at least 60 char blank
wid.struct_size=Len(wid) 'required
wid.state = WH32_MARYLAND
wid.muni_type = 0
wid.desired_entry = 0
l = WH32_Get_Prompt(wid, thenam) ' get number of entries
numberofthem = wid.number_of_entries
For i = 0 To numberofthem - 1
wid.desired_entry = i
l = WH32_Get_Prompt(wid, thenam)
marylandcounty.Items.Add(thenam)
county_calc_number(i) = wid.calc_number
Next