Results 1 to 4 of 4

Thread: Flickering image problems

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2002
    Location
    St. Peters, MO
    Posts
    8

    Flickering image problems

    I'm trying to replace my cursor with a gif file that uses transparencies. I don't want to use custom cursors or icons for reasons of being limited to the amount of colors or size of the custom cursor.

    I have it working somewhat. However, my graphic is flickering and I need to know how to make it stop.

    my code is below.


    Module code:

    Type POINTAPI
    x As Long
    y As Long
    End Type

    Declare Function GetCursorPos Lib "user32" _
    (lpPoint As POINTAPI) As Long


    Form code:

    Option Explicit

    Dim z As POINTAPI

    Private Sub Timer1_Timer()
    GetCursorPos z
    imgHand.Left = z.x
    imgHand.Top = z.y
    End Sub


    Any ideas on how to make it stop flickering? I don't have any experience with the bitblt command and don't know how to use it otherwise I'd probably use that route.

  2. #2

    Thread Starter
    New Member
    Join Date
    May 2002
    Location
    St. Peters, MO
    Posts
    8
    well, I have other problems also. The graphic is appearing under controls such as buttons. I need it to appear on top of them. Not sure how to do that.

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Try this...

    VB Code:
    1. Private Declare Function LockWindowUpdate Lib "user32"  (ByVal hWnd As Long) As Long
    2.  
    3. Private Sub LockWindow(lHandle As Long)
    4.     LockWindowUpdate lHandle
    5. End Sub
    6.  
    7. Private Sub UnlockWindow()
    8.     LockWindowUpdate 0
    9. End Sub
    10.  
    11. Private Sub Timer1_Timer()
    12. LockWindow(Form1.hWnd)
    13. GetCursorPos z
    14. imgHand.Left = z.x
    15. imgHand.Top = z.y
    16. UnlockWindow
    17. End Sub

  4. #4

    Thread Starter
    New Member
    Join Date
    May 2002
    Location
    St. Peters, MO
    Posts
    8
    Nope, that doesn't work either. The image still flickers and it doesn't appear on top of the other controls.

    I think I'm going to end up using a regular cursor, which really sucks. I'd rather have the eye candy.

    I did find some code using bitblt that worked great. Only problem with that code is that it caused the CPU utilization to run at 100% when the application was running. Can't have that.....

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