Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Determining position of desktop icons

Posted on 1998-06-29
12
Medium Priority
?
330 Views
Last Modified: 2013-12-03
I want to write a screen saver that moves icons, windows etc that are currently on or open on the desktop.  I can determine the position of any window open, but am not sure how to get the position of icons on the desktop.  

Does anyone now how to get a hold of the positions of the icons on the desktop.
0
Comment
Question by:patel4694
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
  • +3
12 Comments
 
LVL 22

Expert Comment

by:nietod
ID: 1408976
The Icons are part of the desktop program, not part of the OS, so there is no API for handling them.  However there is a OLE interface to the desktop manager called IShellLink.  You might look into that.
0
 
LVL 1

Expert Comment

by:Musashi
ID: 1408977
Check the following registry entries

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\
    Explorer\Streams, and
    Explorer\StreamMRU

Then look into IShellBrowser::GetViewStateStream().

Also, do a search for Q171002,
    How Windows Stores View Preferences
   
   
0
 

Author Comment

by:patel4694
ID: 1408978
I too had found the registry entries, but how does one actually parse the binary. I do not see how ShellBrowser::GetViewStateStream() would help if I have no means of parsing the stream.

I tried to look for:

>Also, do a search for Q171002,
>   How Windows Stores View Preferences

but I did not find it on MSDN(I'm assumming that is where you meant)  I also tried to look for that question on experts exchange but there are too many question to actually browse through.

Any more suggestions.  If you have sample code or attachements you would like to send me, please send to apatel@sight-n-sound.com

0
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
LVL 2

Expert Comment

by:connex
ID: 1408979
Have a look at the online help of 'IShellFolder' in your Devstudio :) There you
can access all information you need. The Desktop is of course
just a simple IShellFolder too, accessed by SHGetDesktopFolder


0
 

Author Comment

by:patel4694
ID: 1408980
looks like this IShellFolder will only help in returning all info but the pysicall location of an items in the folder.

I want the CRect in screen cordinates of the area being occupied by an icon on the desktop. Sorry, but I don not see a way to get to that info using the IShellFolder.

 

0
 
LVL 2

Expert Comment

by:connex
ID: 1408981
Well, enuerate the items, then go via GetDesktopWindow
and GetRect of the items ... didn't try yet, should work

0
 

Expert Comment

by:waimun
ID: 1408982
I assume that u r talking about screen saver that looks something like those done by LizardWork Inc. As far as I know, there is only 1 way to do this. That is to write a hook program in a dll and then inject this hook into the desktop instance using SetWindowsHookEx.
0
 

Author Comment

by:patel4694
ID: 1408983
To connex,

I'm confused.  How do you get the rect of the item from the DesktopWindowHandle when all you have is the item(which is not even a window).

Please elaborate more.
0
 
LVL 8

Expert Comment

by:MikeP090797
ID: 1408984
Call GetDektopWindow to get the handle of the desktop. Sicnce the desktop is a listview based window, it's supposed to respond to listview messages. Use SendMessage LVM_GETITEMPOSITION to get the item pos
Tell me how it goes
0
 

Author Comment

by:patel4694
ID: 1408985
Mike, please respond to this question as an answer and not a comment(since that is the only way I can give you the points)

Meanwhile, I will try your suggestion, which make great sense.  I guess the key to this question was knowing that the Desktop was a CListView derived object.

thanks.
0
 
LVL 8

Accepted Solution

by:
MikeP090797 earned 600 total points
ID: 1408986
First try and make sure it's working
0
 

Expert Comment

by:waimun
ID: 1408987
Hi all,
As I've mentioned before, using hook is the only way out. I've tried before using the way MikeP mentioned but it could not work out. May be I did it wrongly, please keep me update with the progress as i'm also interested in this issue. Why this way fails is because Desktop is in a protected process. As u try to retrieve info from it, your explorer will generate a GP fault. Don't believe, u try. This is logical as every process in Win32 is protected. I could only set the icons positions but unable to retrieve them. At least this could not be done without using hook. If anyone know of a way, please let me know. Thanks!!!
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial is about how to put some of your C++ program's functionality into a standard DLL, and how to make working with the EXE and the DLL simple and seamless.   We'll be using Microsoft Visual Studio 2008 and we will cut out the noise; that i…
This article shows how to make a Windows 7 gadget that accepts files dropped from the Windows Explorer.  It also illustrates how to give your gadget a non-rectangular shape and how to add some nifty visual effects to text displayed in a your gadget.…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question