Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error calling DLL

Status
Not open for further replies.

ByzantianX

Programmer
Dec 18, 2000
103
I made a simple activeX dll (in Visual Basic), wanting to use some functions from it in different environments (Visual Basic, Delphi, Access 2.0). After a registration of that dll, the only way it seems to work is when referencing that particular dll (on project-references) from another visual basic project. Delphi used to send message "The procedure entry point 'name of the function' can not be located in 'name of the dll'..." and access 2.0 just didn't send any messages, it behaved like the function from dll send null string or 0 integer (depends on function I used to call from dll). What I did in activeX dll was that I made a module, put several public functions, made dll and after that I registered that dll. Could anyone help me with some idea what could be wrong?
 
First I would check the dll in Explorer via "Quick view" (in German "Schnellansicht"). In section "Export table" (in German "Exporttabelle") you find the exported functions.

It is important to write the name of the export function case sensitive, e.g. "DoSomething" differs from "Dosomething" !

Let me know whether this helps.

Regards
Roderich
 
Well, I can't see anything in my dll with the viewer I use.Instead, here's the code of my class, in Visual Basic:

VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
Persistable = 0 'NotPersistable
DataBindingBehavior = 0 'vbNone
DataSourceBehavior = 0 'vbNone
MTSTransactionMode = 0 'NotAnMTSObject
END
Attribute VB_Name = "dno"
Attribute VB_GlobalNameSpace = True
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True

Public Function DiskNo() As String
Dim volname As String
Dim sn As Long
Dim snstr As String
Dim maxcomplen As Long
Dim sysflags As Long
Dim sysname As String
Dim retval As Long

volname = Space(256)
sysname = Space(256)

retval = GetVolumeInformation("C:\", volname, Len(volname), sn, maxcomplen, _
sysflags, sysname, Len(sysname))
' Remove the trailing nulls from the two strings.
volname = Left(volname, InStr(volname, vbNullChar) - 1)
sysname = Left(sysname, InStr(sysname, vbNullChar) - 1)
' Format the serial number properly.
snstr = Trim(Hex(sn))
snstr = String(8 - Len(snstr), "0") & snstr
snstr = Left(snstr, 4) & "-" & Right(snstr, 4)
DiskNo = snstr
End Function

Thank you!
 
Are you using Visual Basic 5.0 ?
I think VB 5 is not able to produce "real" DLL's but only fake DLL's which can only be used by VB itself.

Anyway, why do you try to write a DLL with VB ? VB code is worst optimized and very slow compared to C or Dephi code.

It is very easy to implement the function in a DLL with Delphi and use it in C or Delphi programs.

wbr
Roderich
 
I do not use VB, but I have heard/read that VB is not capable of producing dll's. They are written in Visual C.
Am I wrong or not? S. van Els
SAvanEls@cq-link.sr
 
Actually, the reason why I had to write a dll in VB was that I couldn't register a Delphi dll with regsvr32. I always kept getting messages: LoadLibrary ("nameofDelphiDLL")failed. GetLastError returns 0x00000485

The amazing part is that I could use that Delphi dll within other Delphi aplications. What I need is a dll that could work , both in Delphi and in VB (and in Access as well).
VB can produce ActiveX dll, a bit more complicated (as far as I realized) than in Delphi, it obviously work only in VB or similar (Access 97/2000) environment (it have to be explicitily referenced in project/references list, not just in code like in Delphi), so, I would like to quit that way if I could only find out why I can't register a Delphi dll.
Best regards
 
Thank you! I've read the article and it's good. Theoretically, it looks great, but my dll still can not be registered (if I don't register it, I am not able to call it from different environment except Delphi). Is there anything that I missed (like function DllRegisterServer or something)?
 
Has anyone (EVER!!!) managed to get a VB6 ActiveX DLL to be compatible with Delphi(6)?

Having spent two day searching the internet I still can't find how to get it working. All I can find is people guessing at how to solve this problem and mis-information.

I'm getting the legendary "The procedure entry point ... can not be located in ..."

I can use Dephi DLLs in Delphi & VB and VB DLLs in VB but not VB DLLs in Delphi.

I am writing a wrapper for a third party DLL that cannot be accessed by Delphi.

VB and Delphi are the only Windows development languages we use, so anything else is not really an option.

I am also using Win2000 so use of QuickView is not an option.

Any help...

...Argh!!! This is driving me nuts!
 
I'll post this coz although I assume this is what people have eventually discovered no one seems to post it.

VB doesn not make 'normal' DLLs as standard, it makes Active-X DLLs which behave in a different way.

It is possible to buy additional programs to create 'normal' DLLs with VB, such that can be read in a standard way by Delphi, or any other language, but it does not do this by default.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top