Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  HOME    TRACKER    Visual Basic

Hourglass Stays

This is very trivial, but I have a macro that does a bunch of formatting like hiding and unhiding rows and resizing columns, changing fonts, etc. This happens when a user clicks a button. The macro only takes a second to run, but the mouse pointer shows an hourglass until the user moves the mouse again. I know it's not a big deal, but I don't want them to think it is still running for no reason. Is there a command to switch the view back to the pointer?


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
App Stays On Top
Is there any code that I can add that will make my app persistent or stay on top even when I'm working in other windows?

The Hourglass
Exactly how useful is changing your pointer to the vbHourglass? My app sets it's pointer to the hourglass and then calls other windows programs it then waits for them to terminate. I noticed that if I go to the main app and click buttons nothing appears to happen but once the other program (in this case windows calculator as a test) is terminated the buttons you've clicked on are then run.

This strikes me as I possibly doing something wrong?


Hi all,

Private sub Main()

screen.mousepointer = vbHourglass
'coding here

screen.mouspointer = vbnormal
end sub

For some reason it doesn't show hourglass. Did I do something wrong here?

Can anyone please help!


VB Hourglass
I am having trouble with a process that's taking a long time while a modal form is running. I understand I can set the MousePointer property of the Screen object to the hourglass pointer while a modal form is displayed, but I can't find an example of syntax to do this. Can anyone help me out? Thanks!

Hourglass Gif ? Anyone ?

Does anyone has hourglass gif animated? i need to make it animate when the program is loading.... please help where can i find it.. ?

and what is the best way to animate in VB ?

I'm trying to change the cursor to an hourglass. It used to work, but it doesn't anymore... Any ideas?

Screen.MousePointer = vbHourglass 'vbDefault

How does one throw up an hourglass while executing code...
Right now my hour glass is flickering..I want to keep it consistant while its executing code so that users dont ctl alt del the sucka


How do I make the hourglass appear during an operation?

Good Morning,

Does anyone know how I run a vbHourGlass in a module.bas class before calling a function.



How do I get the mouse pointer to go to an hourglass while my recordset is processing an SQL string?


how can you make the hour glass appear next to the cursor. I want to be able to turn it on/off.


Hourglass On Cmd
Hi all,

This probably is a simple question, but does anyone know how to activate an
hourglass when I click on a command button within a vb app?

Kevin Baker
Client/Server Developer
Mutual of Enumclaw Insurance Co.
(360)825-2591 x3471

VB Hourglass

I have a VB6 application where I am trying to
change the cursor to an Hourglass while the
application is doing some database processing

I used the following:

Screen.MousePointer = vbHourglass
.. Data base processing code
Screen.MousePointer = vbDefault

However the mouse pointer remains the arrow

Please assist

I set the cursor to be hourglasses using the following statement.

Screen.MousePointer = vbHourglass

It change cursor to hourglass however if I click the form it is still get the events as if the coursour was normal. How can I disable events?

Draw Dot, Stays On Top
How can i draw a small dot or in the middle of my screen that always stays on top. The dot must be outside the form.

Hourglass Cursor
Okay this should be real simple. What happened to the mousepointer = vbhourglass in VB6?

All I want to do is change the cursor in .net to an hourglass while I populate an access database. And then of course back.


Hourglass For The Mouse
In my SaveChanges rountine I set my mouse to hourglass and then at the end back to default. My problem is that the routine works so fast that the user doesn't see the hourglass and doesn't know if the changes have been saved. Is there a way to force the mouse to turn to an hourglass for 1 or 2 seconds? I would rather not use a msg to let the user know the changes have been saved, I would like to stay with the mouse.



Annoying Hourglass
I am creating program that uses a timer with a low interval to perform complex operations in the background. Everything is working fine, except that the operations performed by the timer cause the mouse to intermittently switch between the arrow and the hourglass. I have tried playing with the mousePointer property of the form and the screen but have not been able to eliminate the hourglass. Can anybody help???


Prevent Hourglass
How do I prevent an application from displaying an hourglass while processing? I want the application to run in the background and be transparent; I do not want the application to change the cursor while running.

Mousepointer Hourglass
I put my executable's "icon" in a folder. I click on the icon, and the program appears....but only after 10 seconds of waiting. The mousepointer does not change to an hourglass during this 10 seconds, rather it remains as an "arrow."

