The MASM Forum

Miscellaneous => Miscellaneous Projects => Windows Projects => Topic started by: GuruSR on October 13, 2016, 02:15:25 PM

Title: Desktop Icons & "Is the Caret visible?"
Post by: GuruSR on October 13, 2016, 02:15:25 PM
Well, first, love the fact that there are 2 dll calls for "HideCaret" and "ShowCaret" but no "GetCaretState", which would tell me if the silly thing is visible...

Reason I need to know this is:

2 of my programs offer "Auto-Hide Desktop Icons", which means, they actually vanish (so those 200 icons of shortcuts and crap on your desktop vanish and let you see that wonderful sunset photo you took and put on your desktop).  Since both use the same code, both run into the same issue, if the user is in the middle of "renaming" an icon, it can't tell it's being done, so hides the window and thus cancels the rename.  Also, annoyingly enough the active window is...  The desktop (handle 0), not the actual view (which is odd).  Anyone dealt with this, I haven't, it's quite a unique situation, just something I'd like to solve (like I did with the MSI target of a .lnk using advertised annoyances).

Someone have any insight on how to check for it?  Not sure if GetWindowLong would have it there or not, hmm, maybe I should look at that...   :dazzled:

GuruSR.
Title: Re: Desktop Icons & "Is the Caret visible?"
Post by: jj2007 on October 13, 2016, 06:50:40 PM
Well, first, love the fact that there are 2 dll calls for "HideCaret" and "ShowCaret" but no "GetCaretState", which would tell me if the silly thing is visible...

Just create your own counter. Note WM_PAINT hides and restores the caret.
Title: Re: Desktop Icons & "Is the Caret visible?"
Post by: GuruSR on October 16, 2016, 03:37:20 PM
Well, first, love the fact that there are 2 dll calls for "HideCaret" and "ShowCaret" but no "GetCaretState", which would tell me if the silly thing is visible...

Just create your own counter. Note WM_PAINT hides and restores the caret.

Actually, I *found* the answer, apparently even though there are APIs for HideCaret and ShowCaret, you have to actually ask the GUI for it's current configuration (how sad) for a specific thread, then it returns a few things including 2 odd items, what hWnd has the Caret and in the flags, (bit 0) shows if the Caret is present for the thread.   :dazzled:  Who thought that one up?!

GuruSR.
Title: Re: Desktop Icons & "Is the Caret visible?"
Post by: jj2007 on October 16, 2016, 06:42:09 PM
you have to actually ask the GUI for it's current configuration (how sad) for a specific thread, then it returns a few things including 2 odd items, what hWnd has the Caret and in the flags, (bit 0) shows if the Caret is present for the thread.

Interesting. How exactly do you get that flag? GetGUIThreadInfo and GUI_CARETBLINKING?

I've done some testing, see attachment, and it seems to work.
Title: Re: Desktop Icons & "Is the Caret visible?"
Post by: GuruSR on October 20, 2016, 02:11:59 PM
you have to actually ask the GUI for it's current configuration (how sad) for a specific thread, then it returns a few things including 2 odd items, what hWnd has the Caret and in the flags, (bit 0) shows if the Caret is present for the thread.

Interesting. How exactly do you get that flag? GetGUIThreadInfo and GUI_CARETBLINKING?

I've done some testing, see attachment, and it seems to work.

Yes, bit 0 of the Flags in GUITHREADINFO will state if the Caret is visible (not blinking, visible, period).  Also the hWndCaret should also show the window it's in.

GuruSR.