News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

missing windows feature

Started by thomas_remkus, June 29, 2005, 12:13:35 PM

Previous topic - Next topic

thomas_remkus

There is a topic in the "Campus" about drawing to the desktop which jarred my memory about this little project ...

I, like most people, have icons on my desktop. These icons are from the same listview control as the rest of windows. In other standard windows, like explorer, I can change the view from detailed to small or large icons. What I think is missing is the ability to change the icons on my desktop to the detailed view. To me, I think this has great advantage because you can see all of your files, and their sizes very easily.

What I feel like is missing is my ability to change to the detailed view. Here's what I am thinking:

Get a handle to the desktop, find the window that's the listview control that's actually the icons, and use something like SendMessage and tell this to be in Report view. Sounds simple enough. Has anyone else thought of this or worked up how to do this? Huge icons on my desktop are just not as helpful in all cases.

thomas

georgek01

I've developed an application that creates multiple desktops and allows you to switch between these desktops on WIN XP. From one of the calls I receive a handle to the newly created desktop. I tried changing the style to LVS_SMALLICON using SetWindowLong, but was unsuccessful.

What we have to learn to do, we learn by doing.

- ARISTOTLE (384-322 BC)

chep

Hi,

Here is a sample. It works at least on *my* Windows XP. :wink
I used WinSpy++ to find the different class names & relationships between the windows. Fortunately it is open-source so it helped me understand which APIs to use... :green


On Windows XP, the window hierarchy seems to be :

- Desktop
  - "Progman" window (whole screen)
    - "SHELLDLL_DefView" window (whole screen but taskbar)
      - "SysListView32" listview

One small drawback is that it messes the icon positions when you come back to the Large Icons view.

As a side note, maybe drawing on the SHELLDLL_DefView window's DC would allow modifying the desktop background without overwriting the icons? Anyone willing to experiment? :P

[attachment deleted by admin]

thomas_remkus

All of the icons on a Windows 2000 server desktop go away completely and you are left with a gray bar at the top of the screen. To get my desktop back I needed to run TaskMgr and EndProcess for the Explorer task and then Run the Explorer image so I could get a shell back.

Mostly, I must say this ... I really like the way you positioned your code. I'm a noob to ASM and am reading through your code and I'm finding it interesting. Even if it does not seem to work on my computer, it does provide me with information to learn from what you have done. I do have a few questions:

1) Could you not have used FindFirstWindow instead of using the Enum?

2) You are comparing eax to 7, 16, and 13. What are these for?

3) You are using a mov eith eax and 1 before you return your function. The actual value of this seems very moot as all labels in the EnumCallback function jump to the same location so your return is the exact same value in all instances. Is that needed?

Again, thanks for such an awesome sample, even though it does not work on my Win2k server. It is a very good set of ASM code that I am reading through and learning from.

thomas

chep

Quote from: thomas_remkus on June 29, 2005, 04:48:53 PM
All of the icons on a Windows 2000 server desktop go away completely and you are left with a gray bar at the top of the screen.
I got this problem, but right-clicking on the desktop worked fine for me, it refreshed the display. And I didn't pay attention to this because it occurred only once. :red

After some tracking, I found that when I first log on, the windows hierarchy is as I stated in the first post. But once the program has been run once, a subcontrol ("SysHeader32") is added as a child of the SysListView32 control. How the drawing problem is related to this I don't know, but once this subcontrol has been created there is no more display problems when changing the display style.


Quote from: thomas_remkus on June 29, 2005, 04:48:53 PM
1) Could you not have used FindFirstWindow instead of using the Enum?
Errr... I don't find any FindFirstWindow in the Platform SDK or on MSDN, but on the way I found FindWindowEx which just seems to fit the task perfectly.
I'll try to make a version using this.

Quote from: thomas_remkus on June 29, 2005, 04:48:53 PM
2) You are comparing eax to 7, 16, and 13. What are these for?
GetClassName returns the length of the class name in eax. So instead of directly comparing the strings I first check the class' length.
This is intended to speed the thing a little bit as all windows and subwindows are enumerated through this callback.


