Click to See Complete Forum and Search --> : LVM_FINDITEM message


SunCore
May 23rd, 2006, 03:41 PM
Hi, when i'm using the following code, the application with the list view crashes.
Can someone please tell me what is the problem?
thanks in advance, and here is the code:


lv.flags=LVFI_STRING | LVFI_PARTIAL;
lv.psz=(LPCSTR)"str";
SendMessage(hw,LVM_FINDITEM,-1,(LPARAM)(const LV_FINDINFO FAR *)&lv);

Mike Harnad
May 23rd, 2006, 04:44 PM
Where does the code crash? Have you tried initializing the LVFINDINFO structure to zeroes?

SunCore
May 23rd, 2006, 09:31 PM
thanks.
i forgot to initialize the struct.

sanwal_manish
August 15th, 2006, 05:36 AM
hi,
i m gettting the same prob when i try to send LVM_FINDITEM message to Windows task manager, it crashes. can anyone tell me what could be the prob,
and how to initialize LVFINDINFO to zeros, i could understand.

here is the code

LVFINDINFO aInfoStruct;
aInfoStruct.flags = LVFI_PARTIAL|LVFI_STRING;
aInfoStruct.lParam = NULL;
aInfoStruct.psz = lpszmyString;
aInfoStruct.vkDirection = VK_DOWN;

int index = ::SendMessage(hWnd,LVM_FINDITEM,(WPARAM)-1,(LPARAM)(const LV_FINDINFO FAR *)&aInfoStruct); // this line has the crash

thanx in advance

manish

Mike Harnad
August 15th, 2006, 08:52 AM
ZeroMemory(&aInfoStruct, 0, sizeof(LVFINDINFO));

sanwal_manish
August 15th, 2006, 11:54 AM
Thanx alot,

but taskmanager is still crashing, I don't know this message is supported by task manager or not

please help me

VladimirF
August 15th, 2006, 02:19 PM
...taskmanager is still crashing, I don't know this message is supported by task manager or not...

This message IS supported by any listview. You just can't pass YOUR memory pointer to another process to use.

golanshahar
August 15th, 2006, 04:36 PM
Thanx alot,

but taskmanager is still crashing, I don't know this message is supported by task manager or not

please help me

As VladimirF already said, you cant use this message between processes, one way to do it is using Active Accessibility (http://www.microsoft.com/downloads/details.aspx?FamilyId=3755582A-A707-460A-BF21-1373316E13F0&displaylang=en), you can download the AccExplorer and use it to see the data in task manager ;)

Cheers

sanwal_manish
August 15th, 2006, 05:52 PM
Thanks for u'r replys,
yaa it seems that my structure has some prob,coz i checked my application with a test application containing list control and that is also crashing.

but i couldn't figure out the prob

here is my code,

LVFINDINFO aInfoStruct;
ZeroMemory(&aInfoStruct, sizeof(LVFINDINFO));

aInfoStruct.flags = LVFI_STRING;
aInfoStruct.psz = (LPCTSTR)"XYZ.exe";

int index = ::SendMessage(hWnd,LVM_FINDITEM,(WPARAM)-1,(LPARAM)(const LV_FINDINFO FAR *)&aInfoStruct);



can u help me

thanx in advance

manish

MXPguru
August 16th, 2006, 04:21 AM
as told by VladimirF and golanshahar... (blah blah blah)

didnt you read their replies carefully?