Results 1 to 12 of 12

Thread: Sub in DLL question

  1. #1

    Thread Starter
    Frenzied Member MrGTI's Avatar
    Join Date
    Oct 2000
    Location
    Ontario, Canada
    Posts
    1,277

    Question Sub in DLL question

    Am i not allowed to do this in a DLL? (following code is in the Class Module)

    Code:
    Public Sub BusyProgram(cmdButton As Object, Optional bNotBusy As Boolean)
        '.... code here
    End Sub
    Can a sub have parameters passed in? If i remove them, it works fine. If i make it into a Property Get (aka Function) it works with the parameters.

    I just want the DLL to perform a task. I don't need a value passed back.
    ~Peter


  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Hmmm thats wierd you should be able to do that just fine.

  3. #3

    Thread Starter
    Frenzied Member MrGTI's Avatar
    Join Date
    Oct 2000
    Location
    Ontario, Canada
    Posts
    1,277

    Question

    That's what i thought.

    Anyone have a code snipet of something they did? I'll paste in and try it.
    ~Peter


  4. #4
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Here I whipped this up!

  5. #5

    Thread Starter
    Frenzied Member MrGTI's Avatar
    Join Date
    Oct 2000
    Location
    Ontario, Canada
    Posts
    1,277

    Post

    I will test it and respond tomorrow morning. Thanks!
    ~Peter


  6. #6

    Thread Starter
    Frenzied Member MrGTI's Avatar
    Join Date
    Oct 2000
    Location
    Ontario, Canada
    Posts
    1,277

    Question

    It works now that i call the sub using your method. I'm unsure as to why i need to do it without brackets, but i'm happy it works.

    For anyone reading this, you need to call the sub like so: xCC.MySub myVariable, myVariable2

    So any ideas on why " Screen.MousePointer = 11 " does not work from inside the DLL ?? Perhaps because it doesn't know which form/program to apply the busy icon to??
    ~Peter


  7. #7
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Hmmm maybe there is some form of problem with your installation of VB or a Serivce Pack issue. I can call Screen.MousePointer from inside the dll.

    I changed the sample I used to this:
    VB Code:
    1. Public Sub ThisShouldWork(MyObj As Object, Optional MyBol As Boolean)
    2.     Screen.MousePointer = vbHourglass
    3.     MsgBox MyObj.Caption, , MyBol
    4.     Screen.MousePointer = vbDefault
    5. End Sub

    And everything worked fine. The only difference is I used the vb const vbHourglass instead of the actually number 11.

    Any other DLL oddites you are having?

  8. #8
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Also in regard to the bracket issue, since its not returning anything I don't use them or at least not without the accompanying CALL statement.

    Here would be the calling statement using brackets:
    VB Code:
    1. Private Sub Command1_Click()
    2.     Dim Test As New SubTest
    3.    
    4.     Call Test.ThisShouldWork(Command1, False)
    5. End Sub

  9. #9

    Thread Starter
    Frenzied Member MrGTI's Avatar
    Join Date
    Oct 2000
    Location
    Ontario, Canada
    Posts
    1,277

    Question

    I altered it to have vbHourglass instead of 11, but it still doesn't work. Very strange. It doesn't make any sense Edneeis.

    I'm not having any other DLL related errors. I agree, it should work!
    ~Peter


  10. #10
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    To add to the strangeness we are running the same version and service pack of both vb and our os.

  11. #11
    jim mcnamara
    Guest
    MrGTI - I think you just entered dll h e l l. I just visited there a few months ago. I don't recommend it.

    Some installers are 'stupid' and overwrite more recent versions of dll's. The files clobbered include what VB uses. Especially if it's a homegrown installer, problems will abound.


    Try START >Accessories > System Tools >System Information

    Then run Tools > System File Checker - check for file corruption

    Next, try Tools > Version Conflict Manager - look for active files that are earlier version numbers than the 'old' file. It's quite common to find 8-10 of these when things aren't quite right

    Finally try a VB re-install.

  12. #12

    Thread Starter
    Frenzied Member MrGTI's Avatar
    Join Date
    Oct 2000
    Location
    Ontario, Canada
    Posts
    1,277

    Question

    Hmmmm. It appears that i don't have a "System File Checker " under that Tools menu. I'm running Win2K Pro, not Server.
    ~Peter


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width