Author Topic: Desktop Icons & "Is the Caret visible?"  (Read 714 times)

GuruSR

  • Member
  • **
  • Posts: 116
  • Assembler (6500, 68k, Intel), C(all), VB6, no .Net
Desktop Icons & "Is the Caret visible?"
« 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.
Learned 68k Motorola Asm instruction set in 30 minutes on the way to an Amiga Developer's Forum meeting.
Following week wrote a kernel level memory pool manager in 68k assembler for fun.

jj2007

  • Member
  • *****
  • Posts: 7551
  • Assembler is fun ;-)
    • MasmBasic
Re: Desktop Icons & "Is the Caret visible?"
« Reply #1 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.

GuruSR

  • Member
  • **
  • Posts: 116
  • Assembler (6500, 68k, Intel), C(all), VB6, no .Net
Re: Desktop Icons & "Is the Caret visible?"
« Reply #2 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.
Learned 68k Motorola Asm instruction set in 30 minutes on the way to an Amiga Developer's Forum meeting.
Following week wrote a kernel level memory pool manager in 68k assembler for fun.

jj2007

  • Member
  • *****
  • Posts: 7551
  • Assembler is fun ;-)
    • MasmBasic
Re: Desktop Icons & "Is the Caret visible?"
« Reply #3 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.
« Last Edit: October 16, 2016, 08:44:14 PM by jj2007 »

GuruSR

  • Member
  • **
  • Posts: 116
  • Assembler (6500, 68k, Intel), C(all), VB6, no .Net
Re: Desktop Icons & "Is the Caret visible?"
« Reply #4 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.
Learned 68k Motorola Asm instruction set in 30 minutes on the way to an Amiga Developer's Forum meeting.
Following week wrote a kernel level memory pool manager in 68k assembler for fun.