DLL During run time

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • chuckzter
    New Member
    • Oct 2007
    • 56

    DLL During run time

    Guys i need guidance,

    I have an xml converter which uses dll to be referenced upon. For testing purposes.
    Now, my question is, can i reference a dll file on vb 6.0 during runtime? So that when we try to convert to xml we don't have to stop the program -> recode -> ->start.

    Thanks in advance.
  • chuckzter
    New Member
    • Oct 2007
    • 56

    #2
    Set dllname = New SkillsManager

    SkillsManager is the name of the DLL file.

    How can i make a statement like this during runtime? I mean, how can i execute a statement like this where let's say i'd like to replace skillsmanager with another dll without having to recode again in design view. Given that all the DLLs are referenced.

    Thanks.

    Comment

    • chuckzter
      New Member
      • Oct 2007
      • 56

      #3
      UPDATE:

      I search and tried to apply this:

      a = "Set dllname = New SkillsManager"
      Call ScriptControl1. ExecuteStatemen t(a)

      But i'm getting an error saying, "Class not defined: SkillsManager"

      Anybody who could help?
      i would greatly appreciate it.

      Comment

      • QVeen72
        Recognized Expert Top Contributor
        • Oct 2006
        • 1445

        #4
        Hi,

        You can use Late Binding of the objects:

        [code=vb]
        Dim MyObj as Object
        Set MyObj = CreateObject(“M yDLL.MyClass”)
        MyObj.Myprop = “XYZ Name”
        MyObj.MyMethod
        [/code]

        with above code, You can change MyDll.MyClass, to the Class in dll.
        the problem here is, You wont get Intellisense.
        More over, you need to check properties and Methods.
        If any method/property is not supported by the new dll's class, or you may end up in run time error..

        Such a method is used in same Dll's with different version (say Word/Excel).

        Regards
        Veena

        Comment

        • chuckzter
          New Member
          • Oct 2007
          • 56

          #5
          Uhm, to clear things up here is the scenario.

          I have 100+ DLL files that i need to test.
          I need to figure out a way on how to save

          "Set dllname = New HRMSSkills.Skil lsManager" <- this statement as a string and execute it during runtime. by saying so i can change "HRMSSkills.Ski llsManager" unto anything i want meaning i can manipulate the string and change the DLL file that i want to test. Again, during runtime so that i don't need to recode everytime, 100+ times in particular.

          Haha, it's very frustrating.

          Here's a piece of what i have so far:

          Dim dllname As HRMSSkills.Skil lsManager

          a = "Set dllname = New HRMSSkills.Skil lsManager"
          Call ScriptControl1. ExecuteStatemen t(a)

          When the Call line is being executed i get the error: "Class not defined: HRMSSkills"

          Am i missing something? Do i need to step back and think it over again?

          Comment

          • chuckzter
            New Member
            • Oct 2007
            • 56

            #6
            Cool, it works now. Thanks.

            but i do have another question. How do i get the possible Intellisense and put it unto a variable? An array in particular. That would be my last question.

            I.E

            HRMSSkills.Skil lsManager

            SkillsManager can laso be SkillsProvider, etc.

            Is there a possiblity that i can get the value of those?

            Comment

            • QVeen72
              Recognized Expert Top Contributor
              • Oct 2006
              • 1445

              #7
              Hi,

              To get the List of all the members/methods of the DLL.
              You can Include the Dll in a New project. and Check the "Object Browser".
              Select the dll on the top and Class name from the Left List..
              Members and methods for that Class are popluated in the Right List..
              This is one easy way out..

              Regards
              Veena

              Comment

              • chuckzter
                New Member
                • Oct 2007
                • 56

                #8
                Thanks, i'll try that later. I need to sleep. XD thanks for the reply. I'll post if something goes wrong.

                Comment

                • chuckzter
                  New Member
                  • Oct 2007
                  • 56

                  #9
                  Uhm, how do i do this exactly? Sorry, i'm new at this.

                  Comment

                  • chuckzter
                    New Member
                    • Oct 2007
                    • 56

                    #10
                    Ok i think i got it. But what i need is that i want to see those methods during run time. Anybody who can help me?

                    Comment

                    • chuckzter
                      New Member
                      • Oct 2007
                      • 56

                      #11
                      I am getting an error "ActiveX cannot create object" on this line of code

                      Set dllname = CreateObject(Co mbo1.Text)

                      A little help please? I've been stuck with this for days. Thanks.

                      Comment

                      • QVeen72
                        Recognized Expert Top Contributor
                        • Oct 2006
                        • 1445

                        #12
                        Hi,

                        You need to use this code:

                        [code=vb]
                        Dim MyObj As Object
                        Set MyObj = CreateObject("A ccess.Applicati on")
                        [/code]

                        If you are using a ComboBox, to populate the dll names, then
                        CreateObject takes "DLLName.ClassN ame" as argument.
                        You may get error if you are creating only DLLName as object..

                        Regards
                        Veena

                        Comment

                        • chuckzter
                          New Member
                          • Oct 2007
                          • 56

                          #13
                          Thanks! but now i'm getting a new error that says, "File name or classname not found during Automation operation." on this line of code

                          Output = dllname.GetReco rd(InputTextbox .Text)

                          Where getrecord is a method of HRMSSkills.Skil lsManager

                          Thanks for the reply. You guys are helping me a lot.

                          Comment

                          • QVeen72
                            Recognized Expert Top Contributor
                            • Oct 2006
                            • 1445

                            #14
                            Hi,

                            Check how many Arguments does the GetRecord take..
                            Also post the modified code here...

                            Regards
                            Veena

                            Comment

                            • chuckzter
                              New Member
                              • Oct 2007
                              • 56

                              #15
                              Dim dllname As Object

                              Set dllname = CreateObject(Co mbo1.Text)

                              Output = dllname.GetReco rd(InputTextbox .Text)

                              What happens is that when i try to run the program the "GetRecord" class which is located within the DLL isn't recognized or found.


                              Arguments? I'm not sure about what you mean.
                              thanks for the quick replies.

                              Comment

                              Working...