I cant make my dll work ! 
Author Message
 I cant make my dll work !

Hi everyone,

I have what I believe to be a simple problem for experienced VB-programmers.
I have made the below standing code a .dll file, but it doesn't work
always - only
when I make sure that what lo{*filter*}ionary returns is of type Empty and then
of course
I rewrite

Set myDictionary = lo{*filter*}ionary(Language)
to
myDictionary = lo{*filter*}ionary(Language)

in the function translate, which is the only function that is called from
outside the component.

Can anyone help me with this - or perhaps suggest an easier way to debug my
program other
than the one I'm using now :

1. I make changes in VB6
2. Make the .dll file
3. Register the .dll file
4. Run the .asp file that uses my component (.dll file)
5. Unregister the .dll file
6. Goto 1.

Kind regards
Bo

Any help/pointers/suggestions is greatly appriciated

---BEGIN VB-FILE ---

Function lo{*filter*}ionary(Language)
    Dim i, lookupIndex
    Dim spmPropertyGroupMgr As SharedPropertyGroupManager
    Dim spmPropertyGroup As SharedPropertyGroup
    Dim spmDictionaryProperty As SharedProperty
    Dim spmLanguageProperty As SharedProperty
    Dim bolExists As Boolean

    Dim languageRead
    Dim Dictionaries

    Set spmPropertyGroupMgr =
CreateObject("MTxSpm.SharedPropertyGroupManager.1")
    Set spmPropertyGroup =
spmPropertyGroupMgr.CreatePropertyGroup("Dictionaries", LockSetGet, Process,
bolExists)
    Set spmDictionaryProperty =
spmPropertyGroup.CreateProperty("Dictionary", bolExists)
    Set spmLanguageProperty = spmPropertyGroup.CreateProperty("Language",
bolExists)

    'loadFunction = Empty
    'Exit Function

    If bolExists Then
        Dictionaries = spmDictionaryProperty.Value
        languageRead = spmLanguageProperty.Value
    Else
        ReDim languageRead(0)
        ReDim Dictionaries(0)
        Set Dictionaries(0) = CreateObject("Scripting.Dictionary")
    End If

    lookupIndex = -1
    i = 0
    Do While i <= UBound(languageRead)
        If Language = languageRead(i) Then
            lookupIndex = i
            i = UBound(languageRead)
        End If
        i = i + 1
    Loop

    If lookupIndex = -1 Then
        'Create a shared property manager, a group, and the shared
properties.
        'If the properties already exist bolExists will be set to true
otherwise it
        'will be false and the properties will be created.

        ReDim Preserve Dictionaries(UBound(Dictionaries) + 1)
        ReDim Preserve languageRead(UBound(languageRead) + 1)

        Set Dictionaries(UBound(Dictionaries)) =
re{*filter*}ionaryFromFile(Language)
        languageRead(UBound(languageRead)) = Language

        spmDictionaryProperty.Value = Dictionaries
        spmLanguageProperty.Value = languageRead

        lookupIndex = UBound(Dictionaries)
    End If

    If IsEmpty(Dictionaries(lookupIndex)) Then
        Set Dictionaries(lookupIndex) = CreateObject("Scripting.Dictionary")
    End If

    Set lo{*filter*}ionary = Dictionaries(lookupIndex)

    Exit Function
End Function

Function re{*filter*}ionaryFromFile(Language)
    Const ForReading = 1, ForWriting = 2, ForAppending = 3
    Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0

    Dim fs, f, myDictionary, file, myLine

    Set myDictionary = CreateObject("Scripting.Dictionary")
    Set fs = CreateObject("Scripting.FileSystemObject")
    If Language = "dk" Then
        file = "file1.txt"
    Else
        file = "file2.txt"
    End if

    Set f = fs.OpenTextFile("c:/inetpub/wwwroot/testsprog/" & file,
ForReading, TristateFalse)
    'We read the stuff and insert it into the dictionary

    Do While f.AtEndOfStream <> True
        myLine = Split(f.readline, " ", 2)
        If Not myDictionary.Exists(myLine(0)) Then
            myDictionary.Add myLine(0), myLine(1)
        Else
            'We have an error in the textfile
            myDictionary = Empty
            Set re{*filter*}ionaryFromFile = myDictionary
            Exit Function
        End If
    Loop
    f.Close
    Set re{*filter*}ionaryFromFile = myDictionary
    Exit Function
