Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Style of desktop(ListView)

Status
Not open for further replies.

LionTiger4000

Programmer
Sep 25, 2006
4
0
0
JP
Hi.

I want to do desktop to "LVS_REPORT".
However, the icon of desktop disappears in Windows2000&WindowsMe.
---
oldstyle:=GetWindowLong(hdesktop,GWL_STYLE);

SetWindowLong(hdesktop,GWL_STYLE, oldstyle and(not LVS_TYPEMASK) and(not LVS_TYPESTYLEMASK) or LVS_REPORT);

---

Please teach the method of settlement.
I multi-posted this matter. I'm sorry.
 
Probably it doesn't work do to the fact that Bill, in His Infinite Wisdom doesn't want it configured as a report. Who are you, mortal, to change His Way? :) :)

Do not mess with Windows areas, man; ugly things can (and will) happen. Like a lightning bolt frying you, or at least a BSOD.

Your code works in Win9x?

buho (A).
 
Hello.

If DLL is made and a desktop is hooked, the code written by me will operate by Win9x and WinNT4.
Furthermore, the desktop of Windows2000&WindowsMe can be changed into "LVS_LIST" and "LVS_SMALLICON.
 
If LVS_LIST is working, then the listview can be changed.

Now, to show something in LVS_REPORT you need to have at least one column created, may be this is the problem (ie: the desktop list is configured to work as LVS_ICON, probably it have not columns defined).

buho (A).
 
The column was inserted.
Code:
 with LV_COLUMN do
      begin
       mask:=LVCF_FMT or LVCF_TEXT or LVCF_SUBITEM;
       fmt:=LVCFMT_LEFT;
       pszText:='Name';
       isubitem:=0;
      end;
     SendMessage(hdesktop,LVM_INSERTCOLUMN,0,Longint(@LV_COLUMN));
     with LV_COLUMN do
     begin
      mask:=LVCF_FMT or LVCF_TEXT or LVCF_SUBITEM;
      isubitem:=1;
      fmt:=LVCFMT_JUSTIFYMASK or  LVCFMT_RIGHT;
      pszText:='Size';
     end;
     SendMessage(hdesktop,LVM_INSERTCOLUMN,1,Longint(@LV_COLUMN));
     with LV_COLUMN do
     begin
      mask:=LVCF_FMT or LVCF_TEXT or LVCF_SUBITEM;
      isubitem:=2;
      pszText:='Type';
     end;
     SendMessage(hdesktop,LVM_INSERTCOLUMN,2,Longint(@LV_COLUMN));

     with LV_COLUMN do
     begin
      mask:=LVCF_FMT or LVCF_TEXT or LVCF_SUBITEM;
      isubitem:=3;
      pszText:='Modified';
     end;
     SendMessage(hdesktop,LVM_INSERTCOLUMN,3,Longint(@LV_COLUMN));

     SendMessage(hdesktop,LVM_SETCOLUMNWIDTH ,0,LVSCW_AUTOSIZE);
     SendMessage(hdesktop,LVM_SETCOLUMNWIDTH ,1,LVSCW_AUTOSIZE);
     SendMessage(hdesktop,LVM_SETCOLUMNWIDTH ,2,LVSCW_AUTOSIZE);
     SendMessage(hdesktop,LVM_SETCOLUMNWIDTH ,3,LVSCW_AUTOSIZE);
However, a "name" appears in all the items. "Size" etc. does not come out.
What is bad?

Is it related to the "column handler" of new shell?

WindowsXP It became "LVS_REPORT" even if it did not add a column.

 
I've tried your code in a "honest" list in the VCL.

Some funny things:

a) The columns appears with the due names.
b) The column zero is the rightmost column.
c) I have an AV every time I try to resize the columns with the mouse.

I think you forgot the cchTextMax field, but in my case the AV persists even using it.

I'm gonna take a look in the VCL code to see how it adds columns.

buho (A).
 
Column zero being the rightmost column issue solved. Sorry, my mistake.

AV resizing columns still here.

buho (A).
 
Mmmm... cchTextMax field is not needed when creating a column but when getting info about one... the help wording got me.

buho (A).
 
The AV is due to the VCL TListView not being prepared to have columns inserted "from outside".

You code is ok; it inserts the columns with the due names in my TListView.

Why it doesn't work in the desktop list I only can guess:

a) May be your LV_COLUMN record is not packed and/or

b) You are sending the LVM_INSERTCOLUMN from another process than "PROGMAN.EXE" and Windows is not marshalling the pointer.

Both guesses are highly unlikely. In "A" I cant see the reason for the list repeating the first name; in "B" an AV is the most possible behaviour.

HTH.
buho (A).
 
One solution was found.
Code:
---
function GetDefView:HWND;
var
Hdef:HWND;
begin
Hdef := FindWindow('Progman', nil);
result := FindWindowEx(Hdef,0,'SHELLDLL_DefView',nil);
end;

function GetDeskHandle:HWND;
begin
result   := FindWindowEx(GetDefView,0,'SysListView32',nil);
end;
----
oldstyle:=GetWindowLong(GetDeskHandle,GWL_STYLE);
SetWindowLong(GetDeskHandle,GWL_STYLE, oldstyle and(not LVS_TYPEMASK) and(not LVS_TYPESTYLEMASK) or LVS_REPORT);
SendMessage(GetDefView,WM_COMMAND,28716,0);

If DLL is made and a desktop is hooked, the code written by me will operate by Win9x and WinMe.
 
Googling the 'net I've got the codes:

FCIDM_SHVIEW_LARGEICON = $7029; // 28713 FCIDM_SHVIEW_SMALLICON = $702A; // 28714 FCIDM_SHVIEW_LIST = $702B; // 28715 FCIDM_SHVIEW_REPORT = $702C; // 28716 FCIDM_SHVIEW_THUMBNAIL = $702D; // 28717 FCIDM_SHVIEW_TILE = $702E; // 28718

but from where them come? Can't find them in the Win docs/source.

buho (A).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top