Solved

Keystrokes in ListView component

Posted on 2004-10-16
8
399 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
 

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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

747 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now