Similar Threads
1. Can you dynamically build a function call ? - VB.Net
2. Build VB ActiveX Dll to call functions
Hello, I have a problem building and using an activeX dll. I would
appreciate it if anyone could help:
I have written some complex functions. I have a complex type with .real and
.imag part as follows:
Type Complex
Real As Double
Imag As Double
End Type
and several functions of the type:
Function Complex_Conjg(Compl As Complex) As Complex
The type and the functions work fine from within the project. Now, I would
like to include them in an activeX dll, and have them available for another
VB application from the DLL.
I do the following:
1. Start a new activeX DLL, include the type and the functions in the class,
build the xxx.dll.
2. Start a new application (standard exe), make a reference to xxx.dll, and
declare the functions in a module as (for the above function):
Public Declare Function Complex_Conjg Lib "xxx" (Compl As Complex) As
Complex
3. I see that the type Complex is now available for the new project. When I
press F2 i can also see the functions of the DLL. But when I Call the
functions from within the code, I get an error:
Run-time error '453':
Can't find DLL entry point Complex_Conjg in xxx
What is wrong? Is there a way to have the functions available for the new
project? Thanks in advance.
3. How can I call a canned visual basic program from LabVIEW 6.1 and 7.1
4. Calling API functions dynamically?
I need to be able to call the same API function from VB, which will
reside in different DLLs. While all of the functions have the same
signature and name, DLL file names are not known at compile time.
Therefore, my assumption that using Declare statement or DllImport
attribute is NOT an option in such a case.
I can use LoadLibrary() and GetProcAddress() from Kernel32 to get the
addreses, but is there a way to actually call an API method by its
address from VB? Or can anyone suggest anything else?
TIA!
5. Dynamically open forms, reports or call functions - VB.Net
6. Dynamically select function calls
I am writing an application to do some complicated calculations on a
database. As a debug aid, I need a subroutine that will generate a
formatted report of dynamically selected fields in the database where
some non-trivial formatting is required. There are too many fields in
the database to generate a report showing them all and I may only be
interested in a few fields at any one time.
For example, I may want a report showing field A, C, G, and K. The
formatting for some of the fields is non-trivial. I did not want to
write a bunch of custom report procedures and then have to rewrite
them every time I needed a new report. I also wanted to be able to
easily rearrange the order of the fields (columns) in the report.
Here's what I came up with. I'm wondering if there is a better way to
go:
1. I wrote a separate formatting routine for each field in the
database. Each routine formats one of the fields. It also generates an
appropriate header. In some cases, it also compares the current record
to the previous record and formats the change. Each of these fields is
appended to a global variable (sNew, sHdr, sOld, sDif). Each of the
results are the same width so they will line up in columns using a
monospace font.
Public Sub FormatFieldA(sOptions as String)
...Format the Field A data and append it to a global variable
sNew = sNew & (formatted field data)
sHdr = sHdr & (formatted header)
...
End Sub
Public Sub FormatFieldB(sOptions as String)
...Format the Field B data and append it to a global variable
...
End Sub
2. I then wrote a procedure that would call these field-formatting
functions in any order as determined by a string parameter containing
a list of field keywords:
Call FormatDbRec(rs,"field-a field-g field-c ...")
The "rs" parameter is a record set variable containing the current
database record to be formatted.
Inside FormatDbRec I use Split and Select Case to decide which
formatting routine to call:
Public Sub FormatDbRec(ByRef rs As Recordset, sFields as String)
Dim i As Integer 'Loop index
sArray = Split(UCase(sFields))
For i = 0 To UBound(sArray)
If Len(sArray(i)) > 0 Then
Select Case sFields(i)
Case "FIELD-A": Call FormatFieldA
Case "FIELD-B": Call FormatFieldB
Case "FIELD-C": Call FormatFieldC
...
End Select
End If
Next
The calling routine can then do whatever it needs to do with the
formatted report variables.
Is there a better way to do this?
Thanks
--
Running MS VB 6.0 Pro (SP5) on Win2K-SR2
For email, use Usenet-20031220 at spamex.com
7. Calling functions dynamically - Visual Basic/VB
8. Calling API functions dynamically?
On 22 May 2006 13:30:39 -0700, "Chris Dunaway" < XXXX@XXXXX.COM >
wrote:
>Usenet User wrote:
>> I need to be able to call the same API function from VB, which will
>> reside in different DLLs. While all of the functions have the same
>
>Why would you do this? Are you trying to create some sort of "plugin"
>architecture? Do you have control over the .dll you are trying to call
>or are they 3rd party?
>
Yes, we have a bunch of DLL from different vendors that implement the
same methods.
>Perhaps you could create a single class in which you pass the name of
>the .dll as a string and then inside the class, call the api method
>based on that string.
Well, I am not quite sure what you have in mind. I would still need a
static Declare with the hardcoded DLL name. No?
Thanks!