Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Using dll in VB6

glennatdeegeeglennatdeegee Member Posts: 3
Am I missing something here?

I need to create a dll in VB that I can then use in Visual FoxPro. To test this out I created the ThingDemo dll from the MSDN tutorial. My intention was to call the DebugID() function, which returns a long value.

So far so good. If I create a reference to the dll in a VB projects I can access the functions as required. What I need to do, however, is to use a declare statement - the one I am using at the moment in VB is "Declare Function DebugID Lib "ThingDemo.dll" () As Long" - when I try to call the DebugID() function I get the runtime error 453 "Can't find DLL entry point DebugID in ThingDemo.dll" If a try to use the dll in Visual FoxPro I get the equivalent error message (can't find entry point).

The DLL is in the path and I have made sure I have used the correct case for the declarations. What am I doing wrong?

Thanks in anticipation for your help.

Comments

  • nimnul2nimnul2 Member Posts: 131
    VB can't make DLLs like Windows' DLLs. It only can make ActiveX DLLs. Sorry, but Microsoft don't give us this chance in VB. You can use C++/Delphi/Asm... to build such a DLL.
  • glennatdeegeeglennatdeegee Member Posts: 3
    : VB can't make DLLs like Windows' DLLs. It only can make ActiveX DLLs. Sorry, but Microsoft don't give us this chance in VB. You can use C++/Delphi/Asm... to build such a DLL.
    :
    Thanks for your reply. Yep, after much reading and surfing a came to this conclusion. You can, however, use the ActiveX DLLs built in VB6 in the way I wanted to. If you're interested, reply to this post and I'll explain.
  • pradeep_sharmapradeep_sharma Member Posts: 7
    : : VB can't make DLLs like Windows' DLLs. It only can make ActiveX DLLs. Sorry, but Microsoft don't give us this chance in VB. You can use C++/Delphi/Asm... to build such a DLL.
    : :
    : Thanks for your reply. Yep, after much reading and surfing a came to this conclusion. You can, however, use the ActiveX DLLs built in VB6 in the way I wanted to. If you're interested, reply to this post and I'll explain.
    :

    I read your comment, I am also writing DLL in VB, Can you guide me, how to use DLL (created in VB) in other languages like VC++ , C++, Foxpro
    Kindly reply soon.
    Thx
  • glennatdeegeeglennatdeegee Member Posts: 3
    [b][red]This message was edited by glennatdeegee at 2002-11-14 1:2:47[/red][/b][hr]
    : : : VB can't make DLLs like Windows' DLLs. It only can make ActiveX DLLs. Sorry, but Microsoft don't give us this chance in VB. You can use C++/Delphi/Asm... to build such a DLL.
    : : :
    : : Thanks for your reply. Yep, after much reading and surfing a came to this conclusion. You can, however, use the ActiveX DLLs built in VB6 in the way I wanted to. If you're interested, reply to this post and I'll explain.
    : :
    :
    : I read your comment, I am also writing DLL in VB, Can you guide me, how to use DLL (created in VB) in other languages like VC++ , C++, Foxpro
    : Kindly reply soon.
    : Thx
    :

    I don't know about C++ or Visual C++ but I have used a DLL I built in Visual Basic in Visual FoxPro 6.

    I assume you have built your ActiveX DLL in Visual Basic. Lets assume that your DLL is called MyDLL, that it has a class member called MyDLLClass and that you want to use a method in that class that returns a value called MyDLLMethod. We'll also assume that the MyDLLMethod takes a string argument and returns a string value.

    In FoxPro, you would use something like:

    =======================================================

    * Create a reference to the 'MyDLL' DLL
    * objDLL can be any variable name

    objDLL=CreateObject("MyDLL.MyDLLClass")

    * Call the MyDLLMethod method in the MyDLLClass passing
    * in a string and accepting a string as the return value.
    * strVariable can be any variable name.

    strVariable=objDLL.MyDLLMethod("AnyString")

    * Clear the DLL from memory

    Clear dlls

    =======================================================

    If you don't use a CLEAR DLLs command in FoxPro, the DLL stays in memory until the end of the session.

    I hope this helps.




Sign In or Register to comment.