Naturally, if one does not see the mousepointer change immediately to an hourglass, one clicks repeatedly on the icon, causing multiple instances of the program to ultimately appear.

How do I get the mousepointer to change immediately to an hourglass? I have put code in the "form load" and "form initialize" events, but that does nothing.

Hourglass Disapparing !
I'm sure this must have come up in the past.

Does anyone know why, when you have the code

VB Code:
Screen.Mousepointer = vbHourglass

it sometimes doesn't appear to work ??

What I mean is that the pointer stays as as a pointer, and doesn't switch to an hourglass.

Hourglass While Waiting
I have a small about window which loads the main program when OK is clicked. The main program takes a while to load, which leaves the user wondering if anything is happening. How would I make the mousepointer turn to an hourglass on the desktop? Screen.mousepointer=vbhourglass occurs if over a form. Thanks.

Showing Hourglass
I am chenging the cursor to vbHourglass when i do some processing after the user clicks a button on a form. But while the process continues, a hourglass is shown by the time, the user can click on other buttons. I wanna prevent the user to do anything on any form by the time.

Is there an easy way to do this other then disableing all active forms?

Help please.......

Why Does My Hourglass Switch Off?
I've got a dll which takes up to 10 seconds to run, so I've set it so that the mousepointer becomes an hourglass as soon as it's initialised:

VB Code:
Screen.MousePointer = vbHourglass
For some reason, though, it changes briefly to an hourglass and then immediately switches back to its default. I've checked my code and it definitely doesn't get reset until the end. I've even used a watch expression to see when it changes, and the pointer changes a full 7-9 seconds before the watch tells me it has changed.

Anyone got any ideas at all? It's driving me mad - as are my users who are grumbling non-stop.


Hourglass Not Showing
I am trying to get the cursor to change to an hour glass before executing a Stored Procedure that takes about 20 seconds to run.
I use the code "mousepointer = vbHourglass" before making the call but the cursor never changes.

Scrollbar Button Stays Down.
I've seen this or similar problems with various controls. In this case the scroll arrow stays down when I use the mouse. I know the DoEvents is causing the mouse messages to get lost or go out of sequence and was wondering if there is an easy way to fix this. I happen to like the appearance and function of the control the way I am trying to use it.

'Add a ListBox to a form
'Simulator for demonstration of bug in on-the-fly recalculator
'While Workload is being done, ListBox should be white
'When Workload completes, ListBox should be highlighted (Blue)
'This works fine when keyboard is used to scroll ListBox
'Messages are getting lost when mouse is used.
Option Explicit

Private Sub Form_Load()
Dim I As Long
For I = 0 To 99
List1.AddItem CStr(I)
List1.Font.Size = 16
List1.Height = 1 'Should trigger autoresize to 1 item
End Sub

Private Sub List1_KeyDown(KeyCode As Integer, Shift As Integer)
Dim lngTopIdx As Long
lngTopIdx = List1.TopIndex
If KeyCode = 40 And lngTopIdx < List1.ListCount - 1 Then
KeyCode = 0
List1.TopIndex = lngTopIdx + 1
ElseIf KeyCode = 38 And lngTopIdx > 0 Then
KeyCode = 0
List1.TopIndex = lngTopIdx - 1
End If
End Sub

Private Sub List1_Scroll()
End Sub

Private Sub Workload()
Static flgRestart As Boolean
Static flgInloop As Boolean
Dim T1 As Single
Dim T2 As Single
If flgInloop = True Then
flgRestart = True
If List1.ListIndex <> List1.TopIndex Then
flgInloop = True
Debug.Print "Working "; List1.TopIndex
flgRestart = False
T1 = Timer
T2 = Timer
Loop While Abs(T2 - T1) < 1 And flgRestart = False
Loop While flgRestart = True
Debug.Print "Finished "; List1.TopIndex
List1.ListIndex = List1.TopIndex
flgInloop = False
End If
End If
End Sub

Help With BITBLT, Picture Actually Stays The Same.
Im attempting game programming and im trying to use Bitblt except i hit the button the makes the char go left it all works but lets say the picture im coping off of is on another form, the 'copied' picture is blank, if theres a command button ontop of the picture in the main form, hen the command button goes onto the 'copied' picture. how do i stop this from happening here is one of my Timer Codes.