End Function

Function translate(Key, Language)
  Dim myDictionary

  Set myDictionary = lo{*filter*}ionary(Language)

  If IsEmpty(myDictionary) Then
    translate = "TRANSLATION_FAILED"
  Else
    If myDictionary.Exists(Key) Then
        translate = myDictionary.Items(Key)
    Else
        translate = "TRANSLATION_FAILED"
    End If
  End If

  Exit Function
End Function

---END VB-FILE ---



Mon, 09 Jun 2003 06:10:21 GMT  
 I cant make my dll work !
It is a long code that you have and I think you should be specific on type
of error or problem that  your are getting, some info such as error
description and  number
Code in the ASP file call this dll
I do not see any error trapping in any of your functions!!
What happens if you call this dll from  your VB test program rather than
ASP.
Your OS version and any SPs
Your VB  version and any SPs

FF


Quote:
> Hi everyone,

> I have what I believe to be a simple problem for experienced
VB-programmers.
> I have made the below standing code a .dll file, but it doesn't work
> always - only
> when I make sure that what lo{*filter*}ionary returns is of type Empty and
then
> of course
> I rewrite

> Set myDictionary = lo{*filter*}ionary(Language)
> to
> myDictionary = lo{*filter*}ionary(Language)

> in the function translate, which is the only function that is called from
> outside the component.

> Can anyone help me with this - or perhaps suggest an easier way to debug
my
> program other
> than the one I'm using now :

> 1. I make changes in VB6
> 2. Make the .dll file
> 3. Register the .dll file
> 4. Run the .asp file that uses my component (.dll file)
> 5. Unregister the .dll file
> 6. Goto 1.

> Kind regards
> Bo

> Any help/pointers/suggestions is greatly appriciated

> ---BEGIN VB-FILE ---

> Function lo{*filter*}ionary(Language)
>     Dim i, lookupIndex
>     Dim spmPropertyGroupMgr As SharedPropertyGroupManager
>     Dim spmPropertyGroup As SharedPropertyGroup
>     Dim spmDictionaryProperty As SharedProperty
>     Dim spmLanguageProperty As SharedProperty
>     Dim bolExists As Boolean

>     Dim languageRead
>     Dim Dictionaries

>     Set spmPropertyGroupMgr =
> CreateObject("MTxSpm.SharedPropertyGroupManager.1")
>     Set spmPropertyGroup =
> spmPropertyGroupMgr.CreatePropertyGroup("Dictionaries", LockSetGet,
Process,
> bolExists)
>     Set spmDictionaryProperty =
> spmPropertyGroup.CreateProperty("Dictionary", bolExists)
>     Set spmLanguageProperty = spmPropertyGroup.CreateProperty("Language",
> bolExists)

>     'loadFunction = Empty
>     'Exit Function

>     If bolExists Then
>         Dictionaries = spmDictionaryProperty.Value
>         languageRead = spmLanguageProperty.Value
>     Else
>         ReDim languageRead(0)
>         ReDim Dictionaries(0)
>         Set Dictionaries(0) = CreateObject("Scripting.Dictionary")
>     End If

>     lookupIndex = -1
>     i = 0
>     Do While i <= UBound(languageRead)
>         If Language = languageRead(i) Then
>             lookupIndex = i
>             i = UBound(languageRead)
>         End If
>         i = i + 1
>     Loop

>     If lookupIndex = -1 Then
>         'Create a shared property manager, a group, and the shared
> properties.
>         'If the properties already exist bolExists will be set to true
> otherwise it
>         'will be false and the properties will be created.

>         ReDim Preserve Dictionaries(UBound(Dictionaries) + 1)
>         ReDim Preserve languageRead(UBound(languageRead) + 1)

>         Set Dictionaries(UBound(Dictionaries)) =
> re{*filter*}ionaryFromFile(Language)
>         languageRead(UBound(languageRead)) = Language

