Results 1 to 9 of 9

Thread: Hourglass from a DLL

  1. #1

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

    Question Hourglass from a DLL

    Let's say you make a DLL, and you have a small bit of code like so:

    Code:
    Public Sub BusyProgram(cmdButton As Object)
        On Error Resume Next
        cmdButton.Enabled = False
        Screen.MousePointer = vbHourglass
        DoEvents
    End Sub
    This code will not work when an app calls it. The button will become disabled, but the hourglass will not appear.

    I know why. It's beause the DLL doesn't know what form/application it's supposed to make busy.

    So how do i get a DLL to turn my cursor into an hourglass? I guess i need some tricks with the form name and/or the hwnd.

    PS: Edneeis and I have already determined that it will work if you call the class from within the same project, so you need to have two different projects running in order to test this correctly.
    ~Peter


  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Man that is wierd! I tried LoadCursor API and still no good. I usually call the Screen.MousePointer in the app around the call to the dll that way it leaves it to the developer if they want to show the cursor or not. Although I could see situations where it would be good to have it in the method being call, like a if the method performs more than one long action in the same method or something.

    Well sorry I couldn't help. Let me know if you do get it working, because now it has peeked my curiosity.

  3. #3

    Thread Starter
    Frenzied Member MrGTI's Avatar
    Join Date
    Oct 2000
    Location
    Ontario, Canada
    Posts
    1,277
    I'm in the process of creating a DLL full of some commonly used code. It doesn't have everything, but it has a series of weird code that you would use often.

    I just want to create a small sub that will disable a passed in object, and then make the hourglass appear. (Of course i'll have a way to reverse this)

    I tried sending in the form name as an object, and then tried applying the hourglass within a With frmName but that didn't work either.

    I guess i'm just trying to see if anyone is smarter than me (not too hard i suspect).
    ~Peter


  4. #4
    jim mcnamara
    Guest
    Did you Dim WithEvents myobject on the client code side?


    Just curious.

  5. #5

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

    Exclamation

    Um...... no. Can you suggest how i should code that? I don't understand what you want me to do.
    ~Peter


  6. #6
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    But what if the dll doesn't have any events?

  7. #7

    Thread Starter
    Frenzied Member MrGTI's Avatar
    Join Date
    Oct 2000
    Location
    Ontario, Canada
    Posts
    1,277
    I don't have any events in the DLL, and i'm not sure how that would help this situation.
    ~Peter


  8. #8

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

    Exclamation

    OoooooooooooooooooooH!!! Damn it. Look at this.

    Code:
    Public Function Hourglass(ByRef frmName As Object)
        frmName.MousePointer = vbHourglass
    End Function
    If you do that in the DLL, the hourglass code works. Damn. And i just released version 1 of my CommonCode DLL.

    Thanks a lot made_of_asp. Your comments and thoughts pushed my mind in the right direction. I am thankfull for your ideas. It appears we have a solution folks.
    ~Peter


  9. #9
    Hyperactive Member made_of_asp's Avatar
    Join Date
    Jul 2001
    Location
    123 Fake Street
    Posts
    394
    No Problem

    I dont know what ByRef does, io tried that without it and it didnt work.
    VS.NET 2003

    Need to email me?

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