Private Sub Timer1_Timer()
Timer2.Enabled = False
Timer3.Enabled = False
Timer4.Enabled = False
X = X + 10
RetVal = BitBlt(Form1.hDC, 0, 0, 320, 200, Picture1.hDC, 0, 0, SRCCOPY)
RetVal = BitBlt(Form1.hDC, X, Y, 110, 180, DiscoMsk.hDC, 0, 0, SRCAND)
RetVal = BitBlt(Form1.hDC, X, Y, 110, 180, DiscoSpr.hDC, 0, 0, SRCPAINT)
End Sub

Excel Stays In Memory
Hi all,

I'm accessing excel from a word macro. All goes well untill I wan't to close excel. It stays in the task manager. I know why because I'm using unreference excel objects. So every where I use an excel object, I refer to the origanel excel object. That worked untill I start using WITH ... END With. Does anybody know why excel stays in the memory when I use WITH ... END WITH.

Works (stops excel)
excObj.Selection.Borders(xlEdgeLeft).LineStyle = xlContinuous
excObj.Selection.Borders(xlEdgeLeft).Weight = xlThin
excObj.Selection.Borders(xlEdgeLeft).ColorIndex = xlAutomatic
Doesn't Work (excel stays in the memory)
With excObj.Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With

Thx for your time.

Excel Stays In Memory
I have viewed most of the threads on this subject and am still unable to get Excel out of Memory. I have been struggling with this for two days now and cannot figure out what I am doing wrong. This code loops through the controls on a form. Using the controls tag it locates the location in the template to insert the controls data. Please see my code below.

Public Sub ProcessDoc(xlFileName As String, sSaveName As String, Form As Form)

Dim xlApp As Object
Dim xlBook As Object
Dim xlSheet As Object
Dim cntl As Control
Dim i, n, r, c, col As Integer
Dim sTag, sText As String
Dim bFound As Boolean

'Dim x As New Excel.Workbook

On Error Resume Next
Set xlApp = GetObject(, "Excel.Application")

If Err <> 0 Then
Err = 0
End If
On Error GoTo ErrHandler
If xlApp Is Nothing Then
Set xlApp = CreateObject("Excel.Application")
End If

xlApp.displayalerts = False
xlApp.Visible = False
xlApp.screenupdating = False

Set xlBook = xlApp.Workbooks.Add(xlFileName)

xlBook.SaveAs sSaveName

Set xlSheet = xlBook.ActiveSheet
'Set xlRange = xlSheet.UsedRange

For Each cntl In Form.Controls
With cntl
If .Tag <> "" Then
Select Case TypeName(cntl)
Case "TextBox"
sText = .Text
For i = 1 To xlSheet.UsedRange.Rows.Count
For n = 1 To xlSheet.UsedRange.Columns.Count
If .Tag = xlSheet.Cells(i, n).Value Then
xlSheet.Cells(i, n) = sText
End If
Case "ListView"
bFound = False
For i = 1 To xlSheet.UsedRange.Rows.Count
For n = 1 To xlSheet.UsedRange.Columns.Count
If .Tag = xlSheet.Cells(i, n).Value Then
bFound = True
col = n
For c = 1 To .ColumnHeaders.Count
If .ColumnHeaders(c).Width > 0 Or UCase(.ColumnHeaders(c).Text) = "VNDRNAME" Then
xlSheet.Cells(i, col).Value = .ColumnHeaders(c).Text
col = col + 1
End If
i = i + 1
col = n
For r = 1 To .ListItems.Count
xlSheet.Cells(i, 1).Rows.Insert
For c = 0 To .ColumnHeaders.Count - 1
If .ColumnHeaders(c + 1).Width > 0 Or UCase(.ColumnHeaders(c + 1).Text) = "VNDRNAME" Then
If c = 0 Then
xlSheet.Cells(i, col).Value = .ListItems(r)
xlSheet.Cells(i, col).Value = .ListItems(r).SubItems(c)
End If
col = col + 1
End If
i = i + 1
col = n

End If
If bFound Then Exit For
If bFound Then Exit For
End Select
End If
End With



