MousePointer vbHourglass and Enabled = False
I'm calling an asynchronous COM method from a VB6 application. When waiting for
the callback I want the mousepointer to be vbHourglass and input to be disabled.
My problem is that when calling Enabled = false on the main form the mousepointer is changed back to the default one.
Re: MousePointer vbHourglass and Enabled = False
When setting a form disabled, you also set all it's properties disabled, like the mousepointer. Another thing you can do is set the elements that can receive input disabled, the code is a bit longer, but your mousepointer remains the hourglass. Your code should look a bit like this.
private sub setEnabled(byval value as boolean)
if value then
form1.mousepointer = vbHourGlass
else
form1.mousepointer = vbNormal
end if
myTextField1.enabled = value
myTextField2.enabled = value
myTextField3.enabled = value
myButton1.enabled = value
myButton2.enabled = value
myButton3.enabled = value
.
.
.
end sub
So when you call the sub, just specify if the controls should be enabled(true) or disabled(false).
Tom Cannaerts
[email protected]
The best way to escape a problem, is to solve it.
Re: MousePointer vbHourglass and Enabled = False
or ...
if you are sure that you really want to disable *all* the controls on the form :
Dim oCtl as Control
'
on error resume next ' Just incase a control doesn't have '.enabled'
'
for Each oCtl in me.Controls ' or form1.controls etc
oCtl.Enabled = false ' or true, or whatever your var is
next
Chris Eastwood
CodeGuru - the website for developers
http://codeguru.developer.com/vb