>         spmDictionaryProperty.Value = Dictionaries
>         spmLanguageProperty.Value = languageRead

>         lookupIndex = UBound(Dictionaries)
>     End If

>     If IsEmpty(Dictionaries(lookupIndex)) Then
>         Set Dictionaries(lookupIndex) =

CreateObject("Scripting.Dictionary")

- Show quoted text -

Quote:
>     End If

>     Set lo{*filter*}ionary = Dictionaries(lookupIndex)

>     Exit Function
> End Function

> Function re{*filter*}ionaryFromFile(Language)
>     Const ForReading = 1, ForWriting = 2, ForAppending = 3
>     Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0

>     Dim fs, f, myDictionary, file, myLine

>     Set myDictionary = CreateObject("Scripting.Dictionary")
>     Set fs = CreateObject("Scripting.FileSystemObject")
>     If Language = "dk" Then
>         file = "file1.txt"
>     Else
>         file = "file2.txt"
>     End if

>     Set f = fs.OpenTextFile("c:/inetpub/wwwroot/testsprog/" & file,
> ForReading, TristateFalse)
>     'We read the stuff and insert it into the dictionary

>     Do While f.AtEndOfStream <> True
>         myLine = Split(f.readline, " ", 2)
>         If Not myDictionary.Exists(myLine(0)) Then
>             myDictionary.Add myLine(0), myLine(1)
>         Else
>             'We have an error in the textfile
>             myDictionary = Empty
>             Set re{*filter*}ionaryFromFile = myDictionary
>             Exit Function
>         End If
>     Loop
>     f.Close
>     Set re{*filter*}ionaryFromFile = myDictionary
>     Exit Function
> End Function

> Function translate(Key, Language)
>   Dim myDictionary

>   Set myDictionary = lo{*filter*}ionary(Language)

>   If IsEmpty(myDictionary) Then
>     translate = "TRANSLATION_FAILED"
>   Else
>     If myDictionary.Exists(Key) Then
>         translate = myDictionary.Items(Key)
>     Else
>         translate = "TRANSLATION_FAILED"
>     End If
>   End If

>   Exit Function
> End Function

> ---END VB-FILE ---



Mon, 09 Jun 2003 13:25:53 GMT  
 I cant make my dll work !
I use WIN2000 and VB6 and the error I get is the  following

Ordbogsobjekt.ordbog(0x800A01C3)
Property let procedure not defined and property get procedure did not return
an object

,where Ordbogsobjekt.ordbog is my component registered in win2000 components
manager

I didn't write the ASP since it's very simple what I do :

<%
Dim Testvar
Set Testvar = Server.Createobject("Ordbogsobjekt.ordbog")
response.write Testvar.translate("_CONS_127", "uk" )
%>

Could you give me a hint/link as to where I could find out about including a
dll file in a simple VB-testprogram -
then I  could probably solve this problem of mine easier.

Kind regards
Bo Normann (a VB newbie)



Quote:
> It is a long code that you have and I think you should be specific on type
> of error or problem that  your are getting, some info such as error
> description and  number
> Code in the ASP file call this dll
> I do not see any error trapping in any of your functions!!
> What happens if you call this dll from  your VB test program rather than
> ASP.
> Your OS version and any SPs
> Your VB  version and any SPs

> FF



> > Hi everyone,

> > I have what I believe to be a simple problem for experienced
> VB-programmers.
> > I have made the below standing code a .dll file, but it doesn't work
> > always - only
> > when I make sure that what lo{*filter*}ionary returns is of type Empty and
> then
> > of course
> > I rewrite

> > Set myDictionary = lo{*filter*}ionary(Language)
> > to
> > myDictionary = lo{*filter*}ionary(Language)

> > in the function translate, which is the only function that is called
from
> > outside the component.

> > Can anyone help me with this - or perhaps suggest an easier way to debug
> my
> > program other
> > than the one I'm using now :

> > 1. I make changes in VB6
> > 2. Make the .dll file
> > 3. Register the .dll file
> > 4. Run the .asp file that uses my component (.dll file)
> > 5. Unregister the .dll file
> > 6. Goto 1.