Set xlSheet = Nothing
If Not xlBook Is Nothing Then xlBook.Close
Set xlBook = Nothing
Set xlApp = Nothing
Exit Sub


Err.Raise Err.Number, Err.Source, Err.Description
GoTo ExitOut
Resume Next
End Sub

App Stays In Processes Once Closed
How is it when I close out of my application that it stays running in my processes?

Program Stays In Memory
Could someone be so helpfull as to look at my small program and see if they can figure out why Excel, and the program itself, resides in the task manager after everything is closed? I'm setting all the objects to nothing (I think) but it still doesn't work. Thank you in advance!

Make Form Always Stays On Top?
Is there a way to make a form always stays on top even thou another form got the focus?
More or less modal, but I want to be able to focus on other forms also.

MsgBox Stays In Memory
Hi guys, I have a problem with a msgbox.  When it is called it seems to stay in memory after you click ok.  It is vbModal.

Any ideas

}...the bane of my life!

App Stays Invisible In Taskbar
I load my form from the Sub main()
with vbmodal.

Allthough i have the property Showintaskbar=TRUE for frmmain, it still doesn't show in the taskbar.

What can i do?

Form That Stays Ontop
How can you get a form to stay on top. So that if you open anohter program your form gets on top of that program
ps: i'am working in win2k.

Hourglass Cursor Remaining
i've got some strange thing happening: i've got a textboxes in frames, if you change their value (and the operations required happen), the hourglass icon stays until you move your mouse...
it's not really a problem, but looks bad :s, why does that happen, how can i stop it?

Flickering It Normal?
i dont know if this is normal or not....
i process some data that's read in from a file, and put the processed data into a rich textbox. My program takes about 3 minutes to execute. When it is finished all the required data i need is sitting in my rtb and i print it out. While my program is executing an hourglass flickers. Is this normal? Why can i see the hourglass flickering? Is it because it is taking so long for the program to execute? Ive never seen this houglass flickering before, in any of my other programs, although none of my other programs took this long.

Question About Hourglass Pointer (11)
OK, yet another question for those who know this kinda thing,

My application is busy doing something, so I set the mouspointer to 11 (hourglass). Unfortunately, this is just a picture, the user is free to click on whatever they like. I can stop them closing the window easily by using QueryUnload, but how can I stop them clicking on any buttons or menus? I know I can check the pointer status and then exit the sub, but the button still depresses as if normally clicked. Also, I dont want menu items to highlight as the cursor passes over. Is there a quick and simple way to do this without setting the .Enabled property of every control on the form to False?

How To Get The Hourglass Icon Visible
When running a long database query, how do you change the mouse pointer to the hourglass, then back to the pointer when the query is over? Any help would be appreciated...VolFans

Modal Form Instead Of Hourglass?
Can I use a modal form with a timer to inform the user that processing is taking place instead of an hourglass?


Hourglass...when Running Application
dear friends

My application reads number of files (txt files). From these files it takes
required data and write it to another files. The application is working fine
But I am facing a problem.....

While doing these processing the application window hangs and i get
hour glass icon. If clicked on the form it turns into white. (I had been
known about black outs in war times. and MS does it white)

How to avoid this? so that user can view reports in Flexgrid on that same form
while this processing is being done?

Have a nice day

Data Report Hourglass
Hey All,

Some of my data reports can take up to 10 seconds to display. So the problem I'm faced with is I want to display my report modally but if I set the cursor to an hourglass before:

Code:rptPOManagerOutstandingLinesFromSupplier.Show vbModal

I can't change it back to a pointer when the report is displayed (which can take up to 10 secs thus needing an hourglass)?

Any ideas

Busy/Hourglass Cursor
Now, do anyone here knows how to show the Busy/Hourglass cursor in VB without calling the API function BeginWaitCursor(...)?
I remember there's a function in VB that allows you to do this.
Thanks a lot! :--)

The lyric of the shattering roar of Xeon(Berserker Mode) :

Automatic Hourglass For DAO Queries
Does anyone know if there is a way to have an hourglass to show automatically whenever an application is executing a DAO database query. The normal way is to do something like:

docmd.Hourglass true
Set rst = CurrentDb().OpenRecordset(strSQL)
docmd.Hourglass false

I would simply like to

Set rst = CurrentDb().OpenRecordset(strSQL)

