CListCtrl::FindItem

Hi All!

I need to interface with SW already available. (source is not)
I start by obtaining a pointer to the Listview control as follows:

CWnd* pApp = FindWindow(NULL,WindowTitle);
CWnd* pTmp = pApp->GetWindow(GW_CHILD);
CListCtrl* pListView = (ListCtrl*)pTmp->GetWindow(GW_CHILD);

Then I count the items using GetItemCount() (successfully)

The problem arises when I try to find an item using FindItem(&lvInfo)
lvInfo is previously defined as
LV_FINDINFO lvinfo      = {0};
lvinfo.flags = LVFI_PARTIAL | LVFI_STRING;
lvinfo.psz = psItem;

FindInfo refuses to return nothing but -1 allthough the item is present.

Any help apreciated.
Best Regards / Marcus
xflmlowAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

xflmlowAuthor Commented:
Edited text of question.
0
mikeblasCommented:
Sorry, you just can't do this.

COMCTL32.DLL owns the window in question; it's a common control. COMCTL32.DLL is mapped into the other process--that process owns the window and the strings within it.

Unless you can own that process (eg, start it as a debugee) you can't own the memory that process owns--and therefore can't reliably access the string in question.

You need to find a more reliable way to exchange data between processes.

..B ekiM
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
xflmlowAuthor Commented:
Thanks for your input mikeblas!

I accept the fact that I do not own the window in question, what I do not understand is why I'm permitted to count and even  delete items from the list (flawlessly), when I can't search it.

Can someone explain that?

/Marcus
0
mikeblasCommented:
The problem is moving memory from one process to another. Moving a value, as in a return code, isn't a problem.

..B ekiM
0
xflmlowAuthor Commented:
OK!
Thanks.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.