> > Kind regards
> > Bo

> > Any help/pointers/suggestions is greatly appriciated

> > ---BEGIN VB-FILE ---

> > Function lo{*filter*}ionary(Language)
> >     Dim i, lookupIndex
> >     Dim spmPropertyGroupMgr As SharedPropertyGroupManager
> >     Dim spmPropertyGroup As SharedPropertyGroup
> >     Dim spmDictionaryProperty As SharedProperty
> >     Dim spmLanguageProperty As SharedProperty
> >     Dim bolExists As Boolean

> >     Dim languageRead
> >     Dim Dictionaries

> >     Set spmPropertyGroupMgr =
> > CreateObject("MTxSpm.SharedPropertyGroupManager.1")
> >     Set spmPropertyGroup =
> > spmPropertyGroupMgr.CreatePropertyGroup("Dictionaries", LockSetGet,
> Process,
> > bolExists)
> >     Set spmDictionaryProperty =
> > spmPropertyGroup.CreateProperty("Dictionary", bolExists)
> >     Set spmLanguageProperty =

spmPropertyGroup.CreateProperty("Language",

- Show quoted text -

Quote:
> > bolExists)

> >     'loadFunction = Empty
> >     'Exit Function

> >     If bolExists Then
> >         Dictionaries = spmDictionaryProperty.Value
> >         languageRead = spmLanguageProperty.Value
> >     Else
> >         ReDim languageRead(0)
> >         ReDim Dictionaries(0)
> >         Set Dictionaries(0) = CreateObject("Scripting.Dictionary")
> >     End If

> >     lookupIndex = -1
> >     i = 0
> >     Do While i <= UBound(languageRead)
> >         If Language = languageRead(i) Then
> >             lookupIndex = i
> >             i = UBound(languageRead)
> >         End If
> >         i = i + 1
> >     Loop

> >     If lookupIndex = -1 Then
> >         'Create a shared property manager, a group, and the shared
> > properties.
> >         'If the properties already exist bolExists will be set to true
> > otherwise it
> >         'will be false and the properties will be created.

> >         ReDim Preserve Dictionaries(UBound(Dictionaries) + 1)
> >         ReDim Preserve languageRead(UBound(languageRead) + 1)

> >         Set Dictionaries(UBound(Dictionaries)) =
> > re{*filter*}ionaryFromFile(Language)
> >         languageRead(UBound(languageRead)) = Language

> >         spmDictionaryProperty.Value = Dictionaries
> >         spmLanguageProperty.Value = languageRead

> >         lookupIndex = UBound(Dictionaries)
> >     End If

> >     If IsEmpty(Dictionaries(lookupIndex)) Then
> >         Set Dictionaries(lookupIndex) =
> CreateObject("Scripting.Dictionary")
> >     End If

> >     Set lo{*filter*}ionary = Dictionaries(lookupIndex)

> >     Exit Function
> > End Function

> > Function re{*filter*}ionaryFromFile(Language)
> >     Const ForReading = 1, ForWriting = 2, ForAppending = 3
> >     Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0

> >     Dim fs, f, myDictionary, file, myLine

> >     Set myDictionary = CreateObject("Scripting.Dictionary")
> >     Set fs = CreateObject("Scripting.FileSystemObject")
> >     If Language = "dk" Then
> >         file = "file1.txt"
> >     Else
> >         file = "file2.txt"
> >     End if

> >     Set f = fs.OpenTextFile("c:/inetpub/wwwroot/testsprog/" & file,
> > ForReading, TristateFalse)
> >     'We read the stuff and insert it into the dictionary

> >     Do While f.AtEndOfStream <> True
> >         myLine = Split(f.readline, " ", 2)
> >         If Not myDictionary.Exists(myLine(0)) Then
> >             myDictionary.Add myLine(0), myLine(1)
> >         Else
> >             'We have an error in the textfile
> >             myDictionary = Empty
> >             Set re{*filter*}ionaryFromFile = myDictionary
> >             Exit Function
> >         End If
> >     Loop
> >     f.Close
> >     Set re{*filter*}ionaryFromFile = myDictionary
> >     Exit Function
> > End Function

