News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

LVM_GETITEMTEXT working in XP but not windows 7

Started by jimg, February 11, 2013, 04:09:57 PM

Previous topic - Next topic

japheth

Quote from: jimg on February 15, 2013, 06:12:07 AM
What version of MS link did you use?  What were the options?

I used the one included in VC++ 2003 Toolkit, but I assume any MS linker since 2001 should do.

used for debug build:

jwasm -win64 -Zi -Ic:\wininc\include ec.asm
link /debug /subsystem:console /libpath:c:\wininc\lib64 ec.obj

jimg

Thank you sir,  I misread your previous post.

jimg

#32
So, after screwing around for days, I learned I'm not ready for 64-bit assembly yet.

But, the solution did not have to be 64 bit, it only needed an LV_ITEM designed for a 64 bit listview, as Japheth did in his 64 bit program.  I couldn't find any official Microsoft 64 bit layout, so I just fudged and added some extra space at the end in case some of the last five items are actually qwords.

Here is my 32-bit test program.  It seems to work fine on both XP and 64 bit windows 7.  I used the 64 bit layout as default, and if I needed the 32 bit instead, just converted it by copying the affected items.


update: fixed error: added cColumn to structure

Don57


jj2007

Congrats, Jim - works like a charm on XP-32, too :t

jimg

And nearly as soon as I posted it I noticed that cColumns was missing from the structure.  Shouldn't have had any serious effect on what I was doing, but I'll update it in a bit.

sinsi

Windows 8 Pro x64 gives me: Unable to get SHELLDLL_defView

jimg

Ugh.    If you look at the desktop with spy++, what is the name of the item between progman and the listview?

sinsi

Progman is a sibling window to this window class - #32769 (Desktop window).

dedndave


japheth

Quote from: jimg on February 18, 2013, 04:36:04 AM
But, the solution did not have to be 64 bit, it only needed an LV_ITEM designed for a 64 bit listview, as Japheth did in his 64 bit program. 

Nice find. Does that mean that the former assumption:

Quote
I found out the while LVM_GETITEMTEXT is not supposed to work and indeed doesn't work on a virtual listview,

was premature or that the Win7 64-bit explorer doesn't use virtual listviews?

jimg

If you can trust Spy++, it says that the listview has the property style LVS_OWNERDATA, which means it is a virtual listview.

  Apparently, either it's not supposed to work, but does for some unknown reason and can't be trusted, or Microsoft screwed up the documentation.  It clearly says "LVM_GETITEMTEXT is not supported under the LVS_OWNERDATA style" here http://msdn.microsoft.com/en-us/library/windows/desktop/bb761055%28v=vs.85%29.aspx

Perhaps "not supported" means...    we meant for it to work, but sometimes it doesn't, so no guarantee, and we're not talking to you about it.

dedndave

i have minimal experience with virtual listview controls, but....

if i understand the documentation, it is designed to allow you to manage the data
http://msdn.microsoft.com/en-us/library/windows/desktop/bb774735%28v=vs.85%29.aspx#Virtual_ListView_Style

so, i am having a hard time understanding why you are trying to use LVM_GETITEMTEXT   :P

QuoteThe following messages are not supported under the LVS_OWNERDATA style:
LVM_ENABLEGROUPVIEW, LVM_GETITEMTEXT, LVM_SETTILEINFO, and LVM_MAPIDTOINDEX.

jimg

The text is the text that appears under the icon on your desktop.  Why Microsoft switched to a virtual listview for the desktop is beyond me.  But you do see why I wanted the text of the icon, right?  Or did I misunderstand the question or intended humor of the question?   I now use LVM_GETITEM to get the text purely because of the quote.  It wasn't working either until we found the right layout for the structure, but at least it isn't specifically "not supported".  (and I still think the word "supported" is really ambiguous in this case)

sinsi

Using LVM_GETITEMTEXT I can get the text from 64-bit code and using the 64-bit LVITEM structure I can get the text from 32-bit code, again using LVM_GETITEMTEXT.
Looks like you can send a message to a 64-bit program from 32-bit land, assuming you use 64-bit parameters (which they would expect).

Two questions:
1) VirtualAllocEx returns a 32-bit pointer (in my 32-bit code) into a 64-bit process, luck? Or Windows?
2) Why does LVM_GETITEMTEXT work?