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 

Passing a struct to c dll from vb

 
Post new topic   Reply to topic    msvisual.com Forum Index -> VB Syntax
Author Message
abhi.10dulkar



Joined: 04 Oct 2007
Posts: 6

PostPosted: Tue Jul 11, 2006 6:36 am    Post subject: Passing a struct to c dll from vb Reply with quote

Hi,
I am having some problem for getting values in struct from the c dll.

I have following definition

Type MBRINFO
szMember As String * 80 ' member name array
usLevel As Integer
End Type

I am passing this struct to c dll for getting back the values filled
from the dll

Declare Function GetMemberInfo Lib "xyz" (pInfo As MBRINFO) As Long

On c side I have code as following

struct MBRINFO
{
char szMember[80];
int usLevel;
}
long GetMemberInfo(MBRINFO * info)
{
long sts = 0;
memset(info,0,sizeof(MBRINFO ));
szMember(info->szMember,"Something");
info->usLevel = 10;
return sts;
}

The definition is exported from the xyz.dll for acess.
But, when I get value back on vb side, I noticed the value for szMember
is filled with assigned value which is "Something" folloed by lot of
space characters. Can somebody help me figure out how to avoid this
issue.

Thanks,
Abhijeet

Archived from group: microsoft>public>vb>syntax
Back to top
View user's profile Send private message
Display posts from previous:   
Related Topics:
Passing a struct to c dll from vb Hi, I am having some problem for getting values in struct from the c dll. I have following definition Type MBRINFO szMember As String * 80 ' member name array usLevel As Integer End Type I am passing this struct to c dll for getting back the

Passing Nothing into properties I'm a C# guy, recently having to work in VB.Net. I am trying to pass a null value into an integer property. My code looks like this: If MyVar = 0 Then = Nothing Else = MyVar End If When I step through it, the

Passing values to a sub I must be missing something obvious here, but how do you pass more than one value to a sub in VB6? For example, the following works perfectly fine: Sub Main Test(123) End Sub Private Sub Test(i As Integer) Debug.Print i End Sub But this doesn't work at al

Passing 2 arrays to a procedure Hi, I'm trying to write a VB6 program which will open a spreadsheet and call a macro within, passing 2 variables, and 2 dynamic arrays. I use the following syntax: objExcel.Run "DrawGrid", Form1.myRows,

passing up arrays to functions hi i have an array, and I wish to pass it to a function dim vz(1 to 5, 1 to 28) as integer sub test(byref var) end sub test(vz) I already read that i should use byref rather than byval, however, the script above still gives me an error (w
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