msvisual.com Forum Index
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How can I to pass an array in a function argument?

 
Post new topic   Reply to topic    msvisual.com Forum Index -> VB Syntax
Author Message
Carlos Villaseņor M.



Joined: 04 Oct 2007
Posts: 7

PostPosted: Sat Jul 22, 2006 2:23 am    Post subject: How can I to pass an array in a function argument? Reply with quote

Hi everybody!

I finally have success implementing my first DLL function, I have exported a
C++ function with a DLL using the "Declare" statement in Basic, but now I
have a doubt, how can I to pass an array in the DLL function parameters
list, I need to pass y return the same array, but changed, to my Basic
application.

Below I show my code in Basic:

Private Declare Function CreateDll3 Lib "DLL3.dll" () As Long
Private Declare Sub DestroyDll3 Lib "DLL3.dll" (ByVal objptr As Long)
Private Declare Function GetCpuSpeedDll3 Lib "DLL3.dll" (ByVal objptr As
Long) As Integer

Private Declare Sub valor_prueba Lib "DLL3.dll" (ByVal objptr As Long, ByRef
val()) <--------- this is te function that need to pass an array

Private Declare Sub InitCommonControls Lib "comctl32.dll" ()

Private Sub Form_Initialize()

InitCommonControls
ChDir App.Path

End Sub

Private Sub Command1_Click()

Dim nSpeed As Integer
Dim s As String
Dim s2 As String
Dim objptr As Long
Dim valor(0 To 3) As Integer


valor(0) = 3
valor(1) = 3
valor(2) = 3

Screen.MousePointer = vbHourglass
objptr = CreateDll3()
nSpeed = GetCpuSpeedDll3(objptr)
valor_prueba(objptr, valor()) <--------Here I call the DLL function, I
don't know if this is right....


DestroyDll3 (objptr)
Screen.MousePointer = 0

s = nSpeed
Form1.Text1.Text = "GetCpuSpeedDll3(objptr) returned " + s
Form1.Text2.Text = "El valor calculado es " + s2

End Sub


I appreciate some help!

Thank you
Carlos Villaseņor

Archived from group: microsoft>public>vb>syntax
Back to top
View user's profile Send private message
Display posts from previous:   
Related Topics:
can you pass an array as optional to a sub or function? hello, I'd like to pass an optional array to my sub. This syntax works Public Sub As String, arrMyArray() As Integer) ... End Sub but as soon as I add Optional, the VB IDE highlights the code in red - obviously it doesn't like this: Public

passing a ParamArray argument to another function in VB6 I have a Sub that takes a ParamArray argument. I want to pass the argument to a function with the following signature: Public Function Text As String, _ ParamArray args() As Variant) As String However, when I do this, args becomes a 2 di

How to pass function name as a parameter? Hi, I want to pass a function pointer to another function as a parameter. Is it possible in VB? here's C++ example: ---- int i) { return (int)(i + 10); } int { return pFunction(5); } void main() { in

How to pass a double array address stored in a variant to a I need to pass a double array address stored in a variant to a double pointer in a dll. But I donot know the Variant type memory structure. Is there any body can help me? Thanks, Minfu

transfaring dimamic array with function Hello there I have function that need to get reference to dinamic array and fill it inside how this thing is possible in VB6?
Post new topic   Reply to topic    msvisual.com Forum Index -> VB Syntax All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group