> > Function translate(Key, Language)
> >   Dim myDictionary

> >   Set myDictionary = lo{*filter*}ionary(Language)

> >   If IsEmpty(myDictionary) Then
> >     translate = "TRANSLATION_FAILED"
> >   Else
> >     If myDictionary.Exists(Key) Then
> >         translate = myDictionary.Items(Key)
> >     Else
> >         translate = "TRANSLATION_FAILED"
> >     End If
> >   End If

> >   Exit Function
> > End Function

> > ---END VB-FILE ---



Mon, 09 Jun 2003 15:57:08 GMT  
 I cant make my dll work !
I use WIN2000 and VB6 and the error I get is the  following

Ordbogsobjekt.ordbog(0x800A01C3)
Property let procedure not defined and property get procedure did not return
an object

,where Ordbogsobjekt.ordbog is my component registered in win2000 components
manager

I didn't write the ASP since it's very simple what I do :

<%
Dim Testvar
Set Testvar = Server.Createobject("Ordbogsobjekt.ordbog")
response.write Testvar.translate("_CONS_127", "uk" )
%>

Could you give me a hint/link as to where I could find out about including a
dll file in a simple VB-testprogram -
then I  could probably solve this problem of mine easier.

Kind regards
Bo Normann (a VB newbie)



Quote:
> Hi everyone,

> I have what I believe to be a simple problem for experienced
VB-programmers.
> I have made the below standing code a .dll file, but it doesn't work
> always - only
> when I make sure that what lo{*filter*}ionary returns is of type Empty and
then
> of course
> I rewrite

> Set myDictionary = lo{*filter*}ionary(Language)
> to
> myDictionary = lo{*filter*}ionary(Language)

> in the function translate, which is the only function that is called from
> outside the component.

> Can anyone help me with this - or perhaps suggest an easier way to debug
my
> program other
> than the one I'm using now :

> 1. I make changes in VB6
> 2. Make the .dll file
> 3. Register the .dll file
> 4. Run the .asp file that uses my component (.dll file)
> 5. Unregister the .dll file
> 6. Goto 1.

> Kind regards
> Bo

> Any help/pointers/suggestions is greatly appriciated

> ---BEGIN VB-FILE ---

> Function lo{*filter*}ionary(Language)
>     Dim i, lookupIndex
>     Dim spmPropertyGroupMgr As SharedPropertyGroupManager
>     Dim spmPropertyGroup As SharedPropertyGroup
>     Dim spmDictionaryProperty As SharedProperty
>     Dim spmLanguageProperty As SharedProperty
>     Dim bolExists As Boolean

>     Dim languageRead
>     Dim Dictionaries

>     Set spmPropertyGroupMgr =
> CreateObject("MTxSpm.SharedPropertyGroupManager.1")
>     Set spmPropertyGroup =
> spmPropertyGroupMgr.CreatePropertyGroup("Dictionaries", LockSetGet,
Process,
> bolExists)
>     Set spmDictionaryProperty =
> spmPropertyGroup.CreateProperty("Dictionary", bolExists)
>     Set spmLanguageProperty = spmPropertyGroup.CreateProperty("Language",
> bolExists)

>     'loadFunction = Empty
>     'Exit Function

>     If bolExists Then
>         Dictionaries = spmDictionaryProperty.Value
>         languageRead = spmLanguageProperty.Value
>     Else
>         ReDim languageRead(0)
>         ReDim Dictionaries(0)
>         Set Dictionaries(0) = CreateObject("Scripting.Dictionary")
>     End If

>     lookupIndex = -1
>     i = 0
>     Do While i <= UBound(languageRead)
>         If Language = languageRead(i) Then
>             lookupIndex = i
>             i = UBound(languageRead)
>         End If
>         i = i + 1
>     Loop

>     If lookupIndex = -1 Then
>         'Create a shared property manager, a group, and the shared
> properties.
>         'If the properties already exist bolExists will be set to true
> otherwise it
>         'will be false and the properties will be created.

