No announcement yet.

Out of topic programming question (VB)

  • Filter
  • Time
  • Show
Clear All
new posts

  • Out of topic programming question (VB)

    I know that this is not the place to do it ... but i guess im just a bad boy

    My problem is actually very simple, i have some ado queries that take a fairly long time. During this i have the mousepointer to vbhourglass. The problem is that i would like to animate the mousepointer while waiting.

    The animation it self is very easy just set
    put the following in a timer
    mouseicon = loadpicture("c:....")
    and mousepointer = 99
    and enable the timer

    However i cannot get vb to change the icons while i wait for the query to complete (because the damn timer wont run until it the the program runs "idle".

    Is this just a limitation in vb or am i missing something .. any suggestions greatly appreciated, since this problem annoys me ALOT.

  • #2
    It actually I limitation of Windows and the way it handles multitasking. You might want to try a "Do Events" in your code that does the queries. This might not work but it is worth a shot.

    Do Events will tell the computer to do other events while you are waiting for some command to process. (Usually it mean while access the disk or someother I/O device) This might let the timer fire so you can animate your mouse.

    my $0.02 cents (value is based on the intelligence of the person reading this message)


    • #3
      You chould also multithread your app. Check out the CreateThread API call. Be warned though. Sometimes it works in VB, sometimes it doesn't. Actually, most of the time it doesn't and ends up crashing either your app or KERNEL32.DLL.

      Aaron Cake
      London, Ontario, Canada

      Player: Cyrix 200, 32MB RAM, 10.2Gig Quantum HD, Onboard EtherNet/Sound/Video, Custom Lexan Case, Arise DC-DC, Win95 Kernal w/Custom Player
      Car: '86 Mazda RX-7 w/Basic Performance Upgrades
      Player: Pentium 166MMX, Amptron 598LMR MB w/onboard Sound, Video, LAN, 10.2 Gig Fujitsu Laptop HD, Arise 865 DC-DC Converter, Lexan Case, Custom Software w/Voice Interface, MS Access Based Playlists
      Car: 1986 Mazda RX-7 Turbo (highly modded), 1978 RX-7 Beater (Dead, parting out), 2001 Honda Insight
      "If one more body-kitted, cut-spring-lowered, farty-exhausted Civic revs on me at an intersection, I swear I'm going to get out of my car and cram their ridiculous double-decker aluminium wing firmly up their rump."


      • #4
        I dont think that do events will do the trick because im awaiting the return of a recordset.

        The create thread may work, ill give it a shoot as soon as i can find the time to figure it out.

        Thanks for the help guys


        • #5
          Why to animate the mouse cursor from within your program? If I recall right you could setup a windows mouse cursor for the hourglass with an animated one, so windows will do the animation itself.

          Then, the moment you activate the waiting cursor, it'll start to animate... or not?


          • #6
            fjmedinaa: Im not quite clear on how you would animate the cursor the way you describe.

            As far as i know, the hourglass icon is not animated (or i dont know how to activate the right one..).

            If you know of a way to make it work i would be very happy to hear about it