How to call a dll in ASP ?

Discussion in 'ASP General' started by fiefie.niles@gmail.com, Mar 18, 2007.

  1. Guest

    We have a C++ DLL that we call from VB6 program.
    This is how we declare the DLL in VB6:
    Declare Function RefSearch Lib "csearch32.dll" (ByVal path As String,
    ByVal findword As String, ByVal CaseSensitive As Integer) As Integer

    This is how we call the DLL in VB6:
    hit = RefSearch(path, SearchStr1, ChkValue)

    Can I call this DLL in ASP and how ?
    Thank you.
     
    , Mar 18, 2007
    #1
    1. Advertising

  2. McKirahan Guest

    <> wrote in message
    news:...
    > We have a C++ DLL that we call from VB6 program.
    > This is how we declare the DLL in VB6:
    > Declare Function RefSearch Lib "csearch32.dll" (ByVal path As String,
    > ByVal findword As String, ByVal CaseSensitive As Integer) As Integer
    >
    > This is how we call the DLL in VB6:
    > hit = RefSearch(path, SearchStr1, ChkValue)
    >
    > Can I call this DLL in ASP and how ?


    Is the DLL "apartment threaded"?
    Can you recompile it to be?

    Creating Visual basic COMponents for ASP
    http://www.macronimous.com/resources/tutorials/asp_vb_dll.asp

    Calling a Visual Basic Component Subroutine from ASP
    http://www.thescripts.com/forum/thread51438.html
     
    McKirahan, Mar 18, 2007
    #2
    1. Advertising

  3. Guest

    Thanks.

    The DLL is a VC++ DLL, not a VB DLL. There is no class that I can call
    it like
    Set objName = Server.CreateObject("ProjectName.ClassModuleName")
    I want to call this VC++ DLL from ASP


    On Mar 18, 1:15 pm, "McKirahan" <> wrote:
    > <> wrote in message
    >
    > news:...
    >
    > > We have a C++ DLL that we call from VB6 program.
    > > This is how we declare the DLL in VB6:
    > > Declare Function RefSearch Lib "csearch32.dll" (ByVal path As String,
    > > ByVal findword As String, ByVal CaseSensitive As Integer) As Integer

    >
    > > This is how we call the DLL in VB6:
    > > hit = RefSearch(path, SearchStr1, ChkValue)

    >
    > > Can I call this DLL in ASP and how ?

    >
    > Is the DLL "apartment threaded"?
    > Can you recompile it to be?
    >
    > Creating Visual basic COMponents for ASPhttp://www.macronimous.com/resources/tutorials/asp_vb_dll.asp
    >
    > Calling a Visual Basic Component Subroutine from ASPhttp://www.thescripts.com/forum/thread51438.html
     
    , Mar 18, 2007
    #3
  4. <> wrote in message
    news:...
    > We have a C++ DLL that we call from VB6 program.
    > This is how we declare the DLL in VB6:
    > Declare Function RefSearch Lib "csearch32.dll" (ByVal path As String,
    > ByVal findword As String, ByVal CaseSensitive As Integer) As Integer
    >
    > This is how we call the DLL in VB6:
    > hit = RefSearch(path, SearchStr1, ChkValue)
    >
    > Can I call this DLL in ASP and how ?
    > Thank you.
    >


    Create an VB6 ActiveX DLL. In the project properties it is very important
    that both Unattended Execution and Retained In Memory are selected otherwise
    your site will crash for almost inexplicable reasons. For performance
    reasons apartment threading is strongly recommend. You do not need to
    recompile your existing C++ dll.

    You VB6 code can look something like this:-

    'Project MyAspHelper

    'Class CSearch

    Private Declare Function RefSearch Lib "csearch32.dll" (ByVal path As
    String,
    ByVal findword As String, ByVal CaseSensitive As Integer) As Integer

    Public Function Search(ByVal Path As String, ByVal FindWord As String, ByVal
    CaseSensitive As String) As Integer
    Search = RefSearch(Path, FindWord, CaseSensitive)
    End Function


    Now in ASP you can use:-


    Dim oSearch : Set oSearch = CreateObject("MyAspHelper.CSearch")

    Dim lRes

    lRes = oSearch.Search(FileName, "Hello", False)
     
    Anthony Jones, Mar 18, 2007
    #4
  5. wrote:
    > Thanks.
    >
    > The DLL is a VC++ DLL, not a VB DLL. There is no class that I can call
    > it like
    > Set objName = Server.CreateObject("ProjectName.ClassModuleName")
    > I want to call this VC++ DLL from ASP
    >
    >


    There has to be. It has to be a COM object in order to call it from any
    scripting language that I'm familiar with.
    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"
     
    Bob Barrows [MVP], Mar 18, 2007
    #5
  6. Guest

    Great idea, thank you.
    I tried it, but the weird thing is when I call that VB6 ActiveX DLL
    from VB6, it search fine.
    For example: I have a document with the word "FieFie" in it. Calling
    the DLL from VB6, I can search for fiefie, or fie, or Fie and it will
    find all of them.
    Calling the DLL from ASP, when I search for Fie it will find it, but
    when I search for fiefie or fie, it does not find it.

    On Mar 18, 3:13 pm, "Anthony Jones" <> wrote:
    > <> wrote in message
    >
    > news:...
    >
    > > We have a C++ DLL that we call from VB6 program.
    > > This is how we declare the DLL in VB6:
    > > Declare Function RefSearch Lib "csearch32.dll" (ByVal path As String,
    > > ByVal findword As String, ByVal CaseSensitive As Integer) As Integer

    >
    > > This is how we call the DLL in VB6:
    > > hit = RefSearch(path, SearchStr1, ChkValue)

    >
    > > Can I call this DLL in ASP and how ?
    > > Thank you.

    >
    > Create an VB6 ActiveX DLL. In the project properties it is very important
    > that both Unattended Execution and Retained In Memory are selected otherwise
    > your site will crash for almost inexplicable reasons. For performance
    > reasons apartment threading is strongly recommend. You do not need to
    > recompile your existing C++ dll.
    >
    > You VB6 code can look something like this:-
    >
    > 'Project MyAspHelper
    >
    > 'Class CSearch
    >
    > Private Declare Function RefSearch Lib "csearch32.dll" (ByVal path As
    > String,
    > ByVal findword As String, ByVal CaseSensitive As Integer) As Integer
    >
    > Public Function Search(ByVal Path As String, ByVal FindWord As String, ByVal
    > CaseSensitive As String) As Integer
    > Search = RefSearch(Path, FindWord, CaseSensitive)
    > End Function
    >
    > Now in ASP you can use:-
    >
    > Dim oSearch : Set oSearch = CreateObject("MyAspHelper.CSearch")
    >
    > Dim lRes
    >
    > lRes = oSearch.Search(FileName, "Hello", False)
     
    , Mar 18, 2007
    #6
  7. <> wrote in message
    news:...
    > Great idea, thank you.
    > I tried it, but the weird thing is when I call that VB6 ActiveX DLL
    > from VB6, it search fine.
    > For example: I have a document with the word "FieFie" in it. Calling
    > the DLL from VB6, I can search for fiefie, or fie, or Fie and it will
    > find all of them.
    > Calling the DLL from ASP, when I search for Fie it will find it, but
    > when I search for fiefie or fie, it does not find it.



    One test you might try is the same code in a VBScript file (.vbs).

    Does the C++ DLL depend on any values found in the user context such as
    current user registry values?



    >
    > On Mar 18, 3:13 pm, "Anthony Jones" <> wrote:
    > > <> wrote in message
    > >
    > > news:...
    > >
    > > > We have a C++ DLL that we call from VB6 program.
    > > > This is how we declare the DLL in VB6:
    > > > Declare Function RefSearch Lib "csearch32.dll" (ByVal path As String,
    > > > ByVal findword As String, ByVal CaseSensitive As Integer) As Integer

    > >
    > > > This is how we call the DLL in VB6:
    > > > hit = RefSearch(path, SearchStr1, ChkValue)

    > >
    > > > Can I call this DLL in ASP and how ?
    > > > Thank you.

    > >
    > > Create an VB6 ActiveX DLL. In the project properties it is very

    important
    > > that both Unattended Execution and Retained In Memory are selected

    otherwise
    > > your site will crash for almost inexplicable reasons. For performance
    > > reasons apartment threading is strongly recommend. You do not need to
    > > recompile your existing C++ dll.
    > >
    > > You VB6 code can look something like this:-
    > >
    > > 'Project MyAspHelper
    > >
    > > 'Class CSearch
    > >
    > > Private Declare Function RefSearch Lib "csearch32.dll" (ByVal path As
    > > String,
    > > ByVal findword As String, ByVal CaseSensitive As Integer) As Integer
    > >
    > > Public Function Search(ByVal Path As String, ByVal FindWord As String,

    ByVal
    > > CaseSensitive As String) As Integer
    > > Search = RefSearch(Path, FindWord, CaseSensitive)
    > > End Function
    > >
    > > Now in ASP you can use:-
    > >
    > > Dim oSearch : Set oSearch = CreateObject("MyAspHelper.CSearch")
    > >
    > > Dim lRes
    > >
    > > lRes = oSearch.Search(FileName, "Hello", False)

    >
    >
     
    Anthony Jones, Mar 19, 2007
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Anushi
    Replies:
    5
    Views:
    8,779
  2. Bruce W.1

    Call an ASP.NET DLL from PHP or ASP?

    Bruce W.1, Feb 12, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    4,559
    Bruce W.1
    Feb 12, 2004
  3. pcarr01
    Replies:
    3
    Views:
    665
    Gordon Beaton
    Feb 17, 2005
  4. Tom
    Replies:
    1
    Views:
    459
  5. H. Simpson
    Replies:
    4
    Views:
    284
    H. Simpson
    Aug 3, 2004
Loading...

Share This Page