Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Keystrokes in ListView component

Posted on 2004-10-16
8
402 Views
Last Modified: 2010-04-05
Hi experts,
I have minimal experience with delphi and have recently come across a fork in the road with something I'm not able to figure out. I downloaded TCPkeyhook from bitlogic.co.uk and attempted to change the Demo projects. Instead of using the memobox component I'd like to use the listview component. The project I have in mind is a listview with 2 columns using bitlogic's keyhook.dll. It will report the active window to the listview in colum1 and column 2 will hold the keystrokes. It seems everytime I set my project up this way and activate the keyhook project it add's a new item (creates a new cell) for every key pressed. I want column 2 to hold the keys pressed in a given active window until focus leaves that window and keys are typed in a different window, thus triggering a new added item. *e.g*

|Active Window|                 |Key Strokes|
        Run                          I am still in Run
     NotePad                      I am now in Notepad

column's
1.) Active Window
2.) Keystrokes recorded

Ive been doing something like:

// ---------------------------------------------------------------------->
function GetActiveWindowTitle: string;
var
Wnd: Thandle;
PC: Array[0..$FFF] of Char;
begin
Result := '';
Wnd := GetForeGroundWindow; {GetActiveWindow}
GetWindowText(Wnd, PC, sizeof(PC)); {SendMessage(Wnd, wm_GetText, $FFF, Integer(@PC));}
Result := StrPas(PC);
end;

with ListView1.items.add do
    begin
        caption := (GetActiveWindowTitle);
        with subitems do
        begin
            add(AKeyNames.KeyChar);

// ------------------------------------------------------------------>

and ending up with this: *e.g*

|Active Window|             |Key Strokes|
        Run                           W
        Run                            R
        Run                            O
        Run                            N
        Run                            G

I'd like to see how this solution is solved with code, Ive seen plenty of theory and it's got me pretty much nowhere. 500 points to the person who solves this dillema.

You may download the Demo Projects w/ DLL here
http://www.bitlogic.co.uk/downloads/keyhook.zip

Thank You,
 Alloc
0
Comment
Question by:alloc
  • 4
  • 3
8 Comments
 
LVL 12

Expert Comment

by:esoftbg
ID: 12329331
Hi Alloc,
I've next message during my attemt to download the Demo Projects:

Blocked URL:  www.bitlogic.co.uk
This page has been blocked due to security and Privacy concerns. Some Possible Reasons:
  Tracks or Profiles you.
  Gathers Private and Confidential Information from you.
  Installs software on your machine without your approval.
  Has Unsafe Content.

Do you know something about ?
0
 

Author Comment

by:alloc
ID: 12329408
bitlogic is a company of delphi software developers. No idea why it would say that.
u can downqload project here http://r1422379.hostultra.com/Project.zip
0
 
LVL 12

Accepted Solution

by:
esoftbg earned 500 total points
ID: 12330101
download an example from:
page:        http://www.geocities.com/esoftbg/
  link:        Q_21171016.zip
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:alloc
ID: 12331339
Thanks esoftgb for responding so promptly,
However, not really what I'm looking for. For a more concise picture of what I want: please view..
http://www.freewebs.com/clantn/untitled.jpg

If I were to have 'Run' as an active window and typed 'hello' I'd want it to appear in the listview as

|Window|     |Keys|            
Run               hello                    <--- I want it to display like this

rather than this....

|Window|     |Keys|
Run                h
Run                e                          <--- this is not what I want, I want the above example
Run                l
Run                l
Run                o

PS. I'm also wanting to use the TCPKeyHook from Bitlogic's website. The Demo Project w/ DLL I linked you to in my 2nd post.

Thanks,
Alloc
0
 
LVL 7

Expert Comment

by:DavidBirch2dotCom
ID: 12331841
0
 
LVL 12

Expert Comment

by:esoftbg
ID: 12331847
Please download the example again ....
I hope it is almost you want.

Best Regards,
Emil
0
 

Author Comment

by:alloc
ID: 12331932
Thanks david for the insight, I truely appreciate it. However, I wanted to use the ListView component only and esoftbg's example does exactly what I wanted and doesnt use a memo component. thanks experts ;)

Thanks again.
Alloc
0
 
LVL 12

Expert Comment

by:esoftbg
ID: 12332034
Alloc,
You are welcome !
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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 …
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

856 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