![]() |
SetCursor API problems...
....just bumping this up a bit!
I want to be able to force the mouse pointer to a cross hair icon so that users can pick off values from a graph easily. Unfortunatley the Application.Cursor property does not have this flexibility. This SetCursor API function should work in theory, but seems to be overuled by the Excel app? Thanks again, Dave "Dave Ramage" wrote: Hello.. I'm attempting to use API functions to change the mouse cursor to a crosshair when a certain chart is activated. Have pulled some code off another post, but it does not seem to work. Does anyone have any other sugestions: Code sample: Private Declare Function LoadCursorBynum Lib "user32" Alias _ "LoadCursorA" (ByVal hinstance As Long, ByVal lpCursorName As Long) As Long Private Declare Function SetCursor Lib "user32" (ByVal hCursor As Long) As Long Public Const IDC_CROSS = 32515& ' Crosshair Public Function MouseCursor(CursorType As Long) Dim lngRet As Long lngRet = LoadCursorBynum(0&, CursorType) lngRet = SetCursor(lngRet) End Function Thanks, Dave ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-based Newsreader and then click "I Agree" in the message pane. http://www.microsoft.com/office/comm...el.programming |
SetCursor API problems...
Dave,
If you try that code in a Button-click event, you can get the Cursor to change to a cross hairs, but as soon as you move it, Excel resets it. I can see a quick change to the cross hair over a chart, but Excel immediately resets it. The API call appear to return valid hCursor values, so the calls succeed, but are over-ridden by Excel. Looks like you would have to get more complex to fight against Excel to achieve this. NickHK "Dave Ramage" wrote in message ... ...just bumping this up a bit! I want to be able to force the mouse pointer to a cross hair icon so that users can pick off values from a graph easily. Unfortunatley the Application.Cursor property does not have this flexibility. This SetCursor API function should work in theory, but seems to be overuled by the Excel app? Thanks again, Dave "Dave Ramage" wrote: Hello.. I'm attempting to use API functions to change the mouse cursor to a crosshair when a certain chart is activated. Have pulled some code off another post, but it does not seem to work. Does anyone have any other sugestions: Code sample: Private Declare Function LoadCursorBynum Lib "user32" Alias _ "LoadCursorA" (ByVal hinstance As Long, ByVal lpCursorName As Long) As Long Private Declare Function SetCursor Lib "user32" (ByVal hCursor As Long) As Long Public Const IDC_CROSS = 32515& ' Crosshair Public Function MouseCursor(CursorType As Long) Dim lngRet As Long lngRet = LoadCursorBynum(0&, CursorType) lngRet = SetCursor(lngRet) End Function Thanks, Dave ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-based Newsreader and then click "I Agree" in the message pane. http://www.microsoft.com/office/comm...el.programming |
SetCursor API problems...
I was affraid of that, but thanks anyway!
"NickHK" wrote: Dave, If you try that code in a Button-click event, you can get the Cursor to change to a cross hairs, but as soon as you move it, Excel resets it. I can see a quick change to the cross hair over a chart, but Excel immediately resets it. The API call appear to return valid hCursor values, so the calls succeed, but are over-ridden by Excel. Looks like you would have to get more complex to fight against Excel to achieve this. NickHK "Dave Ramage" wrote in message ... ...just bumping this up a bit! I want to be able to force the mouse pointer to a cross hair icon so that users can pick off values from a graph easily. Unfortunatley the Application.Cursor property does not have this flexibility. This SetCursor API function should work in theory, but seems to be overuled by the Excel app? Thanks again, Dave "Dave Ramage" wrote: Hello.. I'm attempting to use API functions to change the mouse cursor to a crosshair when a certain chart is activated. Have pulled some code off another post, but it does not seem to work. Does anyone have any other sugestions: Code sample: Private Declare Function LoadCursorBynum Lib "user32" Alias _ "LoadCursorA" (ByVal hinstance As Long, ByVal lpCursorName As Long) As Long Private Declare Function SetCursor Lib "user32" (ByVal hCursor As Long) As Long Public Const IDC_CROSS = 32515& ' Crosshair Public Function MouseCursor(CursorType As Long) Dim lngRet As Long lngRet = LoadCursorBynum(0&, CursorType) lngRet = SetCursor(lngRet) End Function Thanks, Dave ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-based Newsreader and then click "I Agree" in the message pane. http://www.microsoft.com/office/comm...el.programming |
All times are GMT +1. The time now is 12:12 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com