>         ReDim Preserve Dictionaries(UBound(Dictionaries) + 1)
>         ReDim Preserve languageRead(UBound(languageRead) + 1)

>         Set Dictionaries(UBound(Dictionaries)) =
> re{*filter*}ionaryFromFile(Language)
>         languageRead(UBound(languageRead)) = Language

>         spmDictionaryProperty.Value = Dictionaries
>         spmLanguageProperty.Value = languageRead

>         lookupIndex = UBound(Dictionaries)
>     End If

>     If IsEmpty(Dictionaries(lookupIndex)) Then
>         Set Dictionaries(lookupIndex) =

CreateObject("Scripting.Dictionary")

- Show quoted text -

Quote:
>     End If

>     Set lo{*filter*}ionary = Dictionaries(lookupIndex)

>     Exit Function
> End Function

> Function re{*filter*}ionaryFromFile(Language)
>     Const ForReading = 1, ForWriting = 2, ForAppending = 3
>     Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0

>     Dim fs, f, myDictionary, file, myLine

>     Set myDictionary = CreateObject("Scripting.Dictionary")
>     Set fs = CreateObject("Scripting.FileSystemObject")
>     If Language = "dk" Then
>         file = "file1.txt"
>     Else
>         file = "file2.txt"
>     End if

>     Set f = fs.OpenTextFile("c:/inetpub/wwwroot/testsprog/" & file,
> ForReading, TristateFalse)
>     'We read the stuff and insert it into the dictionary

>     Do While f.AtEndOfStream <> True
>         myLine = Split(f.readline, " ", 2)
>         If Not myDictionary.Exists(myLine(0)) Then
>             myDictionary.Add myLine(0), myLine(1)
>         Else
>             'We have an error in the textfile
>             myDictionary = Empty
>             Set re{*filter*}ionaryFromFile = myDictionary
>             Exit Function
>         End If
>     Loop
>     f.Close
>     Set re{*filter*}ionaryFromFile = myDictionary
>     Exit Function
> End Function

> Function translate(Key, Language)
>   Dim myDictionary

>   Set myDictionary = lo{*filter*}ionary(Language)

>   If IsEmpty(myDictionary) Then
>     translate = "TRANSLATION_FAILED"
>   Else
>     If myDictionary.Exists(Key) Then
>         translate = myDictionary.Items(Key)
>     Else
>         translate = "TRANSLATION_FAILED"
>     End If
>   End If

>   Exit Function
> End Function

> ---END VB-FILE ---



Mon, 09 Jun 2003 16:03:40 GMT  
 I cant make my dll work !
After having bothered the newsgroup for some time - I feel now that I've
solved the problem - that I owe to show what was wrong and it was the
following tiny thing :
In the function translate below :
         translate = myDictionary.Items(Key) 'An Array
should be
         translate = myDictionary.Item(Key) 'A string

little but huge mistake

Kind regards
Bo Normann

Quote:
> > Function translate(Key, Language)
> >   Dim myDictionary

> >   Set myDictionary = lo{*filter*}ionary(Language)

> >   If IsEmpty(myDictionary) Then
> >     translate = "TRANSLATION_FAILED"
> >   Else
> >     If myDictionary.Exists(Key) Then
> >         translate = myDictionary.Items(Key)
> >     Else
> >         translate = "TRANSLATION_FAILED"
> >     End If
> >   End If

> >   Exit Function
> > End Function

> > ---END VB-FILE ---



Mon, 09 Jun 2003 18:43:36 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. A DLL made in Visual C++ works in VB4 but not in VB5

2. my home made DLL doesn't work anymore

3. This code used to work, now i cant figure out why it doesnt now

4. why cant my mouse work in Qbasic?

5. sub byref cant work

6. Cant get XTimers to work without form

7. I still cant get INIs to work.

8. Cant get button to work

9. Cant get GetItembyID to work......

10. Cant get debugger to work for Exchange scripts.

11. ComboBox and ADO - Cant Make It Work - Asking Again for Assistance

12. Multiple Display Problems Cant get 2nd monitor working

 

 
Powered by phpBB® Forum Software