Solved

Keystrokes in ListView component

Posted on 2004-10-16
8
404 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

726 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