codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  Declare VC++ dll in VB  ProgGuru at 07:41 on Thursday, May 18, 2006
 

I have a dll name Vlapi.dll with library VLAPI.LIB, this library or dll use to access common memory in another computer or server. What my problem, this dll is working find in VC++ the code is:

------------------------------------------VC++ Coding-----------------------------------------
#include <windows.h>
#include <stdio.h>
#include "include\vla_win.h"

void main()
{

ULONG rc;
struct VLA_Open_ParaN u;

HANDLE hHandle;

rc=2;
u.lAppBufWsize = 0;
u.lRxMsgBsize = 0;
strcpy(u.szName,"Sameer");
strcpy(u.szServerName,"c5");
rc=VLA_OpenN(&u,&hHandle);

if(rc)
{
printf("Connection is success\n");
return;
}
else
{
printf("Connection is unsuccess\n");
return;
}

VLA_CloseN(hHandle);

}
---------------------------------------------------------------------------------------------------
----------------------------- declaration definition of the dll-----------------------------------
Function: ULONG ret = VLA_OpenN(struct VLA_Open_ParaN *u, HANDLE *hHandle);

Parameters
struct VLA_Open_Para {
LONG lAppBufWsize;
LONG lRxMsgBSize;
CHAR szName[9];
CHAR szServerName[20]; // host computer name, max 19 chars
}
HANDLE hHandle; // handle to the pipe

NO_ERROR (=0): connection established
SMEM_ERR_CANNOT_OPEN (=51): failed to connect.
----------------------------------------------------------------------------------------------------

but I am not able to access through vb: my code is:

-----------------------------------------VB6 Coding------------------------------------------
Type VLA_OPEN_PARA
lAppBufWsize As Long
lRxMsgBsize As Long
szName As String * 9
szServerName As String
End Type

Dim hwnd As Long

Declare Function VLA_OpenN Lib "VLAPI" (u As VLA_OPEN_PARA, hwnd As Any) As Long

Public Function OpenSmem(sOpenName As String) As Long
Dim u As VLA_OPEN_PARA
Dim hHandle As Long

u.lAppBufWsize = 0
u.lRxMsgBsize = 0

u.szName = sOpenName
u.szServerName = "c5"
u.szServerName = Trim(u.szServerName)

OpenSmem = VLA_OpenN(u, hHandle)

End Sub
--------------------------------------------------------------------------------------------------

Is there any problem in the declaration of my VC++ equivalent in VB.

Please help me.

Regards,
Seyalt








CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
•  session time out
•  Scroll To Not Fully working in IE...
•  Re: document.write in IE and Mozilla/Netscape.
•  Re: info out of an video example
•  Re: Help: Trouble with z-Index and SELECT lists
•  perl siganl handling in Term::Readline
•  position of a page inside a pop-up in javascript
•  Ugent Help needed
•  java help questions


Recent Articles
Javascript OnMouseDown
Pointer types and Arrays
What is a pointer in C?
Multiple submit buttons with form validation
Understanding Hibernate ORM for Java/J2EE
HTTP screen-scraping and caching
a javascript calculator
A simple way to JTable
Java Native Interface (JNI)
Parsing Dynamic Layouts


© Copyright codetoad.com 2001-2006