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




Hourglass Cursor With Win32 Functions


I am trying to put a hourglass cursor into my application, but I don't would like to use the property MousePointer of the Screen object (Screen.MousePointer = VbHouglass)I am trying this subject with the Win32 functions: LoadCursor, SetCursor and ShowCursorI have declared this function into my Visual Basic application and after I have used this function in the following mode:public Declare Function LoadCursor Lib "user32" Alias "LoadCursorA" (byval hInstance as Long, byval lpCursorName as string) as Longpublic Declare Function SetCursor Lib "user32" Alias "SetCursor" (byval hCursor as Long) as Longpublic Declare Function ShowCursor Lib "user32" Alias "ShowCursor" (byval bShow as Long) as LongDim cur as LongCur = SetCursor(LoadCursor(null, IDC_WAIT))Cur = ShowCursor(true)This code don't work OK and I would like to know Which is the problem.Can anybody help me?......Thanks for your help




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
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.

Thanks

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?

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) :
BWOAR!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Hourglass Cursor Doesn't Work On Forms
I saw your reply to PaulDGoldstein about how to change the cursor to an hourglass in MS Word. This is the same suggestion that MS gives when one asks for help in VBA, so I've tried that and it seems to work sometimes, but not most of the time. And, in addition, when it doesn't work, I am sometimes unable to use CTRl-BREAK to exit a VBA userform program, and the system thinks that the program is waiting for an input from me - even though the cursor hasn't changed to an hourglass. And all I did was to set the SYSTEM.CURSOR to wdCursorWait at the beginning of the userform initialization routine, and set it back at the end of the routine.

The strange thing is that if I hit F5 when the initial userform is showing in VBA, then the cursor changes to an hourglass and back, just as it is supposed to. But if I start up the application and let the AUTOOPEN macro start the userform, the cursor change doesn't take place. This happens with no changes whatsoever in the VBA code.

Can you suggest how I might make the cursor change work in both situations? Thanks.

Which DLL Contains Win32 Functions On CE4.2...
I'm currently migrating my softwares from C/C++ -> VB.Net -> CE 4.2 and run into some problems regarding Pocket PC:

As I'm using VB I call Win32-functions via, for example:

Code:Public Declare Function GetCommState Lib "kernel32.dll" (ByVal nCid As IntPtr, ByRef lpDCB As DCB) As Boolean

These DLL's (kernel32.dll etc) exist on my desktop computer, but not on a CE 4.2 device.

So my question is - which DLL's contains the Win32 finctions on a PocketPC ?

Regards/MethMath

How To Use WIN32 API Functions For Backup Tape?
Hi All!

How to use WIN32 API functions for backup tape - BackupWrite(), BackupRead() ect.

I need the working source code example in C++ or VB!

Thanx all!

Daniel

Passing Pointers To Various Win32 API Functions
Hi friends,
I want to create an application simmilar to Microsoft System Information in VB and i'm new to VB.I know some win32 API functions to get necessary system information.Now How can i pass the ptrs to differant API structures(eg SYSTEM INFO structure)?Who is going to help me?

Calling Win32 Global Atom Functions

I just went through a very frustrating week, trying to fix a design gap in a VB menu, which calls and is called from SQLWindows programs.  I'd like to pass on what I have learned, in hopes it will help others.

WORKING DIRECTORY DIFFERENT DEPENDING ON HOW YOU OPEN PROJECT IN DEVELOPMENT ENVIRONMENT.  
If you open VB from your C drive and then open your project from a network drive, your default working directory will be C:, not the network drive.  If you click on the project file directly, your default working directory will be the directory where the project is located.  I recommend this way of doing it, because it is more like what will occur when your app is installed.  It becomes significant if you launch other apps from within your app, because they will inherit your working directory.

API CALLS: SIGNED VS. UNSIGNED INTEGERS.  
VB does not support unsigned integers, so it misinterprets the return value from an API call such as GlobalAddAtom as signed when it shouldn't be.  A number over 32,768 is falsely reported as the negative reciprocal, because the high order bit is set, and is interpreted as the sign bit.  For instance, SQLWindows added string in atom 52312, and passed the value 52312 to VB, but VB had to send the value -13324 to the GlobalGetAtomName function to retrieve the atom string.  If VB sends 52312 to GlobalGetAtomName, it gets an overflow error.  Thus, I had to find out how to get VB to convert 52312 to -13324 in order to find my data.  Microsoft.com  has a tip called HOWTO: Convert Between Signed and Unsigned Numbers to describe this problem and offer work-arounds.  In short, you check to see if it's greater than 32,768 (if the high order bit is set), and if so, subtract 65,536 (max capacity of unsigned 4-byte integer)

This is not a problem when communicating only between VB apps, because VB maintains a consistent mass delusion, and thus you won't notice it.  When VB called GlobalAddAtom, it would have reported the result as -13324, and when it sent
-13324, it would have found the Atom.  When communicating with C or SQLWindows or some other app that uses unsigned integers, the two will disagree on what the API call really returned, and you have to use the conversion function code  recommended by microsoft to convert the value.  

