Previous Thread
Next Thread
Print Thread
Rate Thread
#17526 11/19/03 01:55 PM
Joined: Nov 2003
Posts: 2
P
Junior Member
Junior Member
P Offline
Joined: Nov 2003
Posts: 2
Hi AVi here,

I'am new on this board.
I'am dealing with a dll written in C.

De function is declered in C as follows:

int IOTSVC_API iotsvc_Open(unsigned long *pulHandle, char *csTarget, iotlayout_t *pLayout);

How should i declare this function within VB6 and how can i access the functioncall.

Hopefully someone can help me further with this.

AVI

Sponsored Links
▼ Sponsored Links ▼ ▲ Sponsored Links ▲
#17527 11/20/03 11:48 AM
Joined: Oct 2003
Posts: 17
Junior Member
Junior Member
Joined: Oct 2003
Posts: 17
something like this...

Private Declare Function iotsvc_Open Lib "dll's
name.." (pulHandle as long, csTarget as char,
pLayout as iotlayout_t)

this probly won't work but it should look like this
u might have to play with it abit...

#17528 11/22/03 07:42 PM
Joined: Mar 2002
Posts: 1,273
DollarDNS Owner
DollarDNS Owner
Joined: Mar 2002
Posts: 1,273
Not quite, this is the VB declaration:

Private Declare iotsvc_Open Lib "dllname.dll" (pulHandle As Long, ByVal csTarget As String, pLayout As iotlayout_t) As Long

There is no such thing as type 'char' in VB6 and strings must ALWAYS be declared ByVal so that the pointer to the string is passed and not the pointer to the variable.


Domain Registration, Hosting, Management
http://www.dollardns.net
#17529 11/24/03 12:02 PM
Joined: Nov 2003
Posts: 2
P
Junior Member
Junior Member
P Offline
Joined: Nov 2003
Posts: 2
Hi,

I'am still having difficulties in VB with the use of a function call in a certain C DLL.

The DLL function is described below. There is a struct in it aswell.
Hopefully you have an answer to this. I tried a lot but nothing will work.

int IOTSVC_API iotsvc_Open(unsigned long *pulHandle, char *csTarget, iotlayout_t *pLayout);

typedef struct
{
unsigned char ucType;
char csName[16];
unsigned short usTotalNoInputs;
unsigned short usNoAnalogeInputs;
unsigned short usNoDigitalInputs;
unsigned short usTotalNoOutputs;
unsigned short usNoAnalogeOutputs;
unsigned short usNoDigitalOutputs;
} iotmodule_t;

typedef struct
{
unsigned short usTotalNoInputs;
unsigned short usTotalNoOutputs;
unsigned short usNoIOmodules;
iotmodule_t IOmoduleInfo[MAX_NO_IO_MODULES];
} iotlayout_t;

How should i declare this in VB ??
and how can i access the C function in VB ??

Thank for your help

AVI

#17530 11/24/03 03:58 PM
Joined: Mar 2002
Posts: 1,273
DollarDNS Owner
DollarDNS Owner
Joined: Mar 2002
Posts: 1,273
I already stated the function declaration in my previous post. Here's the structure declarations:

Private Type iotmodule_t
ucType As Byte
csName As String * 16
usTotalNoInputs As Integer
usNoAnalogeInputs As Integer
usNoDigitalInputs As Integer
usTotalNoOutputs As Integer
usNoAnalogeOutputs As Integer
usNoDigitalOutputs As Integer
End Type

Private Type iotlayout_t
usTotalNoInputs As Integer
usTotalNoOutputs As Integer
usNoIOmodules As Integer
IOmoduleInfo(MAX_NO_IO_MODULES) As iotmodule_t
End Type


Domain Registration, Hosting, Management
http://www.dollardns.net

Link Copied to Clipboard
Member Spotlight
None yet
Forum Statistics
Forums41
Topics33,840
Posts68,858
Members2,176
Most Online3,253
Jan 13th, 2020
Latest Postings
Top Posters
UGN Security 41,392
Gremelin 7,203
§intå× 3,255
SilentRage 1,273
Ice 1,146
pergesu 1,136
Infinite 1,041
jonconley 955
Girlie 908
unreal 860
Top Likes Received
Ghost 2
Dartur 1
Cyrez 1
Girlie 1
unreal 1
Powered by UBB.threads™ PHP Forum Software 8.0.0