|
-
Nov 12th, 2001, 12:26 PM
#1
Thread Starter
Frenzied Member
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

-
Nov 12th, 2001, 02:12 PM
#2
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.
-
Nov 12th, 2001, 02:33 PM
#3
Thread Starter
Frenzied Member
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

-
Nov 12th, 2001, 03:02 PM
#4
Did you Dim WithEvents myobject on the client code side?
Just curious.
-
Nov 12th, 2001, 11:38 PM
#5
Thread Starter
Frenzied Member
Um...... no. Can you suggest how i should code that? I don't understand what you want me to do.
~Peter

-
Nov 13th, 2001, 01:36 AM
#6
But what if the dll doesn't have any events?
-
Nov 13th, 2001, 10:29 PM
#7
Thread Starter
Frenzied Member
I don't have any events in the DLL, and i'm not sure how that would help this situation.
~Peter

-
Nov 16th, 2001, 10:38 AM
#8
Thread Starter
Frenzied Member
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

-
Nov 16th, 2001, 06:19 PM
#9
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|