without explicitly turning the hourglass on or off.

Excel File Stays Locked
The following code works for me, but it seems to leave the Excel File locked. After running the code a few times successively, I get an error message that the timesheet.xls file can't be opened at all. I think this is because the file is not "closed" successfully each time and the maximum number of connections to the file has been reached.

Can anyone help?


Set MyXLApp = New Excel.Application
MyXLApp.SheetsInNewWorkbook = 1
Set MyXLWB = MyXLApp.Workbooks.Open(App.Path & " emplates imesheet.xls")
Set MyXLWS = MyXLWB.Worksheets(1)

MyXLApp.Workbooks(1).SaveAs (strFileName)
MyXLApp.ActivePrinter = "Acrobat PDFWriter on LPT1:"

MyXLApp.DisplayAlerts = False
MyXLWB.Close (False)
MyXLApp.DisplayAlerts = True

Set MyXLWS = Nothing
Set MyXLWB = Nothing
Set MyXLApp = Nothing

Also, if I try to manually launch the timesheet.xls file, it says the file is locked for editing.

Program Does Not End, Stays In Task Manager
Hey all, i have a weird problem here... here goes.

I have added a trey icon script to my project that allows me to add an icon and stuff to the start menu down next to the clock.

Now when i exit the program via a button on a form and use the same code as i do to end the program with the trey icon, it ends with no problem.. No trace of it in task manager.

Now when i put it next to the clock and exit it from there it stays in the task manager (about 10 megs) and does not go away until i end the task from the task manager.

Here is my code for the trey (the commands inside the icon):

Private Sub m_frmSysTray_MenuClick(ByVal lIndex As Long, ByVal sKey As String)
Select Case sKey
Case "full"
Case "close"
Unload WidgetStart
Unload WidgetWindow
Unload Full
Unload SetUp
Unload upDateSchedule
Unload systemTrey
Unload frmSysTray
Set WidgetStart = Nothing
Set WidgetWindow = Nothing
Set Full = Nothing
Set SetUp = Nothing
Set upDateSchedule = Nothing
Set systemTrey = Nothing
Set frmSysTray = Nothing
Case Else
SetUp.optTrey = True
End Select
End Sub
I've tryed it with and without the End statement thinking it may have something to do with it but it did the same thing.

Any help would be great, thanks.


Exe) Stays Running In Memory After I Print
I wrote a small program to print a simple form in VB.
The program (exe) runs great but when I close the form using Unload as below the (exe) stays running.

This only happens when and if I print. If I donít print the (exe) closes fine.
This is how I am printing the datareport
rptdatareport.PrintReport True, rptRangeFromTo, 1, 1

This is how I am closing
Private Sub Form_Unload(Cancel As Integer)
Dim i As Integer
Dim y As Integer
For i = 1 To 9000 '23000
For y = 1 To 20000
Next y
Next i
Unload frmSplash
Unload frmCertificate
End Sub

Can anyone tell me why my (exe) stays running in memory after I print and close?

Me.Windowstate Stays 0 Even If I Set The State To VbMaximized
Hi All,

Why is the above happening. I have my forms set as MDIChild forms and they seem to be doing their own things. I created the forms and the windowstate is set to normal(0) but when I open the form its windowstate becomes maximized.

Please help.

Excel Stays In Task Manager
Why does Excel insist on staying in my task manager?

This Does Work!

For j = 1 To 5
xlApp.Workbooks(LastMonthReport).Worksheets("Week" & j).Select

Set Wsheet = xlApp.Workbooks(LastMonthReport).Worksheets("Week" & j)

Wsheet.Range("D1").Value = ""

Set Wsheet = Nothing
Set xlApp = Nothing

Wsheet.Range("F3", cells(DeleteRow, 6)).Value = ""

Next j

This Doesn't Work!

For j = 1 To 5
xlApp.Workbooks(LastMonthReport).Worksheets("Week" & j).Select

Set Wsheet = xlApp.Workbooks(LastMonthReport).Worksheets("Week" & j)

Wsheet.Range("D1").Value = ""
Wsheet.Range("F3", cells(DeleteRow, 6)).Value = ""

Set Wsheet = Nothing
Set xlApp = Nothing

Next j

Copyright © 2005-08, All rights reserved