Quote from: thomas_remkus on June 29, 2005, 04:48:53 PM
3) You are using a mov eith eax and 1 before you return your function. The actual value of this seems very moot as all labels in the EnumCallback function jump to the same location so your return is the exact same value in all instances. Is that needed?

Returning 1 (TRUE) is needed to continue the enumeration of the windows :
Quote from: MSDN - EnumChildProc
To continue enumeration, the callback function must return TRUE; to stop enumeration, it must return FALSE.


Quote from: thomas_remkus on June 29, 2005, 04:48:53 PM
It is a very good set of ASM code that I am reading through and learning from.
Honestly I'm not sure this is *very good* asm : I have mostly a C/C++ background and despite my efforts I still think the "C way" even when writing asm, which is not a good approach IMHO...
But thanks anyway, I'm glad you learn from it! :wink

chep

Here's a version using FindWindowEx instead of EnumWindows.

There's still the display problem, but right-clicking the desktop should make it refresh...

I was on a way for a hack to work around this, but the behaviour doesn't seem to be quite consistent so I didn't include it in the source. :(
The idea was to post a right-click message to the ListView so that the refresh takes place, then a left-click to make the context menu disappear.
However at times this really messes everything up and icons are no more displayed, and killing the explorer process was mandatory.

Well, I guess those guys at Microsoft didn't really expect us to try to do this... :toothy

[attachment deleted by admin]

Jimg

That is really neat.  Nice job.  One problem though, anyone who trys this and didn't have their icon positions saved it going to be rather unhappy. 

thomas_remkus

Just a note, I see that http://www.pcmag.com/article2/0,1759,1159148,00.asp has a small topic on this. I'm not sure how this relates as I have not reviewed the latest code ... but I will be doing that tonight to see how this is done. This is just awesome!

georgek01

Did anyone notice their clock disappear from the taskbar?
What we have to learn to do, we learn by doing.

- ARISTOTLE (384-322 BC)

Rifleman

I am using XP HE with SP2, the clock does not disappear on my machine.  I really like this app!  :thumbu

Paul

RuiLoureiro

Hi people
            I tried and all icons in the environment disappeared and one bar was set at the screen top and a ListTreeView was created.

Jimg,
       about the "happy problem" you noted, i shut down and restarted my computer and rearranged the icons. We are happy again !
Stay well

note: It shouldnt be «missing windows feature» but «missing icons feature». :green

chep

Hi,

After playing a bit with my idea of a "right-click hack" and killing my explorer process numerous times, here it is at last!! :dance:

This version switches to LVS_REPORT perfectly on my XP box, and other styles (LVS_ICON/SMALLICON/LIST) work fine also (as before).
There's still the problem that whenever you switch styles (or logoff), icon positions are lost and your desktop is messed up, but well...

I have included 4 executables (one for each display style) but you can simply choose the one you want in the invoke ChangeLVStyle at the bottom of the file, before recompiling.
You don't have to worry about LVS_NOSCROLL anymore as this is managed in the procedure.


Cheers

[attachment deleted by admin]

thomas_remkus

Update!! On my windows 2000 machine, as long as I do not use the REPORT everything else looks good. Now, when I use the report what happens is that I get a gray bar at the top. I don't think this is really a bar but a column header. Here's my thought ... on Windows 2000 the column widths are either all 0. Does anyone know how to check this for windows 2000?

I LOVE this application even if I don't have the REPORT view. I am using the "SMALLICON" and have a shortcut to this EXE in my startup. It's working perfectly. This is something others might look at using as a way to get their icons.

thomas

Rifleman

I, too, am running it from Startup.

EDIT:  Chep, I noticed in your code example that you are having trouble with the RC file, I am including a rework of your project with a working RC file.

Paul


[attachment deleted by admin]

chep

Thanks Paul for pointing this out.

I forgot that I use a custom resource.h file with a few additional constants. ::)

Those constants (VER_*) are referenced in RC.hlp but I couldn't find them in resource.h so I added them. I find it easier to remember named constants rather than numbers... :green

Here is the modified resource.h if you want it (the constants are at the top).

[attachment deleted by admin]