leojose Posted May 3, 2005 Report Share Posted May 3, 2005 Hi all,I hope this forum entertains problems with regards to programming in VC++ for windows.Anyway, I am listing my problem here and hope somebody can guide me.I have written a code that takes a snapshot of the Screen and the mouse pointer and generates a .bmp file. I have managed to succesfully capture the cursor location but the problem is that the snapshot generated shows the mouse cursor as a Hourglass icon (or any relative icon that shows a busy state).I have used a combination of GetIconInfo and DrawIconEx to do this.There could be 2 possible reasons (acc. to me)1) WHen the code takes a snapshot of the screen/captures the mouse pointer it temporarily (not visible to the eye) goes into a busy state and that is why the captured image shows that way2) I may not have specified everything required to aquire the correct icon of the cursor and so it takes some default icon (which may be the busy state icon).Hope I have explained myself clearly...Thanks Quote Link to comment Share on other sites More sharing options...
dadyassa Posted May 3, 2005 Report Share Posted May 3, 2005 I dont know but i guess this always happen cos this is your post captured with Gadwin printscreen. Quote Link to comment Share on other sites More sharing options...
ɹəuəllıʍ ʇɐb Posted May 4, 2005 Report Share Posted May 4, 2005 But if I capture with Paint Shop Pro, then the pointer is normal. So there is a way.But I wouldn't know how to achieve that in C++ - isn't there a way that you can explicitly specify the pointer type before you capture? Quote Link to comment Share on other sites More sharing options...
leojose Posted May 4, 2005 Author Report Share Posted May 4, 2005 ok...I just happened to strike on something.Here is the code snipet to 'paste' the mouse cursor on the screen snapshot.hdcScreen = GetDC(hwndScreen);hdcCapt = CreateCompatibleDC(hdcScreen);hcursor = GetCursor(); DrawIconEx( hdcCapt, CursorPos.x, CursorPos.y, hcursor, 0,0, 0, NULL, DI_NORMAL | DI_COMPAT );Basically, if hcursor gives the correct handle to DrawIconEx, when we get the required cursor. But the problem is that the GetCursor(); call allways returns the handle for a 'Busy cursor' (I verified with the value that it returns)Now, my concern is how can I get the handle of the 'active cursor'. Will i need to call the windows procedure that is handling the cursor image/shape? Quote Link to comment Share on other sites More sharing options...
ɹəuəllıʍ ʇɐb Posted May 4, 2005 Report Share Posted May 4, 2005 Sorry, I have no experience in this field. Hopefully someone more knowledgeable will be here soon. Quote Link to comment Share on other sites More sharing options...
scuzzman Posted May 4, 2005 Report Share Posted May 4, 2005 Maybe if you used this:hcursor = SetCursor(IDC_ARROW);This will set it to the standard arrow (active) cursor, before taking the snapshot... so you needn't worry about grabbing it. This will only take effect also until the mouse moves, so there shouldn't be a lot of overhead from it... Quote Link to comment Share on other sites More sharing options...
leojose Posted May 4, 2005 Author Report Share Posted May 4, 2005 scuzzman,Your method will allow me to get the handle of an ARROW cursor. But what happens when the mouse moves around,from one window to another,resizing etc.? In all above cases the mouse cursor changes its shape and I would like to capture the cursor as it is while taking the snapshots. Quote Link to comment Share on other sites More sharing options...
scuzzman Posted May 4, 2005 Report Share Posted May 4, 2005 Well, the problem you're running into is that when the system takes the snapshot, it goes to the "Busy" cursor. Hence, when the snapshot is taken, the "Busy" cursor is the active cursor... I don't know of a method to grab the "Previous" cursor... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.