Solved

Grabbing highlighted nickname from Yahoo Chat window list

Posted on 2003-10-24
8
348 Views
Last Modified: 2010-04-05
I'm writing some DELPHI 7 utilities for use with Yahoo Chat.  Sending output from my program into the Yahoo Chat window was tricky but rather painless.  However, I would now like to be able to grab the currently highlighted nickname from the room participant list for use in my program output.  Every version of SendMessage() using GETTEXT has failed when send to that nickname list window and I stumped.  Any solution?
0
Comment
Question by:ronlinran
  • 3
  • 2
8 Comments
 
LVL 2

Accepted Solution

by:
ccrdude earned 113 total points
ID: 9620586
I don't know the Yahoo Chat... but have you already tried the GetWindowText API function?

function MyGetWindowText(h: THandle): string;
var len: integer;
    pc: PChar;
begin
   len := GetWindowTextLength(h);
   GetMem(pc,len);
   GetWindowText(h,pc,len);
   Result := pc;
   FreeMem(pc,len);
end;

If I guess correctly from your text that you already have the handle of the control you want to get the text from, this should do.
0
 

Author Comment

by:ronlinran
ID: 9621194
Okay, like I said, this problem has me compltetly puzzled.  I used the code provided by ccrdude but to no avail.  Sorry.

I have the handle of the chat room window using a call to findwindow using the 'imclass'.  Using Windowse spy program though I find that the class name of the nickname list is 'SysListView32'.  Using findwindowex with the 'imclass' window and then hooking to the 'SysListView32' window and then using the above code only returns 'List2' as the text not the actual text of the highlighted nickname in the list.  Hope that makes sense.

Anyway, thanks for trying
0
 
LVL 6

Assisted Solution

by:DaFox
DaFox earned 112 total points
ID: 9621264
Hi ronlinran,

I never used Yahoo Chat. So I don't know how the windows look like...
But this
CurrentTVItem := SendMessage(hTreeViewWnd, TVM_GETNEXTITEM, TVGN_CARET, 0);
should work as long as you are in the address space of the target app (Yahoo).

Regards,
Markus
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

Author Comment

by:ronlinran
ID: 9621415
Nope, still no dice.  I"m about ready to give up on this even though I know it CAN be done.
0
 
LVL 2

Expert Comment

by:ccrdude
ID: 9622052
I guess "List" is the name of the control, not the contents. GetText would work for listboxes, but I'm not sure about ListViews.

My idea: get the window handle.
Then do EnumChildWindows.
Print out GetClassName and GetWindowText for each handle that EnumChildWindows returns.
That way you should be able to find the correct classname of the control you're looking for.
0
 

Author Comment

by:ronlinran
ID: 9623222
Thanks for all the help to date.  The control I am trying to access the highlighted text from is indeed a ListView and that seems to be the tricky bit.  The windows API isn't someting I'm very experienced with so grabbing the currently highlighted text from the control is proving porblematic at best.  The handle to the control is something I have, just what to do with it beyond that to get the info I want is the problem.
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question