LENGTH OF STRING VARIABLE CONTENTS BEFORE API CALL LIMITS WHAT IS RETURNED BY THE API CALL.  
When you call the api GlobalGetAtomName (and probably other API's'), the result is to be returned in a string variable.  The length of the result is limited to the length of the string that was in the variable BEFORE you make the API call.  Therefore, if your string is null, and you make the API call, it will return a null string, because the string is too short to put the result in.  The workaround is to initialize the string to something long enough to hold the result.  I put 7 spaces in my string, and was able to retrieve my 7-byte result.  When I had 1 byte in my string, it only returned 1 byte of my result, which made me suspicious, because it returned the value 7 in the variable which reports the length of the result.   I heard a rumour that there is a VB function that you can use to help address this problem, but I haven't found it yet.

I hope someone may find this information useful.  I found it all out the hard way.  I'd also like thank those on Tek-Tips who tried to help when I was fighting the working directory problem.





Margaret Knapp
Visual Basic Programmer

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 odd...am I possibly doing something wrong?

SB

Hourglass
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!

Thanks

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 ?
Guys,

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 ?

Hourglass
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

Hourglass
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

Jon

Hourglass
How do I make the hourglass appear during an operation?

HourGlass
Good Morning,

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

Thanks

cc

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

Cheers!!!

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

thnks

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.
email@removed
(360)825-2591 x3471

VB Hourglass
Hi,

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

HourGlass
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?
Thnks!
Alex.

