Solved

Keystrokes in ListView component

Posted on 2004-10-16
8
401 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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
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…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
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…

808 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