|
-
Dec 27th, 2001, 03:09 PM
#1
SetCapture and the Missing Mouse Cursor?
Has anyone else ran into problems with SetCapture where the mouse pointer seems to disappear or change its zOrder to the desktop?
I am using this sample code and in the demo it works right but in my project the pointer disappears. I now have most of the code cut and pasted but still it does it on me. The only thing I can think of thats different is that I am using a control that was created at run time and in the demo it was made at design time. Would that have anything to do with it?
VB Code:
'here is the snippet that is harassing me
Private Sub cShow(ByVal x As Long, ByVal Y As Long)
Dim tP As POINTAPI
Dim hWndDesktop As Long
Dim lStyle As Long
Dim lhWnd As Long
Dim lParenthWNd As Long
' Make sure the picture box won't appear in the
' task bar by making it into a Tool Window:
lhWnd = PopUpList.hwnd
lStyle = GetWindowLong(lhWnd, GWL_EXSTYLE)
lStyle = lStyle Or WS_EX_TOOLWINDOW
lStyle = lStyle And Not (WS_EX_APPWINDOW)
SetWindowLong lhWnd, GWL_EXSTYLE, lStyle
' Determine where to show it in Screen coordinates:
tP.x = x \ Screen.TwipsPerPixelX: tP.Y = Y \ Screen.TwipsPerPixelY
lParenthWNd = PopUpList.Parent.hwnd
ClientToScreen lParenthWNd, tP
' Make the listview a child of the desktop (so
' it can be fully shown even if it extends beyond
' the form boundaries):
SetParent lhWnd, hWndDesktop
' Show the form:
SetWindowPos lhWnd, lParenthWNd, tP.x, tP.Y, PopUpList.Width \ Screen.TwipsPerPixelX, PopUpList.Height \ Screen.TwipsPerPixelY, SWP_SHOWWINDOW
' Tell VB it is shown:
PopUpList.Visible = True
PopUpList.ZOrder
' Try to set focus:
SetFocusAPI lhWnd
' Capture all mouse messages.
SetCapture lhWnd
End Sub
-
Dec 30th, 2001, 11:34 PM
#2
Member

Yes that problem is quite irritating.
You can save the pointers location. then display that screen on a form, set the timer interval to about 3 milli sec. Then on mouse move ,move a icon-then on mouse move event, shift the location of the icon. Then in timer event position mouse to the saved location and capture( the icon positons at that location,) then make icon invisible and disable the timer.
That will capture the mouse pointer i.e.
Its not API exactly (just a trick i figured to save the poiter position to scqreenshot)
Got it?
Regards,
LXS
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|