RDO Connection With Sybase (Run-time Error '40088': No Open Cursor Or Cursor Closed
I am having one program in VB 6.0 connecting to sybase when I run stored procedure and assign it to rdorecordset and then if I check rs.eof then it gives me error

Run-time error '40088': No open cursor or cursor closed.

I got one solution for SQL server that it is said that cursor get close automatically on server when used RDO so need to use API to keep it open as follow

Const SQL_PRESERVE_CURSORS As Long = 1204
Const SQL_PC_ON As Long = 1
Const SQL_PC_OFF As Long = 0
Dim intRet As Integer

intRet = SQLSetConnectOption(cn.hdbc, SQL_PRESERVE_CURSORS, _
SQL_PC_ON)
This works for SQL can u tell any API or solution to keep cursor open after executing stored procedure

Private wrkODBC As rdoEnvironment
Private conDatabase As rdoConnection

Set conDatabase = objAppLogon.Connect _
(sUserName:=Version_GetUser(), _
sServerName:=sServerName, _
sDatabaseName:=sDatabaseName, _
bManualLogon:=True, _
bUseSecServer:=False, _
bCertifyOnConnect:=False, _
sRDODSN:=sRDODSN, _
vRDOOptions:=Null, _
bRDOReadOnly:=False, _
sRDOAdditionalConnectString:="", _
rlErrorCode:=lErrorCode _
)
conDatabase.QueryTimeout = 240
Call SQLExecute("SET ANSINULL OFF")

Dim rs As rdoResultset

Set rs = SQLOpenResultset(SP_GETBUSCODE & SPACER & SQL_TEXT_DELIMITER & sSearchCode & SQL_TEXT_DELIMITER)

If rs.EOF = False Then ' This is a line I get error
GetBusinessSectorCode = rs.rdoColumns(0)
Else
GetBusinessSectorCode = -1
End If

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?

Thanks!

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.

Thanks,

Jacque

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???

-dabears37

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.

Ta.

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.

Need To Track Text Editer Cursor With Mouse Cursor
Hi All
I am Legally Blind with Macular Degeneration in both eyes and use a dual monitor setup with my App on 1 monitor and use the second monitor as my magnifier XP window. As I scroll my mouse cursor across a line of text, on my magnified window the cursor is stationary in the center of the screen and the text scrolls across the screen with the mouse movement.
I am trying to develop an app that will scroll horizontally over a line of text in any format without any vertical jitter and will give me a line feed and carriage return at the end of the line.
I have written some code that does this, but I cannot figure out how to track the text editing cursor with the mouse cursor. The WinXP Magnifier program I am now using, has this feature and I would like to include it in my app.

Thanks much
Any help will be greatly appreciated
edaziz

 

Only Move Cursor If Cursor Movement Is Greater Than X Amount
Ok, here's my problem. In the MouseMove procedure for my picture box, I only want the cursor to actually move if the X or Y value of the cursor's new position is greater than 15 when compared against the cursor's former x or y value.

So in other words, if you just move the mouse a tiny bit to the left, the mouse cursor on your screen will stay still. But if you move it a bit to the left then the mouse cursor on your screen will follow. PLEASE let me know if this is not clear, as I know my problem might not be very clear.

Flickering Hourglass..is 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.
thanx
trin

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?

Thanks.

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
JB

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

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.

kevinr@imagis-cascade.com

Mouse Pointer Does Not Turn Into An Hourglass
Consider the following code:

Code:

Private Sub cboSortBy_Click()
Dim strOrderField As String
strOrderField = DetermineOrderField(cboSortBy.Text)
If strOrderField <> "" Then 'Handles Typing into the field
strSQLOrderBy = " ORDER BY " & strOrderField & ";"
Screen.MousePointer = vbHourglass
AdsRecordset.Close
AdsRecordset.Open strSQLSelect & strSQLOrderBy, AdsConnection, adOpenDynamic, _
adLockPessimistic, adCmdText
Set flxGrid.DataSource = AdsRecordset
Screen.MousePointer = vbDefault
End If
End Sub
The problem is, when the code executes, it takes about 7 seconds for the information in the MsHFlexGrid to change. During this 7 seconds, I get a NORMAL mousepointer. It never turns into "vbHourglass". What gives?

ActiveX DLL With Form And MsIE = Hourglass
I have created aa activeX DLL in VB. The DLL contains a form.
The DLL is packaged in a CAB file and downloaded from a webserver.

When I start my DLL from the web application via. JS it starts OK, and the form displays... But I can't click on any of the controls on the form, all I get is a hour glass cursor when over the form.

I'm not able to close the form or IE.

What am I doing wrong?

Br

JOX



Her is the code:

The browser JS script:
function BK_OI(strId)
{
var OI;
try
{
OI = new ActiveXObject("OI.Readyness");
OI.Readyness(strId);
}
catch(e)
{
alert("Failed: " + e.message);
}
finally
{
OI = null;
}
}

The VB code, the form is called "Status":

Public Sub Readyness(Optional rowId As String)
Dim OIDialog As Form
Set OIDialog = Status

strRowId = rowId
If strRowId <> "" Then
OIDialog.Show vbModal
Else
MsgBox "No parameter passed. Please contact your system administrator.", vbOKOnly, "Error"
End If

Set OIDialog = Nothing
End Sub

Getting The Hourglass Pointer To Show On TreeView
When doing functions onvthe treeview control I can't seem to get the hourglass to show up. expecially when setting checkmarks. am I missing something with this control?

Mouse Hourglass Issue (Newb)
Hello,

I have a small app that I want the cursor to turn to an hourglass while some subs are running. It seems that every time it goes to a new sub, the cursor changes back to an arrow. So... I put the command in every one of the subs, but it still goes back to an arrow until it moves to the next sub.

So long story short, is there a command (other than screen.mousepointer) to make the cursor stay an hourglass no matter how many subs are called, until I set it back to vbNormal?

BTW the command I'm currently using is:

frmMain.MousePointer = vbHourglass

All the subs are within this form.

Thanks

Simply Hourglass / Wait Question.
I have some Excel VBA (all code via a form) used to connect to a network db with about 65,000 records currently. I'm using (rs.) FindNext and FindFirst to find some specific records. This takes about 45 seconds.

I know how to change the cursor to an hourglass when over a component. But, (Excel 97 VBA) is there a way I can do something like disable the cursor with a 'global' hourglass so that they can't do anything like click on the taskbar, etc.?

Thanks for any help

Making Mouse Unusable When Hourglass
Ok... I have a menu selection form with a few buttons. When the user clicks on a button the corresponding form gets loaded. Some of these forms are large and take a second to load so I said Me.MousePointer = VBHourglass to show the user to wait.

Problem: Say the form takes ten seconds to load, well the user can still click on any button (while the hourglass is showing) or choose an item from the menu.

How do I make it to where the user can't do anything to the program (via the mouse or keyboard) while the hourglass is showing?

Mousepointer Changes To Hourglass Over Custom Control
Hi all. I have a main form that after a click event I change the mousepointer to an hourglass and then load up another form which contains a custom control (an XML Combo box). When running in debug all works OK - the mousepointer reverts to vbDefault with no problems. But when in run-time, the mousepointer goes to vbDefault on the form, but when the cursor is over the custom control it changes back to the hourglass. I've set the control's mousepointer properties to be vbDefault, so I can't see why it works OK in debug but not at run-time. I'm aware that the mousepointer behaves erratically if calling DoEvents, but I'm not. Does anyone have any ideas?

VB6/Blinking Cursor/Textbox/Move Cursor
Hello!

I would like to always have a blinking cursor in my textbox.

Right now I have a touchscreen with a virual keyboard. All letter commands are sent to the textbox. When I change the properties of the textbox to Arrow (i.e. mouse pointer), the blinking cursor goes away once the virtual keyboard is pressed!

Can someone explain how I can get the blinking cursor to stay at the end of the inputted text?

Also...

I would like to create arrow keys. If the user messed up the inputted text, he can move the blinking cursor left one space at a time between inputted characters to add a letter. Then a button to move the blinking cursor back to the end of the inputted text.

Would be grateful for any help and explanations. Thanks.

Copyright 2005-08 www.BigResource.com, All rights reserved