Results 1 to 7 of 7

Thread: Mousepointer

  1. #1

    Thread Starter
    New Member roefje's Avatar
    Join Date
    May 2001
    Location
    The Netherlands
    Posts
    8

    Question Mousepointer

    I'm making a program with a database connection. In my code I'm using

    Screen.MousePointer = vbHourglass

    When I run it in design mode it works perfectly,
    you see the hourglass and it stops when the next form is loaded with the data from the database.
    But when I make an .exe and I run that the hourglass doesn't appears when it should.

    Does anyone knows how I can fix this

    Thanx in @vance
    Roefje,
    Smle 2 every1

  2. #2
    Fanatic Member crispin's Avatar
    Join Date
    Aug 2000
    Location
    2 clicks west of a Quirkafleeg...Cornwall, England
    Posts
    754
    try using Formname.MousePointer instead of Screen.Mousepointer
    Crispin
    VB6 ENT SP5
    VB.NET
    W2K ADV SVR SP3
    WWW.BLOCKSOFT.CO.UK

    [Microsoft Basic: 1976-2001, RIP]

  3. #3

    Thread Starter
    New Member roefje's Avatar
    Join Date
    May 2001
    Location
    The Netherlands
    Posts
    8
    It doesn't helps....
    I've tried it anyway possible but it won't work.
    Roefje,
    Smle 2 every1

  4. #4
    Fanatic Member Gaffer's Avatar
    Join Date
    Nov 2000
    Location
    London
    Posts
    828
    That doesn't sound right.

    try the exe in this attachment....
    Attached Files Attached Files

  5. #5
    Fanatic Member Gaffer's Avatar
    Join Date
    Nov 2000
    Location
    London
    Posts
    828
    The reason the houglass returns to default when you leave the form is because cursor events are relative to your program only. If a user is multitasking, they will expect to be able to use their other prgrams as normal.

    If the cursor becomes default when you move from one form to another, then you shouldput an event in the On Load event of the new form, to set the cursor as an houglass.

    The only other advice I can offer is to use API calls. This will set the cursor regardless of programs status. Its fine to use, but if a user moves to another program during its operation, the houglass will remain.

    Code:
    Const IDC_APPSTARTING = 32650
    Const IDC_ARROW = 32512
    Const IDC_CROSS = 32515
    Const IDC_IBEAM = 32513
    Const IDC_ICON = 32641
    Const IDC_NO = 32648
    Const IDC_SIZE = 32640
    Const IDC_SIZEALL = 32646
    Const IDC_SIZENESW = 32643
    Const IDC_SIZENS = 32645
    Const IDC_SIZENWSE = 32642
    Const IDC_SIZEWE = 32644
    Const IDC_UPARROW = 32516
    Const IDC_WAIT = 32514
    
    Declare Function LoadCursor Lib "user32.dll" Alias "LoadCursorA" (ByVal hInstance As Long, ByVal lpCursorName As Long) As Long
    Declare Function SetCursor Lib "user32.dll" (ByVal hCursor As Long) As Long
    Declare Sub Sleep Lib "kernel32.dll" (ByVal dwMilliseconds As Long)
    
    
    Sub mHourGlass()
    ' Display the application starting (arrow and hourglass) Windows
    ' cursor for three seconds.  The cursor resource is loaded from Windows.  Then
    ' restore the old cursor (whatever it happens to be).
    Dim hCursor As Long  ' receives handle to application starting cursor
    Dim holdcursor As Long  ' receives handle to previously used cursor
    Dim retval As Long  ' throw-away return value
    
    hCursor = LoadCursor(0, IDC_WAIT)  ' load Windows's application starting cursor
    holdcursor = SetCursor(hCursor)  ' set it to the new cursor
    Sleep 3000  ' wait for 3 seconds
    retval = SetCursor(holdcursor)  ' set it to the previous cursor
    
    End Sub

  6. #6

    Thread Starter
    New Member roefje's Avatar
    Join Date
    May 2001
    Location
    The Netherlands
    Posts
    8
    Thanx for your advice and code....

    You will hear if it worked in about 2 weeks.
    Going on holiday...
    Roefje,
    Smle 2 every1

  7. #7

    Thread Starter
    New Member roefje's Avatar
    Join Date
    May 2001
    Location
    The Netherlands
    Posts
    8

    Post



    It still doesn't work...

    Who can help me with this problem.

    I still see my normal mousepointer.
    Roefje,
    